Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Microsoft IT Technology

Microsoft Veteran Ditches Team Tabs, Blaming Storage Trauma of Yesteryear (theregister.com) 60

Veteran Microsoft engineer Larry Osterman is the latest to throw his hat into the "tabs versus spaces" ring. From a report: The debate has vexed engineers for decades -- is it best to indent code with tabs or spaces? Osterman, a four-decade veteran of Microsoft, was Team Tabs when storage was tight, but has since become Team Spaces with the advent of terabytes of relatively inexpensive storage. "Here's the thing," he said. "When you've got 512 kilobytes, and you're writing a program in Pascal with lots of indentation, if you're taking eight bytes for every one of those indentations, for eight spaces, you could save seven bytes in your program by using a tab character."

It all added up, even when floppy disks were part of the equation.

However, according to Osterman, things have changed. Storage is less of an issue, so why not use spaces? A cynic might wonder if that sort of attitude has led to the bloatware of today, where software requires ever-increasing amounts of storage in return for precious little extra functionality and a never-ending stream of patches. Any decent compiler should strip out any extraneous characters, assuming the code is indeed being compiled beforehand and not interpreted at run-time. For his part, Osterman is now a member of team spaces. "I like spaces simply because it always works and it's always consistent," he said.

Microsoft Veteran Ditches Team Tabs, Blaming Storage Trauma of Yesteryear

