26 Jan 2017
How to become a better programmer
In the book Outliers, author Malcolm Gladwell says that it takes roughly 10,000 hours of practice to achieve mastery in a field. Although it takes time, you won’t improve your coding just by writing more code, there are also some quality factors involved.
Kent Bent has observed common patterns in the workflow of master programmers. The essence here is scaling your brain.
The journeyman learns to solve bigger problems by solving more problems at once. The master learns to solve even bigger problems than that by solving fewer problems at once. Part of the wisdom is subdividing so that integrating the separate solutions will be a smaller problem than just solving them together.
While these skills seem adorable to me, I am looking more for a path to obtain them. One’s learning curve is not rising permanently as it also includes plateaus, probably a lot. All you can do is to cut long periods of stagnation. Peter Norvig says
The key is deliberative practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes.
While learning by doing is probably the best kind of learning - which kind of seems a passive activity beside programming - you need to equip your toolbox and sharpen your thinking actively. “To a man with a hammer, everything looks like a nail”, Mark Twain is often quoted. Good solutions depend on your understanding of the problem domain and proper tools to handle them.
Rich Hickey states we are definitely suffering in quality here because we don’t spend enough time and energy thinking about a problem.
Unfortunately, sometimes, overnight is not enough. Some big problems, especially finding really good abstractions or finding answers to things that satisfy a bunch of simultaneous constraints take a long time, it just does.
On the other side, Bill Sourour says, you should not spend your time learning every new thing on the planet in order to stay relevant. Instead focus more on fundamentals. For example, once you know the basics of MVC frameworks, you can easily learn Rails, Django or Symfony. Bill also writes your mind and body need down time, and they’re going to get it whether you like it or not.
The brain’s ability to self-regulate — to stay disciplined — wanes with each exercise of self-control during the day. It’s a loss of resources that must be replenished. Otherwise it becomes harder to stay on-task, be attentive and solve problems.
Thus, don’t rush or be impatient, learning takes time. Here are some opportunities I find notable for becoming a better programmer:
Deepen the knowledge about your programming language
This goes hand in hand with writing code. Still, there are more options, such as reading other people’s code and talking with them. That way you learn about best practices, language functions and useful libraries. Local user groups, peer reviews or the docs also provide good input for your brain.
Learn new frameworks
To expand your toolbox it is good to know many architectural patterns, such as Event Sourcing, Microservices, Actor Model and a lot more. Don’t use Rails, Django or Symphony for all your problems, try different approaches where it is appropriate. Your new skills will add to your programming even when your are forced into a framework.
Learn new programming languages and paradigms
Probably you come across debates about which programming language is the best. So why just don’t learn them all? At least it would add some quality to those discussions.
Each paradigm, such as functional, object-oriented, logic, imperative and declarative programming emphasizes a different approach and a different mindset that increases your understanding of the problems they solve. It is not enough to know the idea behind a paradigm, you have to understand it, so work with it. When you feel uncomfortable with a new language, you are on the right track.
In addition, each language comes with a different concept of managing certain problems. Examples are Go’s concurrency model, Rust’s thread safety and Haskell’s function pureness which are all worth knowing.
When you have a background in web development learn more about systems programming and vice versa. Maybe your next hobby project is built in ArnoldC.
Work on codebases of different magnitudes
A programmer which handles projects of a certain size might not cope with larger projects very well. There is a threshold between coding scripts of a few hundred lines and projects of 5,000, 20,000 and 100,000 LOC.
Get involved in many software tiers
Become an application developer, framework author, UI, backend, database, library developer and even a language designer - each domain rises their own challenges.
Of course, these and other methods are more the wrapping in which insights and knowledge may or may not get delivered. Tackling problems by different point of views, in different languages and with different tools increases your understanding - your thinking will become much clearer and precise. Still, you need to reflect on your code, recognise failures and shortcomings especially when it comes to major code reworks.
See you next time,