Tabs vs Spaces?
Pandiyan Murugan

Pandiyan Murugan @pandiyancool

About: Click the follow button to get more interesting content! https://efficientuser.com/ Say hi to me at twitter @pandiyan_cool

Joined:
Mar 13, 2017

Tabs vs Spaces?

Publish Date: Feb 21 '20
5 39

What're the real technical key aspects that need to be considered before deciding or coming to a conclusion of battle of Tabs vs Spaces?

Comments 39 total

  • SaKKo
    SaKKoFeb 21, 2020

    I like spaces because when i copy paste something to terminal some time tabs caused errors. especially in ruby console

  • Gaurav Saini
    Gaurav SainiFeb 21, 2020

    I’m all for tabs. Tabs are semantically meant for indentation and count as 1 character vs the 4 spaces thus resulting in smaller file sizes

    • Leigh Barnes
      Leigh BarnesFeb 21, 2020

      hmmmm.... your raw files accessed without any compilation? In general everything I work has some form of minification step involved, it makes zero difference to size or perf.

  • rhymes
    rhymesFeb 21, 2020

    Use Go so you don't have to decide 😂

    The formatting tool uses tabs and that's the standard

    I use spaces in all the other languages but I'm super okay with Go which decided to kill this conversation from day 1 😂

  • Alex de Sousa
    Alex de SousaFeb 21, 2020

    I use spaces, but I've heard a compelling argument favouring tabs.

    Tab width can be customized easily in any editor. This is useful for people with visual impairments:

    If someone needs larger fonts, then, to fit relevant code in the screen, reducing the tab width might help. With spaces, this kind of customization is hard to accomplish.

    This same argument works for 80 character lines.

    In the end, I don't really care. I would gladly switch to tabs if that helps people with visual impairments to contribute to open source or private code bases. I only care about consistency.

  • Paweł Kowalski
    Paweł KowalskiFeb 21, 2020

    Its 2020, stop talking about it and start using editorconfig.

    • Kyle Griffin
      Kyle GriffinFeb 21, 2020

      Yep. Tabs is the correct answer so people need to stop.

    • Philip
      PhilipFeb 21, 2020

      You are absolutely right. The question is though: should we put tabs or spaces in the config? ;-)

      • Pandiyan Murugan
        Pandiyan MuruganFeb 21, 2020

        I was about reply the same :p

        Using config is fine.!

      • Paweł Kowalski
        Paweł KowalskiFeb 21, 2020

        Whatever you feel like it. It doesnt matter. And if project already has one, forget about it and do your job.

    • Pandiyan Murugan
      Pandiyan MuruganFeb 21, 2020

      I'm collaborating with different projects.

      I'm using the tabs in some project and space in some project

      Editor config saving me daily. Without mixing up I'm using target things properly.

  • Lionel Gaillard
    Lionel GaillardFeb 21, 2020

    I use spaces because I stick to conventions, but I would prefer tabs because:

    • That the purpose of tabs.
    • Count as one character.
    • Accessibility: IDEs can display tabs with selected width.

    I read a post about a guy with a severe sight issue, who, to be able to code, had a very large font size configured in his IDE.
    But at this font size, four spaces are huge, and he had to scroll horizontally all the time.
    So each time he edited a file, he changed spaces to tabs (which were displayed with a width of one space), and changed back tabs to spaces before to commit !

    For most of us, the battle of tabs vs spaces is totally vain.
    For some of us, it can change their everyday experience.

    • Pandiyan Murugan
      Pandiyan MuruganFeb 21, 2020

      I love tabs

    • Yufan Lou
      Yufan LouFeb 25, 2020

      Thank you so much for bringing this reason to my attention.

      I will use tabs for all my indentation going forward.

  • Avalander
    AvalanderFeb 21, 2020

    I don't think there's any technical aspect to consider. It boils down to preference mostly. Sure, arguments can be done for both sides, like tabs being awesome because everyone can configure the desired tab length in their code editor, or horrible because they show as eight spaces in GitHub pull-requests. But I have never heard an argument for either side that had any real technical implications.

  • Jon Ashdown
    Jon AshdownFeb 21, 2020

    The issue arose from a number of factors, but primarily boils down to the visual differences which occur in badly configured IDEs

    I personally use the tab key to indent, but configure my IDE based on the linting rules of the project I am working on.

    docs.google.com/presentation/d/1Kk...

  • Leigh Barnes
    Leigh BarnesFeb 21, 2020

    It really dosnt matter, as long as a code base is maintained and standardized.
    There is literally nothing worse than seeing a Tabs Vs Spaces comment on a PR, I would hate to know how much time effort and frustration and company times has been lost to this argument.

  • Astrit
    AstritFeb 21, 2020

    Tabs.

  • Şaban Ulutaş
    Şaban UlutaşFeb 21, 2020

    a never ending discussion, hahah :)

  • Abdisalan
    AbdisalanFeb 21, 2020

    IDEs showing tabs how I like is a good thing! If the code base has 2 space indentation, why should I be forced to view my code that way if my IDE can just display it with 4 spaces and commit to GitHub with 2 spaces?

  • Abdisalan
    AbdisalanFeb 21, 2020

    Sorry for the confusion, when I say 4 spaces vs 2 spaces, I mean the tab character \t displays as that number of spaces.

    There is no conversion, the linter keeps everything as tabs so there's to worry of mixing tabs and spaces and everyone can display their indentation how they like.

    I think this entire debate isn't really worth discussing given the current state of linting/developer tooling.

  • Alvaro Montoro
    Alvaro MontoroFeb 21, 2020

    3 reactions and 21 comments... You knew what you were getting into 😋

  • Pandiyan Murugan
    Pandiyan MuruganFeb 21, 2020

    I prefer tabs

    And 2*2 config

    Means size of tab

  • Pandiyan Murugan
    Pandiyan MuruganFeb 21, 2020

    Cool

  • Pandiyan Murugan
    Pandiyan MuruganFeb 21, 2020

    The end!

Add comment