Comments Filter:
  • by Thud457 ( 234763 ) on Tuesday October 08, 2024 @03:27PM (#64849343) Homepage Journal
    POPCORN!
    Get your POPCORN here!

    really, a spaces vs tabs flamewar in 2024?!
    • by Seven Spirals ( 4924941 ) on Tuesday October 08, 2024 @03:49PM (#64849415)
      Had a co-worker who intentionally mixed tabs and spaces to cause Scanners-like head explosions in the other team members. He even had an Astyle config that did it for him. They got so pissed at him. Having my tab-stops setup properly I wasn't bothered at all and thought it was hilarious.
      • by Megane ( 129182 )

        >add -Wall -Werror -Wextra to gcc configs

        warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]

        There's some code from the next group over that has a bunch of random one- or two-line groups of lines that got changed to tabs when someone's editor hadn't been configured to preserve tabs vs spaces. But my group sets the main build configuration. There's a warn override in their top level makefiles to spare them from the -Werror, but there is also a jira for them to get rid o

        • Anyhow, if I had to rate the most annoying gcc super-warning, it's the one where it counts bytes in printf() to ensure that your buffer is big enough. Simply using snprintf() isn't enough to make it happy.

          Oh yeah, this is super annoying. I hate it, too. Happens with other "n" calls, too. Real "helpful".

      • by unrtst ( 777550 )

        FYI, vim ":retab" is excellent.

        vim <somefile>
        1Go# ex: set tabstop=4 expandtab smarttab softtabstop=4 shiftwidth=4:
        # -*- Mode: tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- #CTRL+[:retab

        For a traditional Makefile (requires leading tabs), use something like the following header instead:
        # ex: set tabstop=4 noexpandtab smarttab softtabstop=4 shiftwidth=4:
        # -*- Mode: tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- #

        RE: the coworker... Have that argument on your own project; Enforce a st

        • if they can't handle that, then how likely are they to handle any other best practices?

          Well, that's one way to look at it. This guy was a total wizard. Nobody was going to argue with him and win, because he worked circles around us. He suggested things like Vim filtering or Astyle configs but it caused the authoritarian/autistic coders to lose their minds. Since he was writing 5 lines of master-level code to every 1-line the rest of us wrote, we had the option to live with it and laugh or shut the actual fuck up. People who complained too much there got fired, and I loved that because this in

    • POPCORN! Get your POPCORN here!

      Fuuuck yes. I’ll take two bags please.

      really, a spaces vs tabs flamewar in 2024?!

      Uh, HOW long did Meal Team Six sit in the trenches keeping the Vi vs. Emacs middle-earth conflict going?! Peanuts in comparison. Damn, now I want peanuts with my popcorn..

    • From the headline I thought it was going to be about some kind of feature of Microsoft Teams.

      Regardless of tabs vs spaces, it's 2024. If you're not using a code auto-formatter before checkin and viewing you're doing it wrong anyway. Basically embrace that there is no "best" formatting; there are too many competing tradeoffs.

      There's no reason we need to be a slave to formatting. Formatting should serve us, not the other way around.

  • by awwshit ( 6214476 ) on Tuesday October 08, 2024 @03:30PM (#64849355)

    I've always been a Spaces person myself, because always works, always consistent.

    • I've always been a Spaces person myself, because always works, always consistent.

      Me too. I have been a SPACE cadet for many years now. /s

      • On a personal note, My sixth grade teacher told me that I was not a Space Cadet but in fact I am the Space Commander.

      • True Space Cadets use a Space Cadet keyboard: Space Cadet [wikipedia.org]
        • Terminals, when function keys did something.

          I love the bottom row from the left:
          Hyper, Super, Meta, Ctrl

          • And they all did something! That's an older keyboard, but I worked briefly on some Symbolics machines. That one had symbols, circle, triangle, etc, and I never really figured out a consistent use for them. But absolutely, hyper, super, meta, ctrl all have distinct uses. To be honest, the Emacs method of ctrl+meta is easier to do than hunting for the specific key shortcut.

            Symbolics and other lisp machines were pretty awesome, and modern operating system GUIs haven't really caught up. Ie, your command line

    • by AmiMoJo ( 196126 )

      Always tabs. Spaces just force you to use whatever number of spaces someone else likes, like this guy and his massive 8 space indents.

      Spaces also mean a lot more typing to move the cursor to the right place. It's slower and more work.

      It was never about storage space.

      • Naw, hit the tab key and let the editor stick in the spaces. The spaces/tabs debate is mostly for people using raw editors, like notepad or vi (not vim). Every decent editor or IDE should do this for you, let you customize it, and let you choose tabs versus spaces.

    • I began with tabs for ease, but as I developed my own particular layout of writing code, the consistency of spaces was needed.
      I have nano set up to convert tabs to spaces (4), that way I can quickly indent and if free space on a line is wrong, I can always escape-backspace it away at once and then use tab again.

    • I am a spaces guy, but I am intrigued but a tabs+spaces idea. That is, tabs for indent, and spaces for aligning. Then the level of indent can change based upon the tabs setting, but the alignment remains aligned. You need an editor that supports it (or do it manually but ugh), which is nice in Emacs as it has that and is programmable.

      Ie, indent is to get the block of code to the right level, but alignment is used when you break up long lines, so that if you break up an 'if' statement that the line break

  • by Anonymous Coward

    Clearly this guy wasn't programming in the 1990s. In the old IDEs, if you used spaces, you would have to hold down the arrow key or press the arrow key four times to move the cursor to the beginning of the next indented row. With tabs it would move four or eight columns per key press. Newer IDEs basically emulate tab behavior even when spaces are stored in the file.

    Though honestly, the fact that this dingus thought it was about storage consumed by the source code files is on brand for MSFT engineers being

  • Eight?!? (Score:5, Insightful)

    by slipped_bit ( 2842229 ) on Tuesday October 08, 2024 @03:34PM (#64849373) Homepage

    eight bytes for every one of those indentations

    Eight spaces? There's yer problem.

    • I worked on C programs (not my own) in the early 1990s that had 8 character indents. I had a lot better vision back then, and it was a good thing, because to work on that code meant 120 columns on a standard 14 inch CRT.

      • Early Unix code was all 8 character tabs. But the code also did not have a lot of deeply nested code blocks either so that it was still easy to read on a standard 80x24 terminal.

  • The real question is - "How big is your tabstop?". Martial law is not too much for those that transgress "set ts=8"
    • set ts=2 I like nested loops. A lot of nested loops.
      • The real comments are encoded with Steganography .
        Do you even job security, bro?
      • by ukoda ( 537183 )
        Set "ts=2", correct. "A lot of nested loops." then don't forget to turn off the watchdog if you are writing interrupt handlers...
      • by KlomDark ( 6370 )
        This! No reason to waste screen space. And anyone else can set ts= to whatever they want. Never understood spaces except for narcissists that think nobody else will work on their code.
    • by ukoda ( 537183 )
      And that is the heart of the Tabs vs Spaces war. IMHO Spaces wins pure and simple because the is no standard for tabstop making the consistent rendering of tabs impossible. The number times I have open file X on platform Y with editor Z and found the formatting looks like shit over the last 40 years has lead me to the conclusion Tabs are evil disguised as convenience. Step 1, set you editor to only use spaces. Step 2, use pretty print type utility to exercise the evil tabs from your source code.

      Don't
      • by unrtst ( 777550 )

        Vim is on all platforms, and you can set a clear mode line at the top to define exactly what that file conforms to (at least for tabstop, shiftwidth, tabs/spaces, and it automatically does the CR/LF stuff well too). Might as well revive the war of Vim versus... who was that also-ran?

  • Are there any editors (beside VIM) that could consistently format code with Tabs?

    A lot of people tried to copy me and use tabs, only to largely fail because their code editors/IDEs couldn't do it. Thus one ends up with a horrid mess of code that "melts" the moment tab size/indent is set wrong.

    Being myself a veteran of formatting with Tabs, my suggestion to all: don't; simply enable automatic conversion of tabs to spaces in your editors, and forget that the tabs exist. (And as a VIM user, I can deal with i

    • Idiot dev at work: Let IDE convert tabs to spaces, do change, check code back into git/whatever.
      Next dev: "Why is git diff showing every line fucking line has changed!!?"

      • by Megane ( 129182 )
        It's much more subtle and insidious when only a few lines get subverted each time. Then a new version of gcc comes along that whines about the inconsistency, and suddenly you have to touch half your code base because of all the little tab land mines.
      • by flink ( 18449 )

        Why would you accept a PR that has fouled up all your formatting? You need a format checker in your CI pipeline.

    • by ukoda ( 537183 )
      I have been coding over 40 years and over that time my preferred indentation has gone from 8 to 4 to 2. I guess in another decade I will go for an indentation of 1, which would render the tabs vs spaces argument mute.

      Agree with converting the tabs to spaces and then forget about it. I will usually just stick with whatever indentation was already in use but I guess more pedantic people will then reformat to match their personal idea of what the correct indentation is.

      As for an indention of 3, I agree
  • You know why? Because I only have to press one key and it jumps to the appropriate column. One space isn't enough of a visual distinction.

    You don't have to worry about proportional fonts causing alignment issues because the tabs are at the start of the line.

    • Plus any decent editor can set the tab stop to whatever size they want rather then being stuck with the indentation of the original author.

    • by unrtst ( 777550 )

      </sarcasm> missing?

      You know why? Because I only have to press one key and it jumps to the appropriate column.

      Same when using spaces with any decent editor (no true vim^H^H^Hscottsman).

      You don't have to worry about proportional fonts causing alignment issues because the tabs are at the start of the line.

      How is that different from spaces at the beginning of a line? Proportional or fixed font, spaces or tabs at the front, no alignment issues until someone mixes tabs and spaces.

  • Tabs used to be eight 10-point spaces, for just over one inch. That made using more than a small number of levels of indentation difficult: you went off the side of a 24 x 80-character screen quite quickly. That in turn helped C programmers avoid writing looooong FORTRAN-like functions.

    Alas, we've forgotten that, and all sorts of modern folks are writing yards-long functions... and then losing track of what they were doing (:-))

  • by YetAnotherDrew ( 664604 ) on Tuesday October 08, 2024 @03:56PM (#64849435)

    We all have IDEs and editors now that can convert text to whatever you want.

    There are already version control hooks to auto-convert line endings.

    Why not just make the tooling automatically handle this and then we can all stop hearing about it?

    On a side note, LarryO is still at Microsoft? So it's 29 years there now? [microsoft.com]

    • typo correction: 39 years
    • by taustin ( 171655 )

      Why not just make the tooling automatically handle this and then we can all stop hearing about it?

      Maybe it's not about tabs vs spaces so much as it's about outrage monkeys addicted to to their rage.

      • Maybe it's not about tabs vs spaces so much as it's about outrage monkeys addicted to to their rage.

        I like monkeys. Can't they be quieter? I'm only suggesting a monkey silencer.

        • by taustin ( 171655 )

          But these are outrage monkeys. It's not about monkeys, it's about outrage! It's about throwing their poo at the tourists (and being too brainless to understand it won't get past the glass window, and in the end, they're still on the side with the stink).

    • by unrtst ( 777550 )

      There are already version control hooks to auto-convert line endings.

      One of the best anti-tab arguments I've heard came out of left field - never embed any special characters in your code. IE: if you need to print a tab, don't use a literal tab in a string; use the proper escape (ex. "\t"). Same for any UTF8 symbols and accents and such - those can cause all kinds of oddities. Same goes if you want to put a newline in a string. You don't write:

      some_thing = "check
      one
      two
      ";

      ... instead, write:

      some_thing = "check\none\ntwo\n";

      This is more apparent when you have something like:
      tes

  • Interesting... (Score:4, Informative)

    by Oddroot ( 4245189 ) on Tuesday October 08, 2024 @04:03PM (#64849465)

    Appears to miss the point entirely, in that tabs can be configured by the user to generate the level of indentation desired, whereas spaces lock in the indentation.

    My dad likes to use 2-space tabs, I like 4, and I also know at least one person who keeps it at 8. Same source file looks like each of us prefer.

    Where this breaks down are languages like Python where the indentation is actually part of the syntax, but you can't route around all brain damage.

  • it is a function of IDE - display spaces and tabs as expected by user's rules - end of story.
  • Tabs can be any width visually. A tab is one byte. You can't make two spaces less than two bytes.
    Spaces are trash, tabs are superior.

  • by UnknowingFool ( 672806 ) on Tuesday October 08, 2024 @04:38PM (#64849591)
    At first I read the headline as "Microsoft Veteran ditches Teams". Finally someone at MS acknowledges how bad Teams is . . . Yet MS has disappointed me again
  • I have no idea what team I'm on, because my editor indents my code for me.

    Well, OK, I pulled up some of my code to check. I'm apparently Team Inconsistent. But my editor does have tabs set to 8 as was intended In The Beginning.

  • Setup a commit hook to remove all indentations before committing. Setup hooks to autoformat before doing diff and merge. Let everybody pick their favourite formatted.

Everybody likes a kidder, but nobody lends him money. -- Arthur Miller

Working...