I find programming very similar to mathematics as far as the thought process is concerned. Programming involves solving problems by thinking abstractly about quantity, relationship and behaviour. As a programmer I have to either come up with a new algorithm or customise an existing one for the current problem and optimise it. The formal methods of thinking that mathematics demands — careful reasoning, searching for counter-examples, spotting connections between concepts are some of the essential things needed in programming as well. It's more often than not, about translating mathematical statements into programming language statements. These are some of my major motivation to take up programming.
My journey of programming began while I was in school, when a 'hello world' program would baffle me. The fact that I got a machine to do a task was fascinating to me. The ease of realisation and implementation of any algorithm or technical specification is what makes it joyous. Over the years, I have been introduced to many languages and frameworks, exposing me to different programming paradigms. Initially, I would find learning the syntactic structure of different languages somewhat off-putting, when first introduced to them. But, over the years I have realised that knowing the general APIs provided by languages would suffice and reduce much of the stress associated with learning new languages. Of course, knowing the primitive expressions and means of combining and manipulating them are important too. Also, what I think is imperative for one to be a good programmer is that one be a good designer, communicator, and thinker. There are many good practices available, I think we should let a programmer evolve organically and figure the do's and don'ts when he/she encounters problems. I have also seen that often ancient philosophies can be applied to programming.
Designing a new programming feature is fun and sometimes an intellectually challenging activity. Before one starts to code, one needs to build a picture in the mind of what the code does and how they should interact, giving you an intuitive understanding of what must be done. Although some programmers suggest using design patterns during this phase, I haven’t really found the need. On the other hand, I have spotted designs in my program in hindsight. Knowing the design pattern could help in refactoring and specifying abstractions, above what basic OOPs teaches us.
Another programming exercise that I find fun is reviewing others' code and critiquing them. Spotting a bug or sensing smells in them gives me a sense that I have figured a more elegant way to implement the same. Many a time this happens with my own code, when I see it after a long gap.
Refactoring as a task is very pleasurable, be it converting loops to recursions or deciding what logic belongs where. I feel good whenever I see that I have made the code look beautiful, cleaner and modifiable and it’s my motivation for refactoring. Although I have learned the hard way that refactoring is risky and could introduce bugs (especially when the code is not well covered with unit tests), the joy of this exercise keeps me going.
Some of the other programming points that I relish doing are -
- Meta-programming - As it's very powerful and I get to manipulate other parts of the code.
- Automating things that bug me (which I routinely do).
- Unit tests - To prove that you are dealing with all the scenarios and that you are developing only what is needed.
Since the past year, I have been contributing to an open source project. The challenges faced there are unconventional, since any code submitted for merge is up there, for review by the whole community. And hence, I have to convince the community about that patch, and for which, in turn I have to be convinced. With a lot of help available out there from people in the community who have accumulated experience in the domain, my learning curve both in terms of technology and domain has become steep. Although sometimes it gets frustrating to get a patch merged, the questions/concerns posed by the community contributing to the project throughout the world has added lot of value and has kept me motivated to continue contributing to it.
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.