Notes from PM-R group Code Review 6/11
November 6, 2009
In case they’re of wider interest.
- Get used to
"literal".equals(object)
. Get used to it. Yes, yes, blah blah blah. Just get to used to it! - 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).
- Useful classes 101: org.apache.commons.io.output.NullWriter – writes to
dev/null
- Boolean unpleasantness. Don’t test
myBoolean == true
, just usemyBoolean
. Also remember that this: –
if(something) { return true; } else { return false; }
return something
. - No Magic Numbers
- 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.
Unchecked Type Conversion best practice
November 5, 2009
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.
Cambridge Clojure Meetup 10th Nov
November 4, 2009
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.