In case they’re of wider interest.

  1. Get used to "literal".equals(object). Get used to it. Yes, yes, blah blah blah. Just get to used to it!
  2. Useful classes 101: there’s a generic BidiMap in the Commons-collections library, version 4.0. Hasn’t hit maven2 repo yet, but it’s released (javadocs).
  3. Useful classes 101: org.apache.commons.io.output.NullWriter – writes to dev/null
  4. Boolean unpleasantness. Don’t test myBoolean == true, just use myBoolean. Also remember that this: –

    if(something) {
      return true;
    }
    else {
      return false; 
    }

    is a really long way of saying return something.

  5. No Magic Numbers
  6. Yes, Tuples are lovely. If you really don’t want to design your way around their absence in Java, use something like the generic Pair class.

A couple of months ago, we started using the Murray-Rust group meetings to perform code review. It’s been interesting – sometimes we look at fairly low level idioms, sometimes at more fundamental refactoring and design issues. I’m particularly pleased that the tone has remained constructive, even when PM-R took centre stage last week.

Occasionally we stumble across an issue for which there is no established or widely accepted best practice. One of the things that came up recently was what you should do about the “Unchecked Type Conversion” warning that appear when you try to shoehorn a 1.4 library into 1.5 code that’s expecting generics. I should probably have posted it myself, but Joe has done me the service of recording the results of our discussion and research.

I’ll be going to the weekly Cambridge Clojure Meetup next Tuesday, 10th November, 2009.

The time place is the usual, 8pm at the Kingston Arms.

Update: I’ve set up an upcoming entry for next week’s meeting.