Archives for the 'random ideas' Category
Class>.cast(..) and Generics - a powerful combination
Saturday, July 12th, 2008
As you know when it comes to casting a la Java 1.4 a developer will have to write, typically, something like this:
Object a = "iron man";
String b = (String)a;
Well, there is nothing wrong with this code. However, it is not pretty :). With Java 5.0 the casting mechanism is more explicit and nicer. [...]
Documenting Exceptions via Factory Methods
Wednesday, May 28th, 2008
Jesse described a technique for handling methods that always throws. This is a very interesting technique. Having written that, would it not be nice to encourage the use of this technique, in our Java coding conventions, as a way to document DRY exceptions? Honestly, I’d’ think we should. It would prevent us from repeating the [...]