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


pg_parquet - Postgres To Parquet Interoperability
28/11/2024

pg_parquet is a new extension by Crunchy Data that allows a PostgreSQL instance to work with Parquet files. With pg_duckdb, pg_analytics and pg_mooncake all of which can access Parquet files, is  [ ... ]



.NET Community Toolkit Adds Partial Properties Support For MVVM
19/12/2024

Microsoft has announced version 8.4 of the .NET Community Toolkit, a collection of helpers and APIs that work for all .NET developers. The new version adds support for partial properties for the MVVM  [ ... ]


More News

espbook

 

Comments




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

Last Updated ( Thursday, 08 March 2018 )