Sitting here in China, wondering what to do, I decided to write some code to help with analysis of moves in a wargame. Rather than write it though, I started to wonder why people like to write code.
I find writing computer programs fun. When they work, it’s fantastic. When they won’t, it’s frustrating. I love learning new skills in computing, new languages, environments, toolkits. That’s not to say I like all the ones I come across; there are some which put me off, or which I fail to understand quickly enough to keep my interest. (Ruby on Rails is one such.) I claim that learning to use these new tools keeps my brain sharp. Recently I’ve been writing web-hosted database applications, for fun! I used to think databases were the pits; the boring, commercial end of computing, but now I’ve found a need to use them and find lots of interest, particularly in constructing complicated queries. I never cease to be amazed at how much one can persuade the server to do, rather than have to code into the client application.
This morning though, it wasn’t the challenge which excited me, or even the benefit the new code would bring once it was completed – it was the aesthetics of the code itself. There are two aspects to that, one serious and one more trivial. Since I learnt my original computing skills (in assembly language and BASIC), the power of languages has changed greatly. There’s a good deal of satisfcation in being able to write small chunks of code which do a lot. I find Ruby particularly rewarding in this respect. Secondly, editors with syntax highlighting make code so attractive! Pretty code draws the eye; colours help understanding. I want to code because the result is pretty!