Learning by writing tests

I spent the whole day writing JUnit tests for the infrastructure of a CMSish Cocoon-based application that I’m working on.

This is my first serious app using OJB for persistence, and the learning benefits of writing automated tests are huge.

Stressing the system with just a few lines of nasty code makes bugs (mine in this case, OJB behaves very well) surface very quickly – I’ve learned at least ten important things about OJB today, and without this it would have taken much longer.

I’m really getting test infected, and I like it!

Red, green, refactor…time to hit the swimming pool ;-)

Note that there’s only one thing that I hate in OJB, it’s the acronym: I find myself typing OBJ instead of OJB about a million times a day. Too much ojbect-oriented programming I guess…

4 Responses to Learning by writing tests

  1. I hate the acronym too. Talk to Thomas Mahler =)

  2. Speaking of OBJ — which API are you using? I know that Cocoon has hooks for the JDO, but current OJB-JDO, umh, doesn’t scale. We have just started renewed vigorous effort on a better impl, though.

    -Brian

  3. I’m using the PersistenceBroker, it seems to be good enough for the fairly simple stuff that I do.

    I’m not using the Cocoon OJB block actually, only my own bridge class (similar to Cocoon’s ConnectionFactoryAvalonDataSource but with a few tweaks for my environment) to provide JDBC connections from Cocoon’s pool to OJB, and another class to initialize OJB with my config.

    OJB rocks – keep up the great work!

  4. Stephan Michels says:

    Maybe you can add some testcases to the OJB block of Cocoon. The last time I looked into the OJB block I had problems creating new bean instances.

%d bloggers like this: