Clean Code: You are not other developers

In User Experience (UX) there's a saying "You are not your users". It's a phrase that could be applied to anything involving design, but when it comes to the actual implementation and process of writing code the mantra could be adapted to "You are not other developers".

Developers are often stereotypically portrayed as solitary "ninjas", wired on caffeine, fueled by pizza and working late into the night (relevant XKCD). However, most developers rarely work alone and many take part in social "Hackathons".

We write code to solve problems. Sometimes there's a tendency to think that as long as the code works, it doesn't really matter if it's a bit messy or difficult to understand, the user won't see the code anyway. On the other side of the coin, while it is important to be proud of your work, most of us work on some form of web-based application and unless you write mission-critical code there's probably little need to write highly optimised, terse, code golf (or if there is a very good reason, it should be well documented).

When you write code, think about of other developers simply as another user of the system, they just interact with it in different ways: maintaining the code, fixing bugs, and extending it with new features.

Just as we emphasise the importance of considering the first-time experience of new users in an app, think about how someone might approach your code having never seen it before. Does that variable or function name reveal your intention, or is it mis-leading? Are your modules small and re-usable, or like long paragraphs of text? Are your functions pure, or more like a button that did something unexpected when clicked? So for the sake of other developers, keep your code clean!

code