Why should I write readable code?

! Warning: this post hasn't been updated in over three years and so may contain out of date information.

Computers are dumb and people are smart. So surely if I write code the dumb compiler/interpreter can understand, smart developers should be able to understand it too?

Well no, that’s simply not true. Why? The reason is simple: computers just do what the code tells them to do. Developers though need to understand why the code does what it does. The compiler has no understanding of what its doing. It just follows a simple set of rules in order to fulfil its task. For a developer to do anything with your code though, they won’t just mindlessly follow what it does, they have to try and understand why it does it.

Some people think clever programmers are those that write hard-to-understand code. They are mistaken though. Any fool can use a simple set of rules to instruct a computer. Clever programmers express their intent through simple, eloquent code that any fool can understand.

So why not be a clever programmer yourself? Learn the art of communication and strive to make your code as easy for other people to understand as possible. A compiler will never thank you for making its task easier, but you can be sure other developers will (or at least they’ll swear about you and call you rude names if you don’t.)