Practice Makes Perfect at Programming

Bart What’s the secret to being an awesome programmer?

You know the kind of programmer I’m talking about. The ones that kick butt and take names; the ones that seem to know the key commands and APIs for everything; the ones that know how to squeeze every last second of performance out of a piece of code. How do you become that guy?

These people must just have inborn talent right?

Talent

John Nunemaker (the creator of MongoMapper) dispels all myths regarding talent:

It is true. I have no talent. What I do have is a lot of practice. And I am not talking about occasionally dabbling in Ruby on the weekends. I am talking about the kind of practice where I beat code that isn’t working into submission (though often times the code wins).

The kind of practice where all of a sudden I realize that it is 2am and I’m exhausted physically so I should go to bed, but mentally I feel on fire so I let the code have me for another hour or two (I imagine this state to be like a marathon runner or ironman near the end of their race).

The bottom line is that just like a world-class athlete needs to practice for 2 hours a day, if you want to be a world class programmer you need to be regularly practicing as well. The more code you write, the better you get.

In other words, the talent is not necessarily in writing the code itself but (if there is a talent involved), it’s the talent of practicing over and over again. Because if you think about it, it can be difficult to do the same thing over and over again without getting bored. So the real talent is keeping yourself motivated to continue practicing.

Code Katas

The programming world is beginning to realize the value of practice. Dave Thomas of pragprog books (not to be confused with the Wendy’s founder) has created a series of code katas to address the need of structured practice for programmers:

Code Kata is an attempt to bring this element of practice to software development. A kata is an exercise in karate where you repeat a form many, many times, making little improvements in each. The intent behind code kata is similar. Each is a short exercise (perhaps 30 minutes to an hour long). Some involve programming, and can be coded in many different ways. Some are open ended, and involve thinking about the issues behind programming. These are unlikely to have a single correct answer. I add a new kata every week or so. Invest some time in your craft and try them.

Currently, he has listed 21 katas for programming ninjas to practice on. The katas can be completed in any language and are all about getting you to that aha moment where you learn a new way to do something.

I struggle a litle bit with some of the katas because I like to work on things that are practical and it just feels like some of them are not practical. But maybe that’s the point. He wants you to focus on specific task like counting lines of code programmatically rather than building a whole system.

Suck Less Each Year

Jeff Attwood has his own thoughts about how to improve and it mainly involves sucking less each year:

I’ve often thought that sucking less every year is how humble programmers improve. You should be unhappy with code you wrote a year ago. If you aren’t, that means either A) you haven’t learned anything in a year, B) your code can’t be improved, or C) you never revisit old code. All of these are the kiss of death for software developers.

This rings true for me.

It’s almost painful for me to look at old code. All I can see is the ways that it can be improved. I imagine it’s the same with a writer who reads their finished novel. You’re happy that it’s done and people are enjoying it, but you’ve moved on.

The double-edged sword of programming is that there’s always more to practice on and learn…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>