Code vs English


Since a past few days, I have been attending a bootcamp at my workplace. Here we are learning about expressing intent in what we do, be it writing code or commit messages. That’s what I want to compare here. I have been writing code for quite a few years now, that wasn’t the kind I am writing here, but it still worked. Although I have been using English as my secondary language all my life, but still I struggle more while writing commit messages than while writing code.

Most programming languages have a few ways to get something done. While english has a lot of ways to express something that might seem similar but can depend on the context too. Even though while coding we use english a lot, when naming variables, functions etc. but writing these to express intent is way easier because of the grammar involved, since most programming languages have a definite or better way to perform simple actions and for complex actions there are conventions in place that are easy to follow if you are aware of them. So there are very few things left to assume in programming languages. The logic of the code written also helps in understanding what the code wants to express. While in english there are a lot of multiple ways that communicate the same thought and the grammar allows us to change the structure of a sentence in various ways, for example using active and passive voice.

What I found works for me is to use the identifiers in the code to work as a framework for writing the commit message. Add a few prepositions or verb and voilĂ ! you have a commit message that expresses intent.

« Getting started with VIM It's not optimization »