75
Comments
  • 0
    It be a close one though
  • 3
    @g-m-f
  • 5
    @g-m-f They should be forced to program stuff in python...have fun with the mixed indentation giving you errors ^^
  • 8
    Always go with spaces
  • 0
    I prefer spaces. used tabs around 4 years. Anyways modernd IDEs will correct itself and autoindent them but spaces FTW!
  • 0
    @croccifixio I think they meant tabs for indent, spaces for lining things up
    IE:
    Thing thing = new Thing( new Other( {
    Id = 1,
    ...
    }));
    Something like that, I'm just making shit up
  • 1
    @runfrodorun well indenting with space manually would be a bit dumb...(being a python guy it would be too error prone as well)
  • 2
    God dammit I just converted a project from tabs to spaces to be trendy.
  • 0
    @croccifixio yeah that's a better example. That way tabs can be set up by the reader, but the other stuff is still lined up
  • 1
    @runfrodorun yeah probanly....I don't think there would be so many people seriously using Tab
  • 1
    @SHA-256 they don't, they just think they are because of text editors and IDEs that translate tabs to spaces.
  • 1
    @jpichardo yep most likely
  • 2
    I don't care whether it's tabs or spaces, as long as I can:
    A) change a setting to change how wide the whitespace is
    B) press a key once for one level of indentation

    With that said, tab is literally designed for that so why use spaces? Sure, modern editors may be able to parse both, but why oh why would you discard a key made for that exact purpose in favour of something that's not?
    Similar to using Enter instead of adding a page break...
  • 1
    @Bikonja I use the tab key on my keyboard...sublime text converts that to 4 spaces and that's how it should be
  • 1
    @SHA-256 why? Did you read my comment fully? I want a reason why people think spaces are better. I'm ok with people saying they like them better, but only in their own use, not imposing them to others because they like them better than a tailor made solution.
  • 0
    @Bikonja
    I probably prefer spaces since I do stuff with python and Haskell, two languages which depend on indentation...using spaces makes it way more consistent... especially when working in a team. Why I use 4 Spaces ? because pep 8 says so and I don't have a reason not to use 4...
  • 0
    @Bikonja Also spaces provide consistency in the formatting of code where indentation doesn't matter...
  • 0
    PSR2 norm of PHP say also to use 4 spaces instead tab.. Why? I don't known..
  • 1
    @SHA-256 but you always use the same indentation levels, right? As in, if you use 2 spaces then it's always 2, 4, 6, ... It's not 3 or 5... And if you use 4 spaces it's always 4, 8, 12, ... Never 2, 3, 5, ... Right? In that case, you have the same amount of consistency with tabs, with the added benefit of not needing to think about how many spaces are there, but rather how many indentation levels and then you can say your indentation is x pixels instead of x spaces if you like it that way... So consistency is actually the main reason to use tabs over spaces, unless you need sub-indentation level indentation.
  • 0
    @Bikonja when you use spaces it is consistent for everyone
  • 1
    @SHA-256 Only if everybody uses the same amount of spaces. If everybody uses tabs then everybody can set the spacing to whatever they like, but the codebase is consistent for everyone. It can, however, be inconsistent between developer environments i.e. one developer does not have to have the same tab width as another so when you come to another developer it might look like he uses less or more spaces than you, but it's tabs so it's consistent in the code base, but not in display. Which is true for font size and style, coloring, etc. as well so that really shouldn't be an issue, unless you also think everybody should use the same font, font size, colors, etc.
  • 0
    Well styleguides most of the time want 4 spaces so it is very consistent
  • 1
    @SHA-256 Yes, it is... It's also consistent that variable names are pascal case if that's in the styleguide and everyone adheres to it. If it's consistent because of everyone following a style guide that says something about it then it's consistent even if you use 3 tongue-out smiley faces for indentation. Doesn't mean there's not a better alternative :)
Add Comment