This article contains affiliate links. See my affiliate disclosure for more information.
The best way to get better at programming is to program a whole lot. Right?
Not really. But also, yes. To get better at anything, you do need to practice often. But not all practice is equal. If you don't practice deliberately, with clear goals and a system for measuring success, you'll get stuck on a plateau.
But what does deliberate practice look like for coding?
What Is Deliberate Practice?
There's a lot of content out there on deliberate practice for programming.
I got 103 million results when I searched the term "deliberate practice for programmers" while researching this article.
The top articles I saw give good advice, which boils down to five key steps:
- Deconstruct a task into smaller subtasks.
- Determine a measurement of success for each subtask.
- Practice the subtasks.
- Get feedback and reflect on your performance.
- Adjust based on feedback and repeat until you reach your goal.
It's a good recipe, and it works when done well. Especially when you have a good feedback system in place.
But it isn't deliberate practice.
This approach is what psychologist K. Anders Ericsson, author of Peak: Secrets From The New Science Of Expertise, calls purposeful practice.
Don't get me wrong: purposeful practice is excellent. It's the foundation of deliberate practice. But there's a key difference. As Ericsson writes in Peak:
Deliberate practice is purposeful practice that knows where it is going and how to get there.
In other words, deliberate practice is a program of purposeful practice designed to take you from novice to master.
That word designed is super important.
Can Coders Do Deliberate Practice?
In order for deliberate practice to be an option, three things need to exist:
- A universally accepted and objective notion of mastery
- An understanding of how one achieves mastery
- A set of proven techniques for advancing toward mastery
This is why deliberate practice is so common in activities like music and athletics. There's a clear standard for mastery, especially in athletics. In individual sports like running and swimming, mastery can be objectively measured by consistently performing under a specified time.
A good coach can design — there's that word again — a program tailored for an individual athlete that draws on hundreds of years of collected knowledge about what works and what doesn't.
What about software engineering?
There's no universal definition of what it means to master software engineering. How do you know what mastery looks like if you can't define it? How do you design a practice program for an undefined goal? You can't. Deliberate practice, in the strictest sense of the term, is virtually impossible.
Maybe we're casting too wide of a net here.
Instead of focusing on software engineering as a whole, focus on individual skills.
What Skills Can a Coder Practice Deliberately?
There are two categories of software engineering skills:
- Physical skills, such as touch typing and mastering keyboard shortcuts.
- Intellectual skills, such as syntax, data structures, algorithms, architecture, debugging, and problem-solving.
Physical skills lend themselves quite nicely to deliberate practice.
Intellectual skills are a bit more challenging to practice deliberately.
The main challenge is feedback.
In order for deliberate practice to work, you need to identify where you're struggling and devise a plan to improve. Syntax might be the easiest intellectual skill to get feedback on since compilers and interpreters can tell you when something is syntactically incorrect. Static analysis tools, like linters, can also help.
But syntactically correct code isn't necessarily good code. And it's a lot harder to get feedback on things like software architecture and problem-solving.
Code review can help, but the goal of code review at work is to successfully ship a product, not help you master programming. And code reviewers aren't always the best coaches.
How Do You Practice Programming Deliberately?
Focus on physical skills, syntax, and tools.
The goal of deliberate practice is to develop mental models. Mental models help offload some of the work that your working memory does during coding into "muscle memory."
Moving skills like touch typing, keyboard shortcuts, and commonly used syntax and git commands into muscle memory means you'll spend less mental energy on them and experience fewer interruptions while you're coding.
Identify Your Weak Points
The first step is to evaluate your current performance and identify what's holding you back.
Is there syntax that you struggle with or a sequence of git commands that you have to look up every time you need them? Those are good candidates for deliberate practice.
Devise A Practice Plan
I won't lie. A coach or mentor is incredibly helpful for this step. In some cases, though, you can construct your own plan.
For example, if you struggle with list comprehensions in Python, you can search GitHub for examples of
for loops and practice rewriting them as comprehensions. If you have a hard time dealing with merge conflicts in git, you can fork a repo and practice creating merge conflicts and resolving them.
But a well-designed plan — that word just keeps popping up! — isn't just about repetition.
Set Measurable Goals
A good plan sets clear, measurable goals and includes exercises designed to avoid common misconceptions.
For some tasks, like practicing keyboard shortcuts or refactoring
for loops into list comprehensions, you can set time goals. Create scenarios for yourself and record how long it takes you to complete them. Then work on reducing your time.
You can also aim to reduce the number of syntax errors you make as you type out code, or reduce the number of times you look things up while using a tool.
Reflect On Your Performance
If you really want to take things up a notch, record your screen while you practice and spend time reviewing the recording. Pay attention to where you slow down and what sort of things you struggle with.
Deliberate practice is hard. It requires lots of focus and attention. But if mastery is your goal, it's the best way to get there.
Want to learn more about deliberate practice?
Check out K. Anders Ericsson's book Peak: Secrets from the New Science of Expertise.
For coding-specific topics, including an in-depth treatment of mental models and practice techniques, I highly recommend Felienne Hermann's book The Programmer's Brain.
Artwork by @goodstudio via Canva.com