I am Paul Wilson; Mere Complexities Limited, sells my consulting, coaching, and coding services. I am passionate about Agile, particularly Test Driven Development.


Java Generics

Andy Swan has decided that Java Generics are probably not worth the extra complication. Interestingly a lot of the arguments against generics could be (and often are) used against strong typing in general - it does not seem catch many errors / it is all covered by xUnit tests etc.. Having to cast to use the collection classes breaks the strong typing of Java. It also gives the impression that it is ok to cast - it usually is not. I blame non-generic collections for this kind of thing:
Item item = itemRepository.findItem(itemId);
((ItemImpl)item).setMarvinIdentifier(marvinId);
Apart from collections, however, I can't remember having felt the need for Java Generics. I wonder if it would have been better to just have built dynamic arrays and a typed version of a perl\ruby style hash into the language.

0 Comments:

Post a Comment

<< Home

subscribe here subscribe

About me

picture

Conference

Scotland on Rails Organiser

Previous blog posts

Blog archive

Other links: