Spike to learn, TDD to build

I don’t consider myself a coding genius, and as my brain is fairly small when I start on new programming problems, I invariably come across things that I don’t know how to solve. Just recently I’ve been looking at using POI to read some Excel files. I started building the code in my normal fashion using TDD and ended up getting myself into a horrible mess.
The reason was that I didn’t know enough about what I was doing to write the tests to drive the design. In the words of Obi-Wan, These are not the tests you are looking for. I spent a lot of time going nowhere because I didn’t know where my goal was. So, I deleted all the code and started again. This time I started by creating a spike. This is essentially a single vertical slice of functionality through what I wanted to do. I didn’t write this TDD, I just wrote code to explore the landscape. I wrote code to learn what is possible, and what is not possible. This code does not end up in a production system, but it gives me all the information that I need to know to build the code properly. This is almost the case of “build one to throw away”.
After spending a relatively short time exploring the capabilities, I was in a much better position to use TDD to drive me to a goal, and the resulting code was much cleaner and had a better “feel” about it. New functionality was added in a more natural way.
There has been discussion on the Yahoo! extreme programming list about “when do you not use TDD”, and this is one of those cases for me. I don’t use TDD when I don’t know what to do. This makes sense to me because TDD is a design activity, and if you don’t know how to design something, you need to have a better understanding of the problem (and solution) domain or you’ll end up in a horrible mess (see above).
Of course, this is not for everybody, some people may prefer to walk away and spend some time using UMLAsSketch to solidify their thoughts and understanding. However this approach works nicely for me, and if you’re having trouble getting TDD to work for you this may provide a helping hand.

Advertisements

Why I’m excited about JDK 1.5

It’s been a long time since I’ve been excited by a release of software. Maybe the release of Quake ][ was probably the last time I waited with anticipation for some software. However, I’m super happy with JDK 1.5 for one main reason alone.

  • Everybody is posting stuff about it

It’s great. Everybody has their own point of view, and what they find great about the new release. There are people comparing the changes to how Java now looks to C#, javax.pack, generics, you name it, everybody has something to say about JDK 1.5
And that is very, very important for the longevity of Java. It’s become interesting to people all over again. This is like the early days of 1.0.2 to 1.1 where significant new features were being added.
Now, I might not agree, or even like all the new features, but frankly, I’m sure there are plenty of people out there that can whip up some enthusiasm about those features. That’s what Java has been lacking recently, and with many people willing to stick the boot into Sun for just about everything including flood, fire and famine, this enthusiasm is just the shot in the arm that my favourite software development language has been lacking recently.
So, go for it everybody, post why you like the new JDK 1.5 release. Post to other blogs, leave comments, disagree with other people, but most of all, show the world how enthusiastic you are.

Web development plugin for Mozilla and Firebird

I’m on holidays and in my role as diarist and photo taker I’ve needed to see what the resulting JAlbum pages look like on my parents and other, well, shall we say, “resolution challenged” monitors (compared to my 1400×1050).
A quick google search turned up the web developer extension which is a plugin for Mozilla and Firebird.
I’ve not had much of a chance to play with all the features, but it installed pretty easily, and appears to work pretty damn well. My initial need was to be able to change my browser to an 800×600 and 1024×768 with a minimum of fuss. It certainly does that, and lots, lots more.