When half your team uses spaces and the other half tabs... Thank god IDE can convert tabs automatically now but now we are arguing if we should use 2 or 4 spaces. It never ends...

  • 11
    Just use 4 spaces
  • 2
  • 8
    Two spaces, come on!
  • 3
  • 9
    Why would you use spaces?
    I'm probably just biased because I'm a writer, but I'd rather not use spaces.
    In the writing industry, if you use spaces instead of tabs on your manuscript, that's an automatic rejections. Agents and publishers hate it because a tab is equal to about 6 spaces. You might do 5 or 7 by accident.
    Programming is the same way. Your code won't appear as attractive without tabs. It'll look crooked.
    Also, tabs are easier than hitting spaces 6 times.
  • 6
    First of all, use tabs. Fuck spaces.
    Secondly, if you have to use spaces, use 4 fucking spaces.
  • 5
    4 spaces is the solution to everything
  • 6
    Godmin please ban spaces!
  • 9
    Oh no, I might hit space 3 or 5 times instead! Goddamn really?

    Well how about no because this never happens? Ever? Because it's really freaking obvious when things aren't aligned?

    Also, the tab key is a thing. Any editor worth its disk space inserts the proper number of spaces automatically. So nobody actually hits space space space space like a dumbass.

    Aligning ex. Multiple declarations with a type length that isn't a multiple of tab_width (e.g. char) or multiline arrays in a conditional isn't possible with tabs. "Oh, just set your tab size to x then!" Fuck you then it breaks for everyone else AND you suck. Grats.

    There's almost always ways to refactor the code to avoid these issues, but that is often simply not worth the effort and/or makes the code less readable.

    Spaces > tabs.
  • 5
    Nothing worse than dropping a 2-space block of code into a project and then having to sort out the indentation all over again...
  • 4
  • 2
    @daegontaven I was arguing for spaces, not against 😋

    ... while very pissed off at an irl coworker ...
    so it came across really bitchy. Sorry!
  • 7
    I prefer tabs for the following reasons:

    - clean single char indentation

    - copy/cut and paste is always clean because there is no risk taking spaces from indentation with you thus creating misalignment

    - smaller file size (not very important)

    - the length of the tab char can be changed in most editors, while changing space width or from x spaces to y spaces is more complex for an editor

    - no redundant characters

    - does not trigger OCD

    - the tab key is for tabs not multiple spaces thus the name tab key

    - no need to hit the space key multiple times = less noise for coworkers

    Some of these arguments are not to be taken seriously.
    I personally think that if it's not a company policy to use spaces for indentation or it is required by the project, one is insane to use spaces over tabs. But that's just my opinion and I respect other opinions.

    If I have to work on space indented sourcecode I get seriously mad. It is the worst when you have to move around blocks and always have to select codeblocks extremely precise to not take spaces with you. And some fuckers just dont care when there is a space less or more in front. FUCK SPACES.
  • 3
    @Condor yay I can save a few kb on my terabyte drive!
  • 2
    @Condor must be pretty large files if indentation makes a noticeable difference in transfer time 😮😋
  • 0
    @kenogo I don't think you will commit your source files to git with gzip. 😁
    @Cpndor Compression is not really an argument for tabs. There are other much more valid and evident reasons to prefer tabs.
    But we all can agree that tabs vs. spaces mostly is a discussion about personal preferences and in most cases doesn't need a discussion.
  • 1
    @Ashkin absolutely true 😁
  • 1
    Developers who use spaces make more money

  • 0
    @Pizza You know this statement is not valid at all.

    Spaces/tabs don't have any influence at all on how much you earn.
  • 0
    @PonySlaystation damn it was a joke 😂
  • 1
    @Condor So it will use up about 1-10% more space? That is not a lot...
  • 0
    @daegontaven yeah!
    Oh and sorry, I didn't see you already linked it
  • 0
    @daegontaven Please no chat feature requests. There is a Telegram channel for devRant and it is already bloated with hundreds of comments per day.

    What devRant probably needs is less memes, childish conversations and "buhuuu I have no gf"-rants. 😉
  • 0
    @Condor lol this comparison 😁
  • 0
    @daegontaven ah, yeah that would be great! 😎
  • 0
    @Condor @daegontaven I just checked and it seems it has been deleted...
  • 5
    @Michelle using spaces is not actually hitting space several times. The space that is created is actually made of spaces, but you still press tab. Tabs can be different length however spaces are usually always same length everywhere, which is why people prefer them, I think.

    Seems like majority of people in this thread think that using spaces is having to hit space bar multiple times :P
    Again, using spaces is using same tab button but instead of usual tab it creates 4 spaces.
  • 0
    @micropi Welcome to devRant! 😉
  • 1
    @micropi THANK YOU!
    When I was reading these comments I was like: do they really think, indenting with spaces means using the space key?

    This discussion is purley about the content of the code, NOT about what keys were pressed to create it, because you need the exact same keypresses for both, tab-indentation and spaces-indentation.
  • 0
    When in doubt and flame wars: tabs and set display width to taste
  • 0
    I still don't get.
  • 0
    Ahh, I see. Thanks for the clarification.
  • 0
    I don't get the whole "spaces vs tabs" thing.

    All my IDE's and text editors auto-indent most of the time, when I need to adjuat I normally use tabs, sometimes spaces for very small adjuatments for which tab is too large.
  • 0
    @micropi but what if a colleague of yours prefers 2 spaces worth of indentation? If you just let the editor input tabs when you press tab, they could set the display width to 2, and so can you, set it to 4 :)

    Also, I would think using tabs will cause your code to be more efficient. 4 characters is a redundant way to express 4 characters worth of nothing, when you can express it with a single tab.
Add Comment