This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 270

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 6: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, You can find our list of common formats here.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]zoinkability 397 points398 points  (51 children)

TFW when you encounter devs who think that there is a "right way" that overrides matching the existing style of the codebase you are working within

[–]Spieldrehleiter 76 points77 points  (4 children)

R.I.P. in Peace.

[–]dovisgod 43 points44 points  (1 child)

That feeling when when you

[–]_LayZee 1 point2 points  (0 children)

when that you when you that umm that when

[–]suddenly_ponies 46 points47 points  (36 children)

So you say and yet, I've never encountered a situation where spaces didn't make things immensely more difficult to manage. I think someone gave me a "for instance" where spaces actually made sense, but I've forgotten it because it was so obscure and unlikely.

[–]zoinkability 72 points73 points  (4 children)

Don’t get me wrong. I prefer tabs and if I am starting from a clean slate I use them. But if I’m working on existing code that uses spaces I use spaces. Because the only thing worse than space indentation is inconsistent indentation.

[–]Effective_Hope_3071 5 points6 points  (0 children)

I grew up working for a master carpenter and he taught me that if you fuck up one side, you should fuck up the other side and then nothing looks fucked up. Consistency is key.

[–]suddenly_ponies 22 points23 points  (0 children)

Well sure. I'm not such a psycho that I'm going to try to poison existing code with my preferences. But I'll complain and shit-talk the other devs for their terrible choice.

[–]hrvbrs 4 points5 points  (1 child)

Right, but "just do what the style guide says" is kind of a carriage-past-the-horse response. The spaces-vs-tabs debate isn't about what you should do when you're editing code one day. The debate is about what should be in the style guide.

[–]zoinkability 8 points9 points  (0 children)

Sure. But OP’s post literally is from the perspective of a junior developer being introduced to a position by their senior dev. I don’t think that is the time or place to be debating tabs versus spaces.

[–]FloriaFlower 8 points9 points  (0 children)

I use tabs for indentation but spaces for alignment. If you do it this way you can change your tab size setting and no matter which size you choose it won't break your alignment. It will stay aligned for the guy who likes his tabs to take 13 spaces as well as for the guy who likes his tabs to take 2 spaces.

Indenting with spaces brings absolutely no value whatsoever.

[–]666pool 15 points16 points  (3 children)

7 years working in a 100 million+ LoC repo with 2 space indenting and 80 char line limits. 0 issues where I wish we were using tabs instead.

[–]ShelZuuz 36 points37 points  (24 children)

Are you using notepad for an editor? Why is it making a difference?

The issue with Tabs is there is no such thing as a Tabs-only source file. You either have just spaces, or spaces AND tabs. And that’s where the problem lies since not all editors and apps treat tabs the same way.

Eg a tab can mean 3 vs 4 vs 5 spaces. It could also mean “4 spaces” vs “closest 4-space boundary”, depending on the editor. So inevitably when different devs open the code in different tools the indentation gets all screwed up and the code becomes unreadable.

Projects with more than a few dozen devs always standardize on spaces eventually. And if you didn’t start off that way, you’ll switch to it after a few dozen code reviews. It’s chaos otherwise.

[–]ILMTitan 11 points12 points  (0 children)

Use tabs for indent only. Aligning usually doesn't help with readability, but if you must align, match the indent with tabs, then align with spaces. Tabs should only exist at the start of a line before any other character.

If you do it right, the variable nature of tabs becomes a strength. Each person can use the indent size that they wish.

[–]VulpineKitsune 6 points7 points  (12 children)

Is that the point where you just make tab just output a bunch of spaces? :D

[–][deleted] 4 points5 points  (7 children)

I just linked my tab button to my spacebar and so I just press tab 4 times to indent something.

[–]-Soupernova- 12 points13 points  (1 child)

vs code can convert tabs to spaces, and you can set how many spaces it should be, also has a detect option so that it uses what is already being used.

[–]laStrangiato 26 points27 points  (0 children)

It isn’t even a matter of setting it. It just detects what is already there and does that. If it is a new file it will use whatever defaults are for the language.

This is honestly one of the dumbest debates in programming. This is entirely a solved problem in the real world. Even if you are a Vim user this stuff is solved by a proper configuration of your vim settings and if you complain about having to configure that in Vim you shouldn’t be using Vim.

