ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  A Generic MVC Model in Java
Subject:   Good demonstration poor example
Date:   2004-07-19 09:01:16
From:   mbrowncpwr
Response to: Good demonstration poor example

Actually let me correct my statement. Basically the use of generics is unecessary in the Observer pattern because as you demonstrated in your generic code, all observers have to implement the same interface either way (if they're generic or not).


The main benefit of generics is the ability to remove typecasting away from collection classes. Now my Hashtables can know they are a collection of Widgets ordered by Strings and I can get compile time debugging when I try to put a Wicket instead of a Widget into my collection.