... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2007-02-14

The Compiler is Your Friend

Strong typing has a bad rap these days.  Someday (read: never), I will have to write an article about how it is not evil.  Especially since strong typing was a big part of what made me "downgrade" from Lisp to Java.

Yesterday, I spent a couple of hours sweeping through our "application in crisis".  Being a Java application that uses RCP and Hibernate, there was a lot of run-time type checking going on.  Unnecessarily, I might add.  By declaring the real types of objects (instead of just Object), the compiler dutifully found a bunch of bugs that would have taken a whole lot of testing, or customer deployment, to find.  Bugs like: confusion over whether an entity's key was scalar or composite; using the wrong return type for a query; diverging from the mandated equals/hash code strategy; or trying to persist non-persistent objects.  All found at the cost of a few minutes of adding appropriate declarations.

Blog Archive