What I Think About While Programming

I’ve been a developer for three and a half years, and am now to the point that I mentor the more junior developers at my company. I took some time recently to help one of my colleagues plan out a project, and our conversation turned to a particular habit of thought that I felt the need to address in this post.

As anyone who has written a program will know, the process involves a virtual forest of decision trees. Beginners make a lot of these decisions unconsciously or not at all, to the detriment of their programs. I believe this comes from neglecting the one most important decision that is faced when programming: deciding what to think about.

My colleague related a story to me of how he was brought into a project to add a feature, proceeded to work on the feature, and as he was pursuing his solution discovered a dependency issue that brought his work to a standstill. The concept of his solution led him to rely on the dependency, and now that the dependency was known not to be reliable he began to troubleshoot his new, dependency-specific problem. He had been taken out of the way of his work to perform work that, in the middle of his propulsion, he was not aware that he should eject himself from. He had in short made the classic error of not being able to see the forest for the trees, or even the trees for the branches, and wanted advice on how to avoid this situation in the future.

I told him that the solution here is to adopt a habit of vigilance, to remember always that the code we see on the screen represents a past thought, a record of previous motives and priorities. It is the mark of our growth as developers that we do not let this code decide what it is we think about, rather that we take it as the starting point for our own applications.

I try to keep this in mind any time I program, and though not always successful, I feel the attempt makes for better work. Hopefully the thought may do the same for you.