Bill Gates Is A Tabby
Written by Lucy Black   
Thursday, 01 March 2018

Bill Gates prefers tabs to spaces. This admission was made during a Reddit AMA (Ask Me Anything) session, his sixth, held on February 27th. As well as reopening a perennial debate, this answer earned him two months of Reddit Gold, although it also caused others pain and distress. 

The question was minimalist and the answer straightforward:

billgatestabs

The comments on Reddit are, as you might expect, voluminous - and on both sides of the divide that splits the programming world like no other topic. It's a cross-platform, cross-language divide that pits programmer against programmer.

We all agree indents matter, but which key should be pressed?

tabkeyicon

It is interesting that Gate's choice of tabs extends to word documents - in this age of texting, tweeting and social media comments made on the spur of the moment there are probably some who no longer see the need for carefully formatted word documents. 

But in coding indents are important, if not mandatory, and the choice of tabs or spaces is influenced by the programming language used. This emerged in a study we reported in 2016 in which Googler Felipe Hoffa examined 400,000 GitHub repositories which held 1 billion files and 14 terabytes of code. He found spaces to be the preferred method of indenting apart from code written in Go, where it seems tabs are the order of the day, and C. 

tabs

Sadly BASIC, which along with assembler, are what Bill Gates did most of his coding in back in the day, isn't included in the survey but in generational terms C is the closest.

One exchange that caught my attention on the Reddit outpouring related to Python, which went against the very clear trend in Hoffa's results:

tabspython

Oops - Python is one language where indents are mandatory but tabs are discouraged. PEP 8 - the style guide for python code - says quite clearly:

Spaces are the preferred indentation method.

Tabs should be used solely to remain consistent with code that is already indented with tabs.

Python 3 disallows mixing the use of tabs and spaces for indentation.

 

Although Hoffa's finding suggest tabs are a minority choice in practice, when Stack Overflow included the Tabs or Spaces question in its 2017 survey, Tabs emerged as the majority choice among all respondents whereas spaces were marginally more popular than tabs among professional developers. The headline-creating finding of an analysis of this survey data by David Robinson was that developers who use spaces for indentation make substantially more money than those who use tabs.

Robinson claimed:

The median developer who uses spaces had a salary of $59,140, while the median tabs developer had a salary of $43,750. (Note that all the results were converted into US dollars from each respondent’s currency). Developers who responded “Both” were generally indistinguishable from ones who answered “Tabs”.

Presumably Bill Gates didn't participate in the Stack Overfow survey as he might have skewed these findings! 

His answer to the question on the Reddit AMA not only reveals a preference it also reiterates the main reason why tabs should be preferred over spaces. As tabs replace n spaces by a single control code, the actual spacing produced can be altered without having to edit the file and whatever font you use any embedded spacing is preserved. As Bill Gates answer implies using tabs ensures your indents line up.billgates2018sq

More Information

Tabs thread from Bill Gates AMA on Reddit

Related Articles

Tabs Or Spaces - One Billion Files Later An Answer

Tabs versus Spaces? Not Just Contentious But Economic 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


VLOGGER - AI Does Talking Heads
24/03/2024

Developed by Google researchers VLOGGER AI is a system that can create realistic videos of people talking and moving from a single still image and an audio clip as input. 



Pure Virtual C++ 2024 Sessions Announced
19/04/2024

Microsoft has announced the sessions for Pure Virtual C++ 2024, which is taking place on April 30th 15:00 UTC. People who sign up will get access to five sessions happening on the day, alongside a ran [ ... ]


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 08 March 2018 )