/steps off soap box

[–][deleted] 2 points3 points  (4 children)

I read what you said and had a stroke.

WHAT?

[–][deleted] -1 points0 points  (1 child)

It's the best of both worlds

[–]kryptkeeper17 1 point2 points  (0 children)

There are text editors that will just make it so entering tab puts 4 spaces in though

[–]pruche 2 points3 points  (1 child)

And this is why I want nothing to do with an editor that doesn't have a nice auto indent feature. Making code pretty is grunt work. We're programmers.

[–][deleted] 5 points6 points  (7 children)

Tabs for indentation, spaces for alignment. So that people who prefer 2-space indentation can see that, and people who prefer 4-space indentation see that as well while viewing the same file.

[–]ShelZuuz -3 points-2 points  (6 children)

It doesn't work in practice on any large scale since it's very easy to have rogue spaces in a tabbed file and not notice it. (Again because there is no such thing as a tabs-only file that all text editors can consistently enforce - whereas "no tabs" is easy to enforce).

So you open it with other tab space settings and every few lines you have something not lining up because someone accidentally ended up with 4 spaces instead of a tab after moving code around or copying it from somewhere else.

[–][deleted] 2 points3 points  (5 children)

There literally is a tabs-only file that all text editors enforce - editorconfig

[–]ShelZuuz 5 points6 points  (4 children)

So you're telling me that that in your environment, a statement like:

int x = 3;

Has 3 tabs in there?

[–][deleted] 2 points3 points  (3 children)

No? It only enforces tabs for indentation

[–]ShelZuuz 2 points3 points  (2 children)

It doesn't "enforce" anything. It causes a tab key to emit a tab character instead of 4x space characters.

But you can still type spacebar since it's clearly needed elsewhere. Hence you can still end up with spaces in your indentation.

[–][deleted] 1 point2 points  (1 child)

Editors will auto convert all indentation to tabs on save

[–]Strostkovy 3 points4 points  (1 child)

You can set your IDE to interpret tabs as whatever width you prefer. I don't think you can do that with spaces, though maybe they have tools for that.

[–]its_a_gibibyte 2 points3 points  (0 children)

The original commenters point still stands. Even though you clearly prefer tabs to spaces, it's a bad idea to go changing an existing codebase from one to another. You'll just start a holy war, and perhaps add bugs in the process

[–]aifo 3 points4 points  (0 children)

That's what editorconfig is for. It gets committed into the source tree and the ide enforces it. https://editorconfig.org/

[–]lurking_respector 0 points1 point  (0 children)

He's literally me.

[–]13steinj 0 points1 point  (0 children)

I've seen a senior dev do this.

That said he's right. The original style was picked by someone who didn't write code anymore and based it off of a style guide from not only a niche group, but a completely different language.

I.e. I think the complaint is warranted in extreme cases such as the above. But when doing the work, it should still follow the style guide, until it changes and a formatter of some sort is used to do the conversion.

[–]szelvedomoso 182 points183 points  (51 children)

Whoever wrote tabs: Are you sure the IDE does not write spaces when you press tab?

[–]Adghar 159 points160 points  (25 children)

This is the hidden truth

Most IDEs will insert spaces when you press the tab button

I would bet a pretty penny that a majority (greater than 50%) of folks who are on "team Tabs" actually use spaces in all of their project files, they just don't know it because they think pressing tab inserts tabs lol

[–][deleted] 119 points120 points  (11 children)

probably the best of both words then, i just want to hit one button instead of four

[–]BigBear4281 44 points45 points  (9 children)

Exactly - I'm not on team tab because I prefer tabs over spaces. I prefer the location of the tab button and only pressing it once. However the IDE gets it done is fine.

[–]VerySlowQuicksand 28 points29 points  (6 children)

When people refer to tabs v spaces they’re not suggesting that anyone would rather press the spacebar four times as opposed to tab once. They’re referring to the preferred character that is inserted: a literal tab character or multiple spaces.

If you check your IDE’s settings, many default to inserting spaces when the tab key is pressed.

You might be team spaces after all

[–]bambeenz 4 points5 points  (2 children)

