22

We might achieve world peace one day and still won't have agreed over indentation.

Indentation = TAB. Just 1 character (N spaces = N characters = more disk space, duh!). And then each dev can chose their own TAB width (in spaces) in their IDE of choice. Beautiful.

Comments
  • 1
    How about we just learn to accept both styles? It's all the same once it is compiled into machine code.
  • 0
    @crani that's a beautiful way of thinking, very inclusive and fair, but what if we learn to be smart and converge to a single practice? It doesn't make any difference for compilers indeed, but when it comes to a team working on the same code, having people with different styles committing together and the code all messed up... well, that sucks so bad.

    Good code must be easy to read. Developers are writers in some way.

    Despite the fact that indenting with TABs is less disk consuming as well.
  • 0
    @gosubinit Visually it's the same and tabs/spaces is pretty low in my list of problematic styles clash and when reviewing someone else's code I never noticed if they were using tabs or spaces. You should try working with a dyslexic coder now that is a challenge.
    In a big enterprise grade project you are probably looking at 10 mb of wasted space, 50 max, which is pretty negligible. If you are struggling with 50 mb in your git repo you need a bigger disk.
    But hey, I love SV too and had quite the laugh at that rant but you are kinda missing the point, it wasn't about tabs vs spaces but about how petty programmers can be.
  • 0
    @crani Have you ever needed to add code with TABs (let's say that's your style) to the parts of a space-indented "if" (or vice-versa)? Os something like that?
  • 1
    I'm a tabs guy. So much that I wrote myself a plugin that jumped through a number of consecutive spaces when hitting arrow left/right - at the last company I worked at the convention was spaces.

    Can someone give me a legitimate reason for using spaces? The only reasonable one that I can think of is when using some sort of smart indent (that would result in e.g. one tab and three spaces in some scenarios).
  • 0
    @gosubinit Plenty of times, more than I probably realize tbh. Never had an issue with tabs or spaces, except for the few times I had to use Haskell.
  • 2
    I found the best way to code. Just one line, no spaces, no tabs.
  • 1
    @BikerMouse This way you don't even need to deal with \r !!!!!!!!
  • 0
    4 spaces. That's it. You can't tab to indent when you're typing code in a <textarea>.
  • 2
    @bluesdriven
    1. Why would you even think about coding in a textarea???
    2. You could make a JS script to enable TAB indenting (or insert 4 spaces on tab click)
  • 2
    @jonatan I'm thinking StackOverflow etc. I'm not actually opposed to any particular style of formatting, it's always going to be a subjective issue.

    It's consistency.

    Having files with mixed tabs, spaces, indentation, blank lines...
Add Comment