« µ-ISV | Main | Blogging »

Saturday, August 26, 2006

Competitive Programming

I am a competitive guy. People who know me well, know that I always go to the bottom of things; have a passing interest in anything will never happen to me. It's either all or nothing. For years, I have been looking for ways to funnel my energies into some kind of online community. Requirements are that it should be engaging, competetive and educational. I have been taking quite a few stabs at different online gaming communities but they haven't turned out to be what I am looking for.

I am happy to say that finally, I think I have found the niche I have been hunting. TopCoder.com. TopCoder is an online community for people who love programming. Or rather, it was; today it has grown to cater for architects, testers and graphics artists as well. The basic concept is that you participate in contests where you need to solve three algorithm problems in a language of your choice (mine is .NET C#). The faster you solve it the more points you score. Given that the system tests pass your implementation, that is. Or that no competitor will challenge your implementation with a unit test. That's the weekly competition TopCoder is running, and which is divided into two divisions according to your rating. Sometimes one of the sponsors throw in money in the prize pot to make it more interesting. On top of this there are weekly design and implementation challenges where the best submissions will be awarded enough cash to make it worth having a look at.

There is just one thing missing from TopCoder, and that is that they should allow remote pair programming competitions or us agile geeks. Just read the story of this guy who tried it.

Sunday, July 23, 2006

Test-Driven Development

Test-Driven Development is a paradigm shift with its novel approach to software development. It puts the fun back in development, while improving quality and end-user satisfaction.

Unit testing is one of the cornerstones in agile development. A comprehensive suite of automatic tests for your source code generates many benefits. Your confidence in modifying the source code will skyrocket because you know that if you unintentionally break something the tests will catch it.

But this is just the first step. By writing a test for a new feature before the actual implementation, you are set up to reap additional benefits. For most developers uninitiated in this technique, it sounds counterintuitive and like a big waste of time. Still, this is the way that I have developed software for the last couple of years, and I really can't see myself writing a substantial amount of code not using this technique.

The technique I described above is called Test-Driven Development (TDD) and is steadily gaining popularity. It stems from one of twelve extreme programming practices, and many friends and colleagues to whom I introduced it swear by TDD today. The main benefit gained from a test-driven approach is that you are approaching the solution from the top, from the user’s perspective.

Too many potential killer apps are destroyed by programmers who develop bottom up. When it comes to designing the interface (like a GUI or API), they find themselves tied down to their early ill-informed low-level design choices. By doing TDD you will let the requirements drive the development. As a positive side-effect it is a thrill to develop software this way, you are always focused on reaching one specific goal, usually not that far away. It is difficult to lose focus on what you are out to accomplish in the source code while trying to get a test to pass.

Automatic tests can also be used to specify programming assignments. You hand your colleague a set of tests that lack implementation and ask him to implement the required classes so that the tests will pass.

So how do you do this in practice? Well, if I were you I would head straight over to xUnit’s Wikipedia entry where free tools are available for almost any language/platform. For .NET development, nUnit is the testing framework of choice. Good luck with your tests!

Monday, March 27, 2006

Agile Articles

I finally got around to move over my papers on agile development to the new web site. Although they are a few years old, I think they still hold relevance. One article is a diary about an extreme programming project I coached at Labs2 in Lund, Sweden. The other one is a conference paper regarding how to combine XP and the CMM to work in harmony with each other.

The articles can be accessed from the tab above.

© Jonas Martinsson 1995-2006