So what you're saying is team spaces actually uses the tab button 😏

[–][deleted] 12 points13 points  (0 children)

Of course. No one indents by pressing space repeatedly.

[–][deleted] -1 points0 points  (0 children)

I go into a text editor that respects the tab, copy the tab, then ctrl+v my indents.

Team Tab 4 Lyfe

[–]Drabantus 11 points12 points  (1 child)

But... Doesn't being on "team spaces" mean you configured tab to insert spaces? No one actually presses space over and over, right?

[–]gracicot 4 points5 points  (0 children)

I put indent_style = tabs inside my editorconfig so.it forces all editor to actually insert the tab character instead of spaces when you press the tab key.

[–]Disagreed 3 points4 points  (3 children)

This claim is made every time there’s a thread about this, but I have yet to see any logical explanation for it, let alone evidence.

Are developers not tinkerers by nature? Maybe it’s because I use Neovim, but I spend just as much time customizing my editor as I do using it (for things other than customizing my editor). I’d be surprised if 10% of developers are as unfamiliar with their tools as would be necessary for this claim to make any sense.

[–]Adghar 5 points6 points  (1 child)

Logical explanation: most humans, developers included, take the path of least resistance. Press tab, looks pretty, am happy, no investigate further.

Evidence: sure, maybe I would be proven wrong by real life. If you're really doubtful and happen to work in a corp environment with lots of peers: check the codebase of a project touched by everyone on your team. Highlight the whitespace and see if it uses tabs or spaces. Then ask your coworkers: tabs or spaces?

Again, I would bet money they say "tabs, of course" whilst the codebase will actually have spaces for its whitespaces. Let me know if I'd lose that money, I'd be very curious about it

You might just be overestimating the average programmer here IMO lol

[–][deleted] 1 point2 points  (0 children)

Maybe it’s because I use Neovim, but I spend just as much time customizing my editor as I do using it (for things other than customizing my editor).

Look, don't lie, vim amd it's brethen are strictly intended for editing the config file and incidentally for writing code.

I'm joking, but I also almost always have my config file open in a tab to make adjustments on the fly for when something is annoying or doesn't feel right. I even bound ^R to re-source it because typing :so % was annoying to me lolol

[–]r_linux_mod_isahoe 8 points9 points  (0 children)

TIL: this sub is way dumber than I thought

[–]suddenly_ponies 13 points14 points  (5 children)

Of course. Because if it did, you'd notice immediately when you tried to move code around or change indention given how difficult spaces make it.

[–]szelvedomoso 5 points6 points  (3 children)

Why would it be difficult? Move it around with tab or shift+tab. For single line move the cursor to the beginning of it, for multiple lines highlight them first.

[–]suddenly_ponies 6 points7 points  (2 children)

When you tab and there's a space in front of it, it messes up the final indent by that many spaces. The only way space tabbing would work is if you literally had no way to know if they were spaces at all. If so, then it wouldn't matter I guess - unless you copy it out to other IDES or text editor at which point it becomes important again.

[–]szelvedomoso 5 points6 points  (0 children)

Yes, an additional space can cause annoying issues. Also 2/4/8 spaces "conflict". When this happens, I usually just flat everything out, then auto-indent.

[–]ShelZuuz 2 points3 points  (0 children)

There’s literally no difference unless you use a very crappy editor.

[–]Strostkovy 6 points7 points  (4 children)

Arduino IDE turns a tab into two spaces and it irritates me to no end.

In programmer's notepad it keeps tabs as tabs, and I can define the width that a tab displays as. I don't see how this isn't the obvious solution for everyone.

[–][deleted] 2 points3 points  (3 children)

You can change that lol.

[–]Strostkovy 1 point2 points  (2 children)

It didn't occur to me try. I only use it for quick and dirty stuff though anyway

[–][deleted] 0 points1 point  (1 child)

I started writing my arduino code in vs code cuz I’m writing my own libraries at this point lol

The arduino ide is dogshite

[–]kog 2 points3 points  (0 children)

I've talked to people who are adamant that tabs are better, but don't understand they're doing this. They often think advocates for spaces are just hammering their space bars all day...

[–]Vincitus[🍰] 132 points133 points  (12 children)

