Tuesday, December 29

Deliberate Practice

M

indless repetition does not count as deliberate practice as without focused attention and narrow specific and detailed goals it is easy to repeat your mistakes instead of improving your performance. Deliberate practice needs to be purposeful and systematic. 

I will describe two examples of deliberate practice, one as a musician and one as a developer. You will see that there are commonalities in strategies and techniques that are independent of  discipline. 


Deliberate Practice In Music

I knew a drummer once who took a year off to practice his drumming. He sacrificed his income and drove his poor wife to distraction. After a year he was no better than when he started. 

So what did he do wrong? 

Small vs Big Changes 

Small frequent commitments are generally easier to keep and stay focused during than big one-off commitments. I practice my bass 15 minutes a day plus a couple of longer sessions a week. Maintaining focus for an entire year is unrealistic. If I wanted to increase my commitment to music I would gradually increase the length and frequency of my sessions rather than make radical changes that are hard to maintain. 

Spaced Repetitions


For memorization activities, few repetitions each day for most of a week is more effective than 20 repetitions in a single day (Cramming). Anki is a useful app for enabling spaced repetitive memorization.

Feedback 

Frequent and constant feedback is essential for practice. The only people listening to the drummer were non-musicians, his long suffering family. As well as giving feedback, practice partners can provide social pressure to maintain practice, as well as making practice far more enjoyable. Teaching music to my daughters and playing with them is a major factor in maintaining my bass practice. That and the fact that it is fun and great for stress relief. 

Specific vs General

Narrowing your focus by breaking down what you're doing into the smallest possible parts and aspects, and focusing on each part individually rather than merely having a vague desire to improve is essential. Without this it is easy to simply practice the errors you are making like the unfortunate drummer. Constantly changing the aspect you are trying to improve helps with the next point. 

Variety

Keeping things fresh is essential. If your practice is monotonous then it is almost certain that you will go off on a tangent in order to take a break. In this case, psychology professor and author Angela Duckworth, advises to substitute nuance for novelty. In one practice session I may concentrate on alternate fingering and in another I may concentrate on timing and feel. In one practice session I may concentrate on my fretting hand and in another I may concentrate on my plucking hand. In this way I maintain focus without getting bored as well as making small maintainable improvements in all aspects of my playing. 

Careful and Patient

It is also essential to be slow and meticulous in order to practice the correct way rather than practice making errors. I usually practice with either a metronome or a backing. When learning a new song I will often set the metronome or backing to 0.75x speed then slowly increase the speed over the course of the practice until its 1.5x speed then slowly adjust it back to 1x speed. It is important to practice without errors. It is also important to practice at the edge of your abilities. 

More Information  

Articles

Videos

Books


Deliberate Practice In Software Development


So how do we deliberately practice in order to improve our programming skills?

I use the same principles that I use to improve my bass playing to improve the software I produce.

Overlooked Opportunities 


I find that many developers focus too much on learning language and frameworks features. While a full understanding of the tools you are using is essential, if you simply stop there, you are missing so many opportunities for improvement. Implementation is only one phase in the software lifecycle, you should not neglect the other phases and within implementation itself there are so many dimensions that it is unlikely you will run out of things to improve even if you feel you know the implementation platform back to front.

On-the-job Learning


Within my normal work there are many opportunities to practice. To keep it fresh I will focus on different improvement goals each session. In one session I may focus on composability, in another readability in another testability. In one session I will identify and exact reusable components from existing code in another test whether a particular approach or design pattern will keep the design simple or if an alternative would be better. 

Feedback


Test first design is ideal for maximizing immediate feedback.  Pair programming gives lots of potential for feedback if you take advantage of it. Code reviews are a great way of getting feedback, however so often programmers see it as an annoyance. Tightening the feedback loop by getting early feedback from testers or users can be helpful.

Learning by Teaching


Teaching others is helpful in improving your understanding of the material. Whether helping a teammate with a problem or teaching a workshop on a topic or presenting at a meetup, the need to break down what needs to be done into small easily understood steps can help your own understanding and help organize your existing knowledge.

Learning from the Pain Points


I used the need to document an existing internal API to help drive improvement to the API. For each section in the API I would ask how can I change the API so as to make this section of the documentation unnecessary. I ended up simplifying the API a great deal making it much easier to use.

Learning using Practice Problems


You can use code katas or code koans to help practice your programming skills and there are many sites that offer problems for you to practice (see below).  

More Information  

Articles

Videos

Problems to Practice

  • Project Euler - Solve mathematical problems using programming skills
  • LeetCode - Solve coding challenges, competitions and mock interview
  • HackerRank - Offers a variety of different types of programming challenges
  • TopCoder - Solve algorithmic challenges within a time limit
  • Code Wars - Community submitted challenges and discussions
  • Code Chef - Community site with challenges, competitions and tutorials
  • CoderByte - Coding challenges and tutorials
  • Exercism - Coding challenges with assistance from mentors.
  • Sphere Online Judge - Coding challenges, competitions and discussions
  • Hacker Earth - programming challenges and  interview preparation

Programming Games

  • Codingame - program simple games then play them
  • RoboCode - program tank AIs and pit them against others
  • CodeCombat - write code to solve puzzles