Spaces or tabs: which will YOU choose?

Source: 1985 McCall's Magazine

What follows is a Very Important Blog Post. Please, take this seriously.

It’s a question that every tech team inevitably debates and, as with many topics in software development, people can be downright religious about their stance on spaces versus tabs.

I’m here to (officially >_<) declare such debates a waste of time.

Be flexible enough to use either, depending on the project.

What’s more important than an individual's preference for spaces or tabs is that the team agree on a style of writing code and stick with it.

In our case, since we do quite a bit of work with WordPress and WordPress’ best practices indicate the use of hard tabs, we decided to use them for our WordPress work.

For any code that we write outside the context of a specific framework/project (e.g., WordPress), we use four spaces. This includes HTML, JS, CSS, Python and, occasionally, PHP without WordPress.

Soon, you'll be able to see the details of our coding style guide. I'll update this post once that's available.

If you’re interested, my personal preference is spaces.

Here’s why: hard tab length is treated differently by different text editors and may be adjusted to suit an individual’s preference. This can mean varying degrees of readability for the same piece of code on different machines. It can also wreak havoc on code written in languages like Python or Coffeescript, where whitespace is, in fact, significant.

For more information on why you should never ever use hard tabs (except sometimes), check out:

For a less one-sided look, check out Tabs versus Spaces: An Eternal Holy War.

This concludes my Very Important Blog Post.

Editor's Note: ...but don't even get us started about using two spaces after a period.