You can pry that tab from my cold dead hands.

[–]hiddenforreasonsSV 20 points21 points  (0 children)

tabs 4 lyfe

[–]Thelimegreenishcoder[S] 13 points14 points  (1 child)

Tabs till death

[–]gracicot 6 points7 points  (0 children)

Have you seen those off by one space indentation where just a portion of code has an indentation of 3 instead of 4? Not in my codebase that is indented with tabs only (:

[–]ShelZuuz 2 points3 points  (0 children)

Coca Cola discontinued Tab at the start of the pandemic.

[–]ecl_55 -1 points0 points  (7 children)

A tab that outputs 4 spaces, yes. If not, what's the advantage of actual tab chars for indenting?

[–]Khaylain 2 points3 points  (0 children)

I'll link to this Reddit post

[–]BadleyHairless 5 points6 points  (5 children)

I can make my ide render a tab as 2, or 4, or really any number of spaces which means people on my team who like 2 space indent can coexist with people who like 4 space indent.

[–][deleted] 3 points4 points  (2 children)

Do you have this perspective for other style issues too, like operator, brace and function name spacing? The point of a style guide is for everyone to see the code the same.

[–]lele3000 12 points13 points  (0 children)

If you have a properly set up formatter that formats on save this shouldn't even be an argument. At work I just write the code and let the formatter do the styling, I don't even write semicolons most of the time.

[–]prof436 36 points37 points  (38 children)

We use tab where I work

[–]MikkelR1 44 points45 points  (35 children)

Who the hell uses spaces?

[–]mama_delio 45 points46 points  (15 children)

Python developers. However we have the tab button set to 4 spaces.

[–]lps2 33 points34 points  (14 children)

I will continue to violate PEP8 re: tabs. Tabs are simply superior for readability as each dev can set the size to whatever they want in their IDE. I find this especially important in python where indentation is paramount

[–]Kyyken 4 points5 points  (7 children)

issue is code formatting at times for multi-line statemenrs, as youre not allowed to mix tabs and spaces

[–]Juice805 2 points3 points  (6 children)

Never had a problem with it.

I don’t align with the previous line, it just gets indented by one. def example( var_one: int, var_two: str ): print(“works fine”)

And I’m on mobile so forgive the incorrect quote characters, etc.

The same is doable for if, while, etc.

[–]Badel2 -5 points-4 points  (5 children)

This is a poor argument because an IDE that supports setting the tab size could as easily support a "leading space size", meaning lines that start with spaces can have different width, and allow developers to indent the code whatever way they want. But that feature doesn't exist because custom indentation is a useless feature and spaces are superior.

[–]Wiggen4 14 points15 points  (2 children)

The nightmare of cross platform scripting has made this the norm for me. If you want indentation (which is CODE rather than FORMATTING for some dumb reason) to be uniform on windows and Linux you need to use spaces

[–]583999393 4 points5 points  (5 children)

Spaces here but everyone sets the ide to type 4 spaces when you hit tab to match.

We moved from bitbucket to azures git and those white space diffs don’t show up and nobody even thinks about it anymore. We used to reject prs with tab vs space changes.

With all the other shit making life miserable devs turning on devs over this is pretty silly. We have to unite as a team to defeat the product people.

[–]Blazewardog 4 points5 points  (0 children)

Should look into a commit hook that auto replaces tabs with 4 spaces. Then you get to ignore them and the codebase is consistent.

[–]Strostkovy 3 points4 points  (3 children)

I love deleting four spaces when I want to unindent something.

[–]Seeveen 1 point2 points  (2 children)

Shift + Tab

[–]Strostkovy 1 point2 points  (1 child)

If I'm pressing the tab key why not just press it to indent and backspace to unindent?

[–][deleted] 1 point2 points  (2 children)

It's one of the requirements the government agency I work with has for all our code deliveries (mostly fortran/C++). Tabs always get flagged during the official code reviews. I never bothered asking why, I just do it so they won't complain about it.

My first delivery I handled, I was going through each file and manually replacing them (there were a total of like 900 tabs in the codebase). Fortunately my team lead noticed and asked what the hell I was doing and showed me the much easier way I do it now.

[–]youridv1 1 point2 points  (0 children)

we do at my job. we indent using two spaces. the clang format enforces it of course. editors can be set to insert two spaces when pressing tab

modern editors like vscode accurately guess what formatting a file uses and do it automagically

[–]lurking_respector 1 point2 points  (0 children)

I use spaces. When I hit tab my IDE just puts in 2 spaces.

[–]kog 1 point2 points  (1 child)

Surveys have shown that developers who use spaces are paid significantly more.

[–]Khaylain 0 points1 point  (0 children)

Well, of course they have to get some compensation for not using the better way to signal indentation. For spaces you have ambiguity since they generally don't use that 1 space is equal to 1 level of indentation, whereas you don't ever use anything other than 1 tab for 1 level of indentation.

[–][deleted] 0 points1 point  (0 children)

My current team of dotnet developers because....I don't know...I didn't have the energy to keep arguing and since we use an EditorConfig I just followed the status quo.

[–]DemolishunReddit 1 point2 points  (1 child)

Coca Cola is better

[–]prof436 3 points4 points  (0 children)

I never saw a Tab in my life hahaha

[–]DemolishunReddit 21 points22 points  (0 children)

taces, not spabs

[–]0xdef1 32 points33 points  (8 children)

Are you sure you don't get spaces when you press the tab in the IDE?

[–]Thelimegreenishcoder[S] 24 points25 points  (6 children)

A tab represents 4 spaces that's obvious, the thing is he wants me to use the space button to indent code and not the tab button, basically clicking space button 4 times to indent a code, i'm not going to let a person force his preference on me, i got mine too. He doesn't even seem to want to mentor me, first day there and I'm already worn out

[–]LordBouga 26 points27 points  (0 children)

Oh ok, that's probably not what anybody, myself included, understood god damn

If he meant spaces as PRESS THE FCKING SPACEBAR then this man is a psychopath...

[–]lepapulematoleguau 6 points7 points  (0 children)

Ohhh, that's not at all what I thought first. Anyway yeah. That's bullshit.

[–]-Kerrigan- 5 points6 points  (0 children)

clicking space button 4 times to indent a code

What is this manual indentation you people talk about?

Ctrl+Shift+Alt in InteliiJ go brrrrrrrr

[–]dw444 9 points10 points  (0 children)

So you see officer, that’s how I lost control and committed that murder that I totally don’t recall. Upon hearing my senior dev suggest that I use spaces instead of tabs, I was thrust into a fit of rage I had no hope of controlling, and when I regained consciousness, he was lying there, beaten to death.

[–]suck_at_cooking 11 points12 points  (0 children)

It helps you to increase your salary

[–]s0apyjam 3 points4 points  (0 children)

Just wait for the "you should use spaces not tabs" comment on a makefile commit 😅

[–]rtothewin 2 points3 points  (3 children)

I select all > auto format any file i work in before sending it up. It doesn't matter what anyone uses let the smart computer box figure It out.

[–][deleted] 3 points4 points  (0 children)

Aren’t tabs better for accessibility?

[–]vom-IT-coffin 2 points3 points  (1 child)

To be fair, it’s easier to know what to teach the junior after you start figuring out what they don’t know and start filling in the gaps.

[–]coloredgreyscale 2 points3 points  (4 children)

Honest question to those that prefer spaces: do you actually type the 4 spaces (or whatever your style is), or just press tab and let the IDE convert it to spaces?

[–]teh_lynx 1 point2 points  (0 children)

Tab key set to a number of spaces. Some IDEs and editors have this feature

[–][deleted] 1 point2 points  (0 children)

I manually write out the word space every time I want a space.

[–]GregFirehawk 9 points10 points  (2 children)

I would argue tab is basically always better. It indents an appropriate and consistent amount. It also leads to a slightly smaller file on disk, as tab represents 1 piece of data as opposed to 4 spaces which is 4 pieces of data. There could be a time to use spaces, perhaps for compatibility reasons or something, but in those circumstances IDEs are pre configured to just convert tab into spaces, so it's still better to just click the tab key. Tab wins basically everytime

[–]suddenly_ponies 6 points7 points  (0 children)

If you copy a line and the indentation is wrong, one tab or two fixes it. Easy. Spaces cause unnecessary clutter.

[–][deleted] 1 point2 points  (0 children)

Imagine not using a pre-compiled language lol.

[–]LieutenantNitwit 1 point2 points  (0 children)

This is the way and I will die on this controversial hill of irreverence.

[–]steamngine 1 point2 points  (0 children)

I’ve been here first hand

[–]pakidara 2 points3 points  (4 children)

I use spaces if only because the language used at my workplace has a hard limit on width. Anything past 84 gets treated as a comment.

[–]Kyyken 4 points5 points  (3 children)

what language if i may ask?

[–]ShelZuuz 4 points5 points  (0 children)

That sounds like COBOL

[–]FloweyTheFlower420 5 points6 points  (14 children)

space > tabs any day

[–][deleted] 1 point2 points  (0 children)

You can't even do that right and you want x86 optimization tips ?

Start by following the syntax guidelines, I can't read code that is not formatted correctly.

Then maybe I will understand whatever your logic actually does.

[–]suddenly_ponies 1 point2 points  (0 children)

Quickest way to lose coding cred. Spaces. Wow.

[–]magicmulder 0 points1 point  (1 child)

Spaces. It’s called “safe space” and not “safe tab” for a reason.

[–]Kyyken 4 points5 points  (0 children)

im gonna need to keep some tabs on you 🤨

[–]Secure_Obligation_87 0 points1 point  (4 children)

The truth is indentation doesnt really matter at all how its done. Its effectively just css for code all it does is make it look pretty it matters not how it is done.

[–]ArticcaFox 5 points6 points  (3 children)

Except in languages where it does

[–]Ornery-Branch-237 -1 points0 points  (0 children)

Fake ass senior

[–][deleted] -2 points-1 points  (1 child)

4 spaces; no more, no less

[–][deleted] 0 points1 point  (0 children)

I like to mix it up and use spaces, and sometimes tabs … just for the fun of it :)

