The Google Code Jam qualifying round was a few days ago and I thought it'd be fun to go over the three solutions that I came up with. I didn't actually compete, this was just done on my own time for fun. The next 3 posts will be about those challenges, but this one is about something else I observed.
I was curious how I'd compare against the leaderboard, so I timed myself. As a result, I knew how long it took to get a working solution, even if it was ugly, and then how much longer it took to get a solution I'd be comfortable presenting, committing, and maintaining.
The interesting thing that I found while doing these solutions was that writing an initial solution that worked typically took around 15 minutes (plus or minus a few). Then I spent some time cleaning up the code in various ways. I didn't properly comment it or write tests for it, but given the total time spent on it thus far, my observation leads me to believe that code (or at least my coding) follows the Pareto principle.
The Pareto principle states that 80% of effects come from 20% of the causes and vice-versa. It seems that getting code that solved the challenge (80% of the effects) took about 20% of the time spent. Assuming I had spent more time properly commenting the code, writing tests for it, etc... it appears 80% of the total time spent would have been spent doing the final 20% of work.
About the author
I'm Steve Krenzel, a software engineer and co-founder of Thinkfuse. Contact me at email@example.com.