Monday, October 28, 2019

Rite of Coding, Code of Writing

Today is a public holiday and I'm currently sipping coffee at Starbucks, at the Curve in Mutiara Damansara. Feeling a bit sleep as I've been up since 4am. I enjoy my early morning work session. I see it as a kind of practice session. Coding is a skill which gets rusty when you do not practice it often enough. It is also why I keep this blog--it is my weekly writing exercise.

Coding and writing are skills that need to be honed. Coding is 'easier' than writing because you always know exactly where you are heading. The end-goal is clear: you are always trying to deliver some feature or functionality. How well you do it, depends on your skill and creativity.

You can also say that certain forms of writing, say writing a report, requires you to know exactly where you are heading too. You have to convey certain points and messages. But writing, unlike coding is harder because your choice of words is vast and there are a thousand and one ways an idea can be expressed. Sometimes you grope in the dark in search of the perfect word or phrase to express what you have in mind. Often what comes out is not exactly what you had wished to convey. But that is part of the challenge of writing. It is finding a way for thoughts and impressions to material into the physical world as printed or written words.

Coding, on the other hand is constrained by the programming language. Despite that, there is still a lot of room for creativity. The goal of the programmer is to achieve its goal with an economy of means. An elegant piece of program has no superfluous statements. Every line has a purpose. And a good programmer aims to make his code clean and maintainable. One thing I've found out the hard way is that a messy and unorganized piece of code will always come back to haunt you. Architecture is very important and code has to be constantly refactored to make them general and reusable.

Therein lies the key difference between coding and writing: when it comes to coding, the more reuse you can achieve, the better a programmer you are. You do not want to reinvent the wheel every time. If you can make use of components you have built before, that means you have done your job well. Whereas as an original writer, you strictly abhor repetition. Even if you have to write about the same thing again, you will not be looked upon highly if you just cut-and-paste sentences that your readers have read before. Never under-estimate your reader and always try to express something new, even if it revolves around the same subject.

I treat coding and writing are two important ritual that keep my mind constantly sharp. They are to my brain what my jogging sessions are to my body. They are my inviolable codes of conduct. Everyday when I start my morning work session, I feel grateful and blessed that I am able to still perform these activities well. And long may it continue!