Tabs or 4 Spaces?

| Comments

Few days ago I saw a talk of Douglas Crockford (Yes, the JSLint creator) in BrazilJS conference about the way we understand the things and about confuse code structures (for humans and machines).

He talked about the unproductive or even inconclusive discussions that some developers has about better ways of doing code.

I had some of these discussions over the life about tabs and 4 spaces.

So I asked him:

“Tabs or four spaces? And why?”


Douglas said:

“Spaces, because everyone is discussing about the size of one tab, but no one came to a conclusion. You can choose 2 or 4 spaces.”

Douglas Crockford

About the 2 or 4 spaces, I believe it is something related to the code readability, and I would recommended to use your favorite language pattern. Generally I see the recommentation of four spaces, except for some languages like Ruby, that is two spaces.

Now I can rest in peace.