Tuesday, October 17, 2006

Atomicity in Unit Tests

Unit tests can be a touchy subject for some developers.  For some, they dispise doing them at all, while others go completely overboard with them.  I'm in the middle.  I don't believe that they're a cure-all for bad code, but I do feel that whether you call them unit tests or test harnesses, you have to do them to provide a repeatable way to check the stability of your build.

One thing I do have a snit about is the atomicity of those unit tests.  Many developers build unit tests that build upon each other.  It reduces the development time for unit tests but it makes debugging and troubleshooting pure misery for anyone but the original developers.  Also, if you have 100 unit tests and they are all interdependent, then if test # 99 breaks, you still have to run the first 98 just to get to the point where you need to debug.  Again, I don't say that you can't build these types of tests.  For complex systems such as O&E, payroll, D&C type systems, you can't avoid it.  But most systems can have many small standalone unit tests and only 2 or 3 large complex tests like these.

So to make your live easier, try to make your tests as atomic as possible.  That is, make them stand alone and singularly repeatable.  You'll thank yourself later!

Monday, October 09, 2006

Is Google Java's dark horse?

 I was around when Java first came out and lived through the sometimes nightmarish stability problems in the early releases.  Java was out before .Net was even alphaware and it brought a great deal to the table.  But something went wrong or better yet, nothing went right.  Advances were slow, the VM was a hog and was slow and the UI was a hack.  We were all waiting thinking, "Wow, this will be great when they finish it!".  But that never happened.

Now, with C# we got everything we wanted and a fantastic IDE to boot.  Everyone I know has gotten out of the Java space and it feels like Java is going the way of Cobol (there but not talked about, just maintained).

Enter Google, stage left.  Google does quite a bit with the Java VM.  Google is enormous and is like an octopus with thousands of arms in every direction.  Could Google's shear weight be enough to keep Java alive?  Possibly.  But there are now new ferocious competitors (Ruby for one) that are viable alternatives with an army of avid (if not a bit misdirected) developers fighting for it.  I feel Google has the future of Java in it's hands.  It has used the Java VM without promoting it.  If it decides to change horses, Java would vanish into the mist with Cobol.  And where is Sun?  Sun still can't decide if it's a hardware or software company.

I'm not promoting Java, I'm diehard Microsoft.  But everyone needs competition.  And I'm a technologist first.  I hate to see good technical effort and ideas go to waste.