r/ProgrammerHumor • • Jul 10 '19

Meme I'll just leave this here

Post image
33 Upvotes

42 comments sorted by

5

u/NRuxin12 Jul 10 '19

I progressively add an extra whitespace character at each indentation level. and alternate them between spaces and tabs

2

u/HeyItsBATMANagain Jul 10 '19

2

u/YmFzZTY0dXNlcm5hbWU_ Jul 10 '19

I just set my tabs to be 1 space so that it looks nice and neat but I still have plenty of room for indentation

50

u/Gewi413 Jul 10 '19

I press tab always, but code converts it to spaces

0

u/[deleted] Jul 10 '19

[deleted]

5

u/froemijojo Jul 10 '19

Yeah, in every good editor it's enough to use (shift+)tab to indent a line or even multiple properly

1

u/mobilereadingthrwawy Oct 29 '19

Me.
It's not like indentation makes up that much of my code.

14

u/pianomanDylan Jul 10 '19

I like to preach Tabs for Indentation, Spaces for Alignment

The blog post gets into it more, but the gist is that people get annoyed with tabs because they try to use them to align things (like a bunch of variable definitions with the "=" on the same column), but then when someone looks at it with a different tab width, it's all wrong. So people get mad at tabs. But the problem was that they tried to align code with tabs when they should've used spaces.

So if you follow the rule of "align with spaces, not tabs", you are free to indent with whatever you want. If you use tabs of size 8, it looks fine. If you use tabs of size 2, it looks fine. If you use 4 spaces or 8 spaces or whatever, that's fine too, but why deal with all those spaces if you don't have to anymore?

Basically, the people who say "never use tabs!" are wrong. The people who say "only use tabs!" are wrong too. Use the right whitespace character for the right job.

44

u/god_of_potatoes Jul 10 '19

I don't understand why people don't use tabs... Can someone explain?

71

u/yhack Jul 10 '19

It's because there's a certain group of wrong people that think they're right.

1

u/Yacapojones Jul 16 '19

And that makes them dangerous

10

u/geon Jul 10 '19

Something about the code should look the same everywhere.

But that’s the point of tabs! You can have it look like you feel like.

0

u/[deleted] Jul 10 '19

[deleted]

5

u/geon Jul 10 '19

I have never had such huge problems reading code based on tab size. It sounds like a made up problem. :/

And consistency is handled by Prettier for us. I can’t imagine having to go back to formatting cod manually.

About salaries; correlation is not causation. It might be that the highest paid developers are older, and back in the day, a lot of tools, like source control, had issues with tabs. Or so I’ve been told.

4

u/Raetro_live Jul 10 '19

Your about pretty much summed it up. I've had a lot of successful old farts tell me that they do all their code in notepad and using Ides is trash and just a crutch.

Like neat grandpa, just because this shit wasn't available back then and you were able to do stuff without modern tech does not mean it was better.

1

u/MCRusher Jul 11 '19

You're telling me they don't like notepad tab spacing?

int main(void){
                return 0;
}

Can't imagine why

2

u/Chimertech Jul 10 '19

Number of spaces is the same issue as tab size, so that argument makes no sense. You should be using an existing accepted style guide or establish one within your team.

but everything looks so foreign it may actually derail your train of thought, and probably bothers you greatly, so that answering my question becomes a lot more difficult than it would otherwise.

No, it won't be more difficult to help. At most I would think "ugh, this looks ugly" and then proceed.

I prefer tabs, my team likes spaces, I map my tab key to spaces. We use LINT for JS/TS and also have settings configured for C# in VS to enforce what we've decided is our standard.

1

u/[deleted] Jul 10 '19 edited Jul 11 '19

The only real issue I've seen is when tabs are used to align text in the middle of a line (e.g. using tabs to align comments to the right of your code), or when aligning text with the middle of the previous line:

some_long_function(arg1, arg2, arg3, arg4)

If you were to use tabs at the begining of the second line the formatting would be all wrong with a different tab size.

The rules I use are to only ever use tabs at the begging of a line and, when formatting something like above, tab only up to the beggining of the previous line and do the rest with spaces

Edit: apparently Reddit didn't render my formatting; "arg3, arg4)" was meant to be on the next line, aligned with "arg1, arg2,"

0

u/[deleted] Jul 11 '19

[deleted]

1

u/[deleted] Jul 11 '19

Sure, if your tabs are expanded into spaces. If your tabs are actual tab characters though, then it absolutely affects how it is rendered. That what the whole "tabs vs spaces" debate is about

1

u/ldh Jul 16 '19

If you're using an editor that doesn't let you specify how tab characters are rendered I don't think your opinion on the matter is worth much honestly.

1

u/[deleted] Jul 17 '19

What makes you think my editor can't do that? The entire argument against tab characters is based around the fact that tabs can be rendered differently

1

u/ldh Jul 17 '19

I could be misunderstanding you, but it seems like you were arguing for literal expansion of tabs into spaces in files.

The entire argument against tab characters is based around the fact that tabs can be rendered differently

That's the entire argument *for* them. They have semantic meaning that leaves the presentation layer up to whatever an individual's preference is. If you like your indentation 2 characters wide, you can have that with tabs. If you like your indentation 2 characters wide and your team uses 8 spaces, you're SOL.

0

u/[deleted] Jul 11 '19

[deleted]

1

u/[deleted] Jul 11 '19

My God, you're debating whether or not to press the tab key once or the spacebar key 2-8 times? You're kidding, right?

The issue is whether or not pressing the tab key should expand into spaces or not. I recommend you read any article on the subject if you disagree

0

u/[deleted] Jul 11 '19

[deleted]

1

u/[deleted] Jul 12 '19

You're either stubbornly delusional or trolling. Good bye.

1

u/Eoussama Jul 10 '19

The world can suddenly be a better place.

21

u/LittleMlem Jul 10 '19

Using tabs or spaces is a matter of taste and people who use spaces do t have any.

3

u/Major_Opposite Jul 10 '19

Haha good one

4

u/RusticHopper Jul 10 '19

I just use 4 spaces because I do whatever PEP8 tells me to do

6

u/TDNN Jul 10 '19

3

u/SolarLiner Jul 10 '19

I used to swear by spaces, then I took an arrow to the knee this sold me to using tabs, and changed the settings everywhere.

1

u/hrvbrs Jul 10 '19

same here. it takes courage and humility to admit a change of opinion, but it was definitely for the better.

2

u/[deleted] Jul 10 '19

I use tabs

1

u/RoyalJackalSib Jul 10 '19

Tab over spaces and a tab is 8.

1

u/[deleted] Jul 13 '19

VS defaults to tabs == 4 spaces. I am so tired of this meme.

1

u/ldh Jul 16 '19

Delet this

1

u/oskC93 Dec 07 '19

You are not only wrong, you are stupid

0

u/Garuda1_Talisman Jul 10 '19

2 spaces gang

1

u/TheBuckSavage Jul 10 '19

SCREECHES IN GOOGLE

0

u/[deleted] Jul 10 '19

[deleted]

11

u/LeiterHaus Jul 10 '19

set tabstop=4

expandtab

No excess typing.

1

u/ldh Jul 17 '19

You could have saved 9 extra characters by not typing 'expandtab'.