• Jarix@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    7 months ago

    Hey, im not a coder, can someone ELI5 the 2 camps on this one for me and other lurkers?

    Edit: Thank you kindly, much appreciated! Now i have a better understanding of something I’ve come across in discussion ice witnessed but not been a part of.

    And thanks Lemmy, for the opportunity to have come across this in the first place so that i was able to learn, or at least gain a wee bit of insight into this

    • Phen
      link
      fedilink
      English
      arrow-up
      14
      arrow-down
      2
      ·
      7 months ago

      Programmers use a margin on the beginning of a code line to easily identify that that line is related to a previous line (for example, one line may establish a condition and the next line an action to be executed on that condition, the line with the action will have this margin in this case).

      There are basically two ways to create this margin: by adding a tab character or by adding spaces. The tab character is a special character that exists specifically for things like this and most tools allow you to configure the size of the margin it adds. Spaces on the other hand have a fixed size so if you add two spaces the margin will always be of two spaces.

      Programmers have forever argued about their preferences on this and it often results in very heated arguments.

      Tabs are generally considered the best choice but many people disagree, usually because of one of those three things:

      1. they think that people who use tabs want to replace all usages of spaces with tabs and not just this specific use case. Then demonstrate how tabs can be unpractical on other situations (that don’t really have anything to do with the original argument).

      2. they use (or need to use) some shitty tool that do not recognize tabs properly, or that force an unpractical tab size on them (not as common these days as it used to be, but still happens).

      3. they actually want everyone to always display those margins with the same size regardless of each individual’s personal preferences.

    • frazorth@feddit.uk
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      2
      ·
      7 months ago

      It’s, as Linus mentions, all about bad tooling.

      I don’t think that anyone disagrees that tabs are “technically” the better choice, as they are a representation of indentation rather than a visual absolute. They aren’t visible and your UI should render them as one, two, four spaces or however you would prefer it to appear.

      However there were a lot of editors that were shit. They displayed them as four spaces, which IMHO is quite frankly awful to read, and they provide no way to customise it.

      As such the world split into two. Those who valued being able to set their indentation to what they preferred, and those that didn’t have a tool that displayed the text in a pleasant way.

      So we end up with edicts from Python that say “Thou shalt not use tabs”, and ones from Linus saying “Thou shalt not not shitty tooling”.