When I started this blog, I was skeptical if I can be an author. But what appeared more important to me is spreading knowledge, my thoughts So I continued blogging. After writing few articles what I realize is that writing a blog is not much different from my favorite profession (writing code).
Few similarities between coding and authoring.
- Both require deep knowledge of the subject (Domain)
- Both require good use of vocabulary
- Both require good organizing and formatting
- Both require analytic and logical skills
- Focus on the reader
If someone is a good writer, he/she can be a good programmer as well. I want to simply put it like this…
Programmer = Author + Technical Knowledge
Most of us(developers/testers) are focused on attaining higher levels in Technology and unfortunately less in Authoring skills. This is because we think that there is a magical box (called compiler) which will convert our code to machine language and after that, there is no use of our code. This is not true!. When we write code, we are already an author, we are already creating an article/document/story. And apart from the compiler, there are other readers for your code(Other developers and testers !). And when they read, they expect to read it like an article. I know this is not a new concept, people like Robert C Martin, Martin Fowler have spoken/wrote about this long time back. I am just re-emphasizing it from a different perspective.
Let us consider how a small snippet from the novel “A Stone for Danny Fisher” by Harold Robbins.
If you observe the paragraphs, each one has a unique purpose. Beautiful short paragraphs doing only one thing at a time (Single Responsibility). This makes it easy for the reader to understand the subject.
Learning: Single Responsibility
Also, observe that the order of paragraphs tells a story. The first paragraph sets the stage for the court, the second one describes the start of the court etc.
Learning: Order the methods in the order, they are being called. Tell the story of your code.
There are lots of quotations in the above snippet. They represent the words of the character. This helps the fast skimmer to skip the unnecessary things and just read the important words.
Learning: Characterize your code, give personality to your classes.
Observe that almost all the sentences are in active voice. They represent the voice of a person. It’s more assertive and stronger.
Learning: Method names should be assertive.
There are lots of similarities between good code and a good novel. We just need to read between the lines to understand them! Besides, each author is different and have their own style of writing and so will be the choices made by developers. These styles will have long-term implications on the success of the project.