The Art of Coding

OK, so it’s probably going to be a sunny weekend, most people will be outdoors enjoying what little good weather we have in the UK, and I’ll be indoors… That sounds quite glum, but it’s not and in fact it’s a typical trait of a coder.

Many people will have heard the stories of developers working late at night or early into the morning writing what in their mind seems like a work of art, but as with all art beauty is in the eye of the beholder… The main reason is that it can help induce a different state of mind, and quite often you will find that when you do eventually sleep that you wake up having solved a problem!

Quite often you will also see developers with earphones in furiously typing away, and hopefully turning out some quality code. So what music do most developers listen to? Well it can be all sorts of music, but one of the best types is something that has a strong beat to it, which is usually either Rock music or Trance music.

There is an effect that was discovered in 1839 by Heinrich Wilhelm Dove, called Binaural Beats, which indicated that sounds played at a certain frequency repeatedly can help to induce relaxation, meditation, and creativity, which is just what you need when writing code.

When I first started working, the director of the company I worked for once said (in-between writing on a board with both hands!) a great developer is born and not taught. Like Artists or Athletes this is also true, you either have the right physical / mental make up to do something or you don’t.

However, you still need techniques and tools to keep you fresh and inspired and to get you into the right frame of mind to achieve greatness and with enough practice and perseverance you can achieve anything.

A few years later when I got caught up in the dotcom bubble there was a lot of hype around a book called “The Art of War” – by Sun Tzu written around 512 BC. So I decided to read a few chapters… Strangely a lot of the principles can be applied to coding:

“The supreme art of war is to subdue the enemy without fighting” – this can be applied to writing software, as:
“The supreme art of code is to meet a customer’s needs with the least amount of code”

“One may know how to conquer without being able to do it” – “One may know how to code without knowing the application”

“Even the finest sword plunged into salt water will eventually rust” –
“Even the finest code plunged into the hands of QA will eventually weaken”

“One mark of a great soldier is that he fights on his own terms or fights not at all” –
“One mark of a great developer is that he codes under his own desire or not at all”

So what is the art to coding?

The art to good coding, is good problem solving, mental makeup and in some cases the ability to picture the problem and solve it quickly. Being able to walk in a customer’s shoes is essential to understanding what the application you are writing needs to do.

Good coding is accepting that you may not be able to address every single permutation or eventuality first time but in doing so you focus on what really matters and stick to the principles of elegant simplicity. With the right amount of testing and enough input for your QA Team members you will produce some real quality code that everyone can be proud of.

The final thing that makes a great coder is that they embrace change (in IT it happens every day…), and realise that to keep up with change they must change / reinvent themselves daily.