Ask HN: How do you apply deliberate practice to programming?

6 points by awt ↗ HN
I am curious if anyone has any techniques they use to deliberately practice programming. I'm familiar with the "dive in" methodology, so please don't recommend "just start building something."

3 comments

[ 4.3 ms ] story [ 15.7 ms ] thread
I've been investigating this question recently as well. I am not a great programmer, so take this with a grain of salt. Also, I might ramble a bit, but I'm still trying to figure this out myself.

I think the biggest thing is to work on continuously improving/rewriting/refactoring code. You might even start by studying solid code from someone else and try to rewrite it from memory until you can match or improve the original. After each iteration of rewriting from memory, compare to the original and see how it measures up. What did they do differently and why? Obviously, this has to be code of a manageable size for your current ability. Ben Franklin did this with writing he admired, and Steve Wozniak did it with circuit layout.

Beyond this, I found a couple of papers/articles that might be useful.

http://web.coehs.siu.edu/units/ci/faculty/pfadde/Research/De... The first is about deliberate performance, which is a combination of deliberate practice with your typical work requirements. Try to make predictions about how things will work or how long they will take to complete and write it down. Check the accuracy of your predictions. What threw you off? How could you do better? If there were different constraints, what would that change? I've found writing down my thought process to be useful in problem solving. What do I know? What am I trying to do and how might I do it? What are the implications of that choice? Test driven development could be a useful tool in this process as well.

If there is someone who is more skilled, try to imagine what they might do. If things don't work as you expected, explain your thinking to them and ask what went wrong. Have people evaluate your code. One of the reasons really good programmers crop up in open source is that they have quick feedback on code quality, so contribute to a project like that.

http://www.newyorker.com/reporting/2011/10/03/111003fa_fact_... This second article is by Atul Gawande, it describes how coaching can be applied to medicine. If you can find someone to fill this role for you, ask them.

Finally look at these links from Quora/Stack Overflow... http://www.quora.com/How-does-one-systematically-go-about-be... http://www.quora.com/What-are-some-tips-for-advanced-writers... http://stackoverflow.com/questions/3605461/how-does-a-progra...

Thanks for this insightful and thorough response. You definitely gave me some concrete techniques that I can try out.
Try the "Billy Joel" test. Billy Joel taught a class. He talked about a song he wrote. Originally he thought of it as a Reggae song (which he demonstrated), but then thought of it as broadway (demo), then country (demo), the rock (demo)... same song, different style, and he could do it on the fly.

So can you write an algorithm (e.g. search, sort, regex) in recursive style, OO-style, table-driven style, procedural style, functional style, domain-specific language style, etc.? Does the stylistic change flow off your fingers?