Inside Silicon Valley's Spaces And Tabs Debate

With a special appearance from Mark Zuckerberg

Behind the scenes Silicon Valley's showrunners deeply investigate programmer's annoyances.
Behind the scenes,Silicon Valley's showrunners deeply investigate programmer's annoyances.HBO

Silicon Valley's Richard Hendricks is all about efficiency. We see it when he sells Pied Piper's office supplies and computers to hopefully hire more programmers, when he moves the company back into cramped quarters to focus on his compression platform, and we especially see it in his code.

This week's episode of Silicon Valley revolved around a very real debate that programmers have: whether to use spaces or tabs when aligning code. The code that makes programs we all use depends on complex groupings of text nested inside each other. To make it easier for humans to understand, coders separate these groupings by indenting them with either tabs or spaces.

Some coders, like Richard (Thomas Middleditch), prefer tabs because they’re more efficient. One tab can represent four spaces, which theoretically makes code more streamlined and a bit cleaner. Others prefer the more specific alignment that spaces provide.

Image illustrates the difference between spaces and tabs from the programmer's perspective.
This except from Coding Horror illustrates the difference between spaces and tabs from the programmer's perspective.Coding Horror

“For most developers, there is a right answer,” says Chris DiBona, director of open source at Google and consultant on the show. “Richard is all about conserving space and time. [That’s the] whole point of compression.”

"The bottom line is that spaces give you more control on how you can indent and ensure it remains consistent across machines," says Jonathan Dotan, an associate producer who also serves as Silicon Valley's technical consultant emeritus. "Also, using one keystroke of a tab, in theory, saves bits — an all important distinction for an engineer like Richard."

At the beginning of this week’s episode Pied Piper hires a few new employees to help build their compression platform, but as they begin to work on scaling up the platform, Gilfoyle (Martin Starr) explains that Richard is adamant about using tabs in code instead of spaces.

We are also introduced to Winnie, who works at Facebook and begins to date Richard: it is a brief romance, though, since she insists on using spaces rather than tabs— a difference that eventually drives them apart.

This contention is real in the actual Silicon Valley. When Dan Lyons, one of the show's writers, was compiling some notes to contribute to the episode, he called some programmer friends to poll them on the issue. The friends were at drinks and reported back to Lyons, "It is split 50/50, and someone is ready to break a bottle and stab someone.”'

Ed McManus, a technical consultant for this season, and Dotan even tried to chase down some of Mark Zuckerberg’s earlier code to see which he preferred. According to Dotan, whose supporting evidence came anecdotally, Zuck used tabs.

This commitment to the idiosyncrasies of software engineers is what makes Silicon Valley seem so true to real life. The real Silicon Valley bench that advises on technical issues for the show runs deep, and includes software engineers from Facebook, Google, Amazon, and Dropbox.

The idea to include the tabs and space debate came out during a dinner at Steins Beer Garden, which is located in Mountain View, as season two was being written. DiBona had invited 10 programmers from different kinds of startups and companies to chat about the varying idiosyncrasies that constitute as obsessions for both programmers and their ilk. Show creator Mike Judge and executive producer Alec Berg thought this meet-up would fill a “grab bag” of lamentations.

"It is the ridiculousness of breaking up with a girl because she picks a different thing to Richard, one that he sees is very wrong," says DiBona.

And the debate between tabs and spaces is more a stand-in for the inside baseball that showrunners and consultants can’t bring up without losing the audience. Everyone who’s used a computer knows the difference between a space and a tab, but they probably don’t know when it’s correct to use Python or the details of the war between text editors Vim and Emacs. (DiBona prefers Vim.)

“When people give us patches [at Google], and come to work for us, we give them a style guide and say ‘This is what you have to use to work for us,’” DiBona says. “Tabs vs spaces is stand in for all these issues.”