By Chris Oldwood

Overload, 25(142):20, December 2017

Tabs are controversial. Chris Oldwood reminds us of their many guises.

There can’t be many three-letter words that can cause the average programmer to break out into a cold sweat, but the word ‘tab’ must surely feature fairly highly among them. I can imagine the word ‘for’ would cause a functional programming evangelist to give a little shudder given their dislike for explicit iteration, and the abbreviation ‘int’ must surely generate a lengthy sigh from anyone who’s had to write cross-platform code in C or its closest brethren, C++. However, ‘tab’ cuts across paradigms and languages and holds a special place in our psyche.

A rather popular sci-fi TV programme tells us that ‘space’ is the final frontier and, for typists around 1900, that was certainly a major challenge they faced. If you think positioning text with CSS can be arduous at times try laying out a table of data on an old-fashioned typewriter. Repeatedly pressing the space bar and backspace keys to line up the cursor is going test anyone’s patience, and that’s before you factor in the effort each keystroke requires on such a mechanical device. RSI is an initialism so it’s exempt from this particular discourse but the tab key must be congratulated here on its stress reducing measures.

It’s funny to think that something we can’t actually see would cause us programmers so much distress and yet, like a black hole, it has the ability to distort that which surrounds it. How many times have you inserted a space early in a line only for the remainder to spring exponentially further to the right as a gaping chasm opens up from nowhere; it’s like a kerning disaster on a grander scale. They also say beauty is in the eye of the beholder but no one in their right mind would choose to use 8 spaces for indentation, but apparently, historically, that’s what the world once thought was considered Good Taste™.

My first foray into the world of Python left me with a scar I still bear to this very day and which came courtesy of the invisible enemy. After starting my first non-trivial Python program in the (then) new-fangled IDLE Python IDE, I quickly switched to the more comfortable Visual Studio text editor to finish my sysadmin masterpiece. Sadly I wasted the following hour and a half scratching my head and debugging until I discovered the cruel lesson from the school of hard knocks about mixing tabs and spaces in the same Python block. I had forgotten that back then in Washington the space was out of favour, there, the acronym TARDIS probably stood for Tabs Are Redmond’s Default Indentation Style, and so lines of Python code were being skipped or executed in a seemingly arbitrary fashion. Goto Fail, do not pass Go.

Of course tabs are bad for you. Anyone who grew up in north-east England knew that because tabs are a slang word for cigarettes. If you believe the oft-quoted 10 lines of code per developer per day, then, assuming a low degree of nesting you should easily keep your habit under 20-a-day, but the rock-star programmers are probably chain-smoking their way to a very early grave. And that’s before we’ve even considered their late-night coding antics where they might drop a tab or two of some illicit drug to fuel their spree. To them an ACID guarantee is an entirely different prospect.

Unsurprisingly I approached F#, another whitespace-sensitive language, with a little more trepidation. However, learning from the mistakes of their forefathers, the F# designers just banned tabs by default, which seems very sensible. If you really want to shoot yourself in the foot and use tabs you can, but you need a special disclaimer at the top of every file to waive your rights to any form of support on Stack Overflow. It’s not just your life you’re wrecking – friends don’t let friends use tabs, ever.

Just when you think the eternal war between tabs and spaces is beginning to decline as the ever growing list of vets speaks out over the folly of choice and the remaining battles diminish to a few skirmishes on the outer rim of the Internet, a new programming language comes along and tips petrol over the smouldering embers. Google’s Go is a highly opinionated language that’s not afraid to upset anyone’s apple cart, and the de facto choice of using tabs for indentation is just one major example of this. Actually, that’s not entirely true: the language itself is just as tolerant of ugly code as any other – it’s the community that’s decided to embrace a common standard. On matters of style the bundled go fmt tool is judge, jury and re-formatter. Expect your pull requests to become bantha fodder if your whitespace is not whiter than white.

This isn’t the first time a large corporation has tried to sell the tab to a sceptical market. Back in the late 1970s, the Coca-Cola Company brought TaB to the UK in the hope of capturing a slice of the diet soda market. It was rebranded TaB Clear before I was old enough to appraise it, but it didn’t last long – disappearing along with Cadbury’s Fuse. I guess the buying public wants to see something for their money.

It’s not all doom-and-gloom for the humble tab. In the early 2000s, as the Internet was really taking off big-time, the modern developer found themselves in a new kind of hell. The ever-growing Internet started to become the predominant source of developer information and so it was not uncommon to have multiple browser instances open, switching back-and-forth as we pieced together the answers to our puzzle. Although Opera sported an MDI style UI it was not really until the new mainstream contender to the browser throne – Firefox – appeared that the browser tab really took off and reduced the number of task bar icons back to a sustainable cognitive load.

Although heralded as the saviour of the browser, the tab as a UI element was not without its detractors. The tab fad really started to take off in the early 90s as the Office suites began to look for alternatives to MDI and cluttered configuration dialogs. The Interface Hall of Shame has plenty of examples of where the wheels fell off. For the browser, however, the real elephant in the room was a poor security record and a need to isolate each web site into its own process. Suddenly each new tab meant another multi-megabyte process and ever more strain on the humble computer. But it isn’t just browsers; even native apps like Slack with essentially a tab per team are using process-level isolation and hogging resources; it’s not uncommon to find Chrome and Slack duking it out behind the scenes on a developer’s laptop apparently striving for global domination.

So, all tabs are evil, right? Well maybe not, there is one category of tab that actually seems to be useful and pretty much side-effect free – guitar tabs. For those of us whose only musical ability stems from playing Guitar Hero, the guitar tab provides a lifeline for learning to play the classics without having to grok some ancient music notation first. Maybe the tab has a stairway to heaven after all.

Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.