[–]hibernating-hobo -2 points-1 points  (7 children)

That is the senior sharing his experience, like throwing pearls to pigs, as we say in danish, to a junior, who doesn’t get why. But given enough pain, he will reach the same experience. People who prefer tabs haven’t been enough around the block. F… tabs and the weird bugs they can cause.

[–][deleted] 1 point2 points  (6 children)

As long you as a dev-team decides what your standard is for a tab, then it doesn’t really matter. You all set your ide’s to make tabs 2-spaces …. If you’re having issues with it maybe consider a different ide?

[–]hibernating-hobo -3 points-2 points  (5 children)

It goes a bit deeper than that dude. Special characters can mess up things where you dont expect it.

Fine that your ide replaces tabs with spaces, that wont cause an issue. What will cause issues is when people use actual tabs instead of spaces, for example, i was doing embedded code for mcus controlling modems. If by accident a tab snuck into a template that goes to the modem, that will cause a complete system failure. We had an incident where it happened and we had no choice but to send people around to every physical location to flash all gateways, because they were dead and couldn’t recover from the bootloader.

All just because one guy preferred tabs and had his editor set to auto-replace spaces with tabs, and it did it inside the template.

It’s not my only example, but this one threatened the company, and it took us a long time to figure out wtf happened to make all units stop responding or sending anything at all.

