New technologies

As a developer, our job is to write code that will help solve the problems our clients present us with. We usually do this using the tools we know, but from time to time we have to reach out to new technologies. We tend to forget about clean code because we're out of our comfort zone and just want to get things done. This mindset will drive your project down the hill at lightning speed.

I'm sure we've all heard someone say "this code is terrible, who wrote this?" or "what does this bit do?" . These frustrations manifest themselves in you or your co-workers because you feel your job is made harder than it has to be by someone else's doing. Try to keep this well-known mantra in mind: Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.

We all want to meet our deadlines and produce as much useful features as possible, but solving problems with dirty code will eventually bite you at a later point in time, where changes have to be made or bugs have to be fixed. You'll either be stuck with "Damn, why did I write this?", "What the hell was I thinking?" or with a very angry co-worker who has to work with your legacy.

Best vs Fastest

One of the reasons clean code is so important is that it is essential in generating as little technical debt as possible. The moment you're presented with a problem you have to solve, it's your duty to do this in the best possible way.

Firstly, I would like to highlight the emphasis on the word best, because for some weird reason a lot of people confuse this with fastest.

Whenever a client wants something, the deadline is usually yesterday. This is another reason why we tend to forget about clean code. If you copy 4 lines and change some variable names, your problem is solved and everyone will be amazed by how fast you did it. But have you really thought about what you just did? Did you actually read the code? Did you understand why the decisions expressed by that piece of code were made, by you or a colleague? Sometimes the scope changes because of a new request, so why not rewrite the code to fit the new needs a bit better?

Here's a real life example. This developer had to add an extra language to a weird old array structure. On the one hand, this could be done with 4 lines of copy pasta and everything would have worked out. On the other hand, the whole function could be rewritten saving about 237 lines, making the code a lot cleaner and easier to read. By adding comments (keep these brief and relevant!) you can pass on extra information to other people who need to understand the code later on.