Monday, September 2, 2013

TopCoding

"An expert is a person who has made all the mistakes that can be made in a very narrow field." -- Niels Bohr
An error-prone physicist
I've been thinking about mastery lately, after reading books like Outliers and discussing Talent is Overrated with my brother.  The basic premise of the latter is that mastery is achieved by many hours of mindful practice of things that are within your grasp.  At any point in time, there are
  1. things you can already do,
  2. things you could do with some practice, and
  3. things you might eventually be able to do but are not within your grasp yet.
Since time is a precious resource, you should avoid either striving for things far outside your ken or sticking with what you already know.  You should try to attain what is within your reach and will cause you to improve.

How do you improve as a programmer?  For the last few months, I've been practicing on TopCoder.  TopCoder is a free programming competition site with a number of areas for competition, though it centers around algorithms.  I had tried it when my grad student advisor first told me about it around ten years ago, but my initial and incorrect impression was that it was only for can't-see-the-forest-for-the-trees hackers who loved writing cryptic and nested for loops and who never had any other plans for the evening.  To be sure, doing the competitions and practice problems is a bit like practicing musical scales, but if you're serious about your craft, then you should be serious about practicing.  By and large, the kinds of problems you can find at TopCoder will challenge you in ways that you might not get at work, and they let you do it in a focused manner.

TopCoder's algorithm problems should help you practice the mapping of a real problem to algorithms and data structures, which is really the heart of what it means to be a programmer.  I suggest starting with Division II problems.  I didn't realize there was a difference at first and was highly discouraged by a Division I problem that eluded me for hours.  Each division has easy, medium, and hard problems which you can do at your leisure.  I've been practicing using Java, since I've been spending more time lately with the language and want to learn it well, though it seems like the top ranked programmers use C or C++.  Make sure you look at other people's code after you've tried a problem.  I've been following a guy named DoublePointer, who also programs in Java, and seems to have done every single problem.

I'll admit that some of the worse problems--or perhaps the problems I like the least--are the ones that admit of no answer besides many nested loops where you have to keep track of multiple indexes.  Solving any problem will involve some measure of implementation and some of algorithm design, but these tend too much towards the former.  In general, however, I think the problems on TopCoder are excellent.  Not only do they let you practice at a level within your grasp, but you get to learn about all kinds of subjects, like lotteries, tire rotation, and Incan numbering systems.  I recommend trying a practice set each week.  That should only take an hour or two.

In the end, mastery is all about doing things you can't quite do, which means making a lot of mistakes.  Practice makes perfect because it's in practice where you get to screw up when no one is looking.  I give many thanks to TopCoder for the chance to mess up and learn from what I've done  wrong.  My TopCoder profile consists entirely of the Bohr quote above and is my inspiration to keep at it when I get frustrated by a tough problem.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...