Three interesting Java libraries

Sommario: tre interessanti librerie Java

The standard Java date/time classes suck. There’s not much arguing about that. You either use the good, old, reasonable java.io.Date constructors that take year, month and date, but are deprecated thanks to the political correctness police; or you use the brain-damaged GregorianCalendar that wants, hear this, 0-offset months (that is, you pass it 2 and it means March). I’ve seen novices and not-so-novice programmers waste heaps of time trying to do simple date manipulations that should be dead easy. I certainly have.

So it’s good luck that some good people wrote the Joda library: it’s a simple and sane complete replacement for the Java date and time classes.

  *       *
      *

David Eric Evans is the author of Domain Driven Design, that is sitting in my pile of Books I Will Read Next since a long time. This book teaches how to concentrate on the “domain” part of software, which is in a sense a return to object-oriented basics. Recently David Eric released a free summary of his book. In the interview that goes with it I found out about the Time and Money library, that implements in Java a fragment of domain model that is common to many business applications. This is worth looking into, in a “let’s read software not just write it” way.

  *       *
      *

I strongly dislike Java Server Pages. It’s not the idea of mixing Java and Html that I don’t like; in fact, I’m perfectly comfortable with Rails’ ERuby templates. The thing I don’t like is that it’s very difficult to test them; you essentially need to run them in a servlet container, and that makes it nearly impossible to unit test them.

For this reason a while ago I used Velocity in a web application project. I’m not too keen on Velocity either, since it’s way more complicated than necessary to set up. So I’m happy that there are alternatives: the now apparently dead OpenSails project has the Viento template engine. And Terence Parr, the author of the ANTLR parser generator, wrote StringTemplate.

  *       *
      *

So in the end that makes it four libraries. I lied :)

Merry Christmas — Un Natale di Pace a tutti!

3 Responses to “Three interesting Java libraries”

  1. Filippo Says:

    *Eric* Evans maybe?

  2. matteo Says:

    Whooops! Thanks Filippo.

  3. Technical Related Notes » Blog Archive » links for 2007-01-01 Says:

    […] Matteo Vaccari » Blog Archive » Three interesting Java libraries (tags: java) […]

Leave a Reply