Most people learn programming by watching and re-reading, which feels like progress and mostly isn't. Learning research has firmer answers than you might expect. Six habits, each with the study behind it.
01
Deliberate practice
Practise just beyond what you can already do, with a clear goal and fast feedback, then repeat what failed. Ericsson and colleagues (1993) argued this kind of practice, not hours alone, is what builds expertise. A later meta-analysis found practice matters but explains less than claimed: about 26% of the differences in games, 21% in music, 18% in sports and 4% in education. Quality and focus count more than the clock.
Do this
- Pick one narrow skill per session, like looping over an array.
- Do five small problems that are slightly too hard.
- Check each against tests, then redo the ones you missed without looking.
Ericsson, Krampe & Tesch-Römer (1993), Psychological Review · Macnamara, Hambrick & Oswald (2014), Psychological Science
02
Retrieval practice
Pulling an answer out of memory strengthens it far more than reading it again. In Roediger and Karpicke (2006), students who practised recalling a passage remembered 61% of it a week later; students who only re-read it remembered 40%, even though they had read it about four times as often (14.2 readings against 3.4).
Do this
- Close the tutorial and rebuild the example from memory.
- Answer each chapter's Recall cards before opening them.
- Explain a concept out loud, then check what you missed.
Roediger & Karpicke (2006), Psychological Science
03
Spaced repetition
Spreading practice over days beats cramming the same amount into one sitting. A meta-analysis of 839 comparisons from 317 experiments (Cepeda et al., 2006) found the best gap between reviews grows with how long you want to remember. A review of ten study techniques (Dunlosky et al., 2013) rated practice testing and spaced practice the only two with high utility; rereading and highlighting rated low.
Do this
- Review new material after 1 day, 3 days, a week, then a month.
- Keep syntax and concepts in a flashcard app with spaced scheduling.
- Re-solve old exercises cold every few weeks.
Cepeda, Pashler, Vul, Wixted & Rohrer (2006), Psychological Bulletin · Dunlosky et al. (2013), Psychological Science in the Public Interest
04
Build projects
What you produce yourself is remembered better than what you read: psychologists call it the generation effect (Slamecka & Graf, 1978). Projects make you generate everything: decide, combine, get stuck, debug. Following tutorials without building anything of your own feels productive and teaches little. Programmers call that tutorial hell.
Do this
- After every tutorial, build a variation without it open.
- Keep one small project going and add a feature each week.
- Climb the project ladder below in order.
Slamecka & Graf (1978), J. Experimental Psychology: Human Learning and Memory
05
Read code
Professionals spend most of their time understanding code, not writing it: about 58% in a field study of 78 developers over 3,148 working hours (Xia et al., 2018). Studying worked examples also helps beginners learn faster than solving everything from scratch (Atkinson et al., 2000).
Do this
- Read one short function from a well-known project each week.
- Predict what it does before you run it, then check.
- Read your own code from a month ago and improve it.
Xia, Bao, Lo, Xing, Hassan & Li (2018), IEEE Transactions on Software Engineering · Atkinson, Derry, Renkl & Wortham (2000), Review of Educational Research
06
Debug on purpose
Debugging is a skill of its own, and it can be taught. A review of the research (McCauley et al., 2008) found novices often lack a systematic strategy: they change code at random instead of testing a hypothesis. Every bug you track down teaches you how the system really works.
Do this
- Reproduce the bug, then guess the cause before touching anything.
- Test one guess at a time, with a print or a breakpoint.
- Keep a bug journal: the symptom, the cause, the fix.
McCauley, Fitzgerald, Lewandowski, Murphy, Simon, Thomas & Zander (2008), Computer Science Education
About six and a half hours. Short and regular beats long and rare: that is the spacing effect at work.