I have found that quite a few programmers struggle to work in a completely test driven fashion. I myself whilst writing tests for many years, took a long time to move over to writing the test first. I think one of my problems was that I always wanted to do my thinking in [...]
1
2010
21
2009
Untangling a Gigaspace Pojo
A hibernate entity class is annotated describing to hibernate how its to be persisted. Annotate this class with JAXB for a transformation, chuck in some gigaspace annotations so we can add it to a cache and things start to get messy. Worse still gigaspace has some tight restrictions surrounding what it requires from a pojo, hibernate has others. Its tempting to leave the resulting class cluttered with these soft concerns. I propose a solution using composition that allows for easier maintenance ongoing.
16
2009
Test anti-patterns project, contributors wanted!
I deliberately wrote a poor quality test, so that I could show how easy it is to re-factor it to a better one. I was driven by having seen lots of such poor tests and to be honest I don’t want to see another of its ilk again. I might write a test like this myself, but I would never leave it like this. Its part finished, littered with cut and paste, poorly named methods and hard coded values.
I show how to re-factor the test using several patterns for test fixtures. The setup stage is often the worst bit of a bad test. If you want to contribute some of your own bad tests and example improvements, read the blog, download the project and contribute!