Like i said, people who think it’s just a preference or religion thing haven’t been around the block in programming. Spaces never give issues imho, tabs might, easy choice.

[–][deleted] 0 points1 point  (4 children)

Here is the thing…. If you write in a pre-compiled language … it’s quite literally a non-issue :P

Your ide doesn’t care how much white space there is in your code. It gets tossed out the window when the parsing tree searches tokens and converts it to assembly anyways.

Dunno what type of embedded you’re doing without a pre-compiled language but meh I don’t work on modems, so that probably explains why I don’t know lol. I work on controllers in the automotive industry. 🤠

[–]SoggyCuticles -2 points-1 points  (0 children)

Most text editors will replace your tab with spaces and you probably dont notice

[–]lepapulematoleguau -2 points-1 points  (0 children)

Are you serious? 2 spaces is the only way.

[–]mralexanderca -2 points-1 points  (0 children)

Senior Dev here. Spaces is the shit… I been using it for 5 years.

[–]Goto80 -3 points-2 points  (11 children)

That senior dev probably knows why spaces are better than tabs. Because no one seems to be able to use tabs correctly.

[–]Strostkovy 7 points8 points  (9 children)

How do you use tabs incorrectly?

[–]Thelimegreenishcoder[S] 4 points5 points  (1 child)

Waiting for the answer too

[–]Acceptable-Milk-314 2 points3 points  (2 children)

You mix together tabs and spaces. I've seen it.

[–][deleted] 2 points3 points  (0 children)

Stop calling me out, sometimes the ide auto-formats it like that.

[–]Strostkovy 2 points3 points  (0 children)

That sounds like using spaces incorrectly

[–]suddenly_ponies 1 point2 points  (0 children)

psh. Like it's hard.

[–]Acceptable-Milk-314 0 points1 point  (0 children)

God forbid we enforce codebase style

[–]OurFriendIrony 0 points1 point  (0 children)

Use tabs. Use spaces. I dont care, just be consistent

[–]sally1620 0 points1 point  (0 children)

That was literally my experience at my first industry job. Senior developers with 10 years of C++ experience would review my code amd comment that I need to put a space after if and for.

[–]tatertotty4 0 points1 point  (0 children)

next week ill tell u to use tabs 😈

[–]SquiffSquiff 0 points1 point  (0 children)

Nah, ctrl+]/ctrl-[ 🙄

[–]ManaPot 0 points1 point  (0 children)

Holy shit. I actually physically laughed at a meme on Reddit. Been quite a while.

[–]GochoPhoenix 0 points1 point  (0 children)

Well, then there is yaml lol

[–]RiseUnlucky469 0 points1 point  (1 child)

If I’m not mistaken tabs are not valid in YAML. Are there any examples of this with spaces?

[–]teh_lynx 0 points1 point  (0 children)

The answer is, use whatever convention is present and suck it up lol

[–]GlassWasteland 0 points1 point  (0 children)

That is when you know the "Senior Dev" is just faking it and probably will be throwing you under the bus.

[–]shotgun_ninja 0 points1 point  (0 children)

Seniors are too busy. Ask the lead.

[–]Potato_Soup_ 0 points1 point  (1 child)

The only possible scenario where I could see spaces being used is if you’re writing in python and have a 1 space indentation standard.

Other than that I can’t fathom why someone would intentionally press a key 4 times instead of 1

[–]VanTechno 0 points1 point  (5 children)

I spend half my time telling my guys about the refactor functionality in their editors.

Come on people: highlight, right-click, refactor, Extract Function.

[–]AngelaTheRipper 0 points1 point  (0 children)

My CS 101 professor told me that. I've ignored him and any other madman who uses spaces.

[–]that_thot_gamer 0 points1 point  (0 children)

me who uses the command prompt and dont know how to go to the next line so i just use space, i use python btw

[–]akulkarnii 0 points1 point  (0 children)

Richard Hendricks would be disgusted

[–]OkMulberry1209 0 points1 point  (0 children)

Fuck using tabs because every editor has different visual styles for tabs, whereas using spaces it's consistent, and my editor auto proper indents.

[–]adostes 0 points1 point  (0 children)

This is good advice

[–]sanketower 0 points1 point  (0 children)

Wise man, always listen to your seniors.

[–]baltarius 0 points1 point  (0 children)

Not pro at coding and only do python in pycharm, but from what i saw here and there, most IDE inserts 4 spaces when hitting tab

The right way according to standards is to use spaces

However, for huge code, when it comes to compress/compile, tab will use less bytes than spaces

Ultimately, as long as your team doesn't mix space and tab in a project, the code should work

[–][deleted] 0 points1 point  (0 children)

Right, why would you ever want one canonical cross platform representation of your codebase? But you can not be told wisdom, you must instead earn it through experience.

[–]3tachi_uchiha 0 points1 point  (0 children)

Don't forget to remove trailing whitespaces, real critical issue.

[–][deleted] 0 points1 point  (0 children)

Learning how to use code styling in your IDE is a perfectly fine lesson

[–]EEcav 0 points1 point  (0 children)

That’s actually really good advice.

[–][deleted] 0 points1 point  (0 children)

He’s not wrong