Definitely Factory Method... Reason Abstract factory is used to create a family of dependent classes. Factory method provides an interface for creating objects but lets subclasses decide which one to create. Consider the following eg. javax.ejb.EJBHome javax.ejb.EJBObject | | | | / \ / \ --- --- | | 1. XxxHome gets instance of 1. Xxx 2. YyyHome gets instance of 2. Yyy The appropriate concrete instance of EJBHome (our factory method generalization), in this case Xxx home or Yyy home (concrete factory) will create the appropriate remote reference object.
Sanjay Raghavan<br />SCJP2, SCEA-J2EE<br />Moderator - <a href="http://groups.yahoo.com/group/scea_prep" target="_blank" rel="nofollow">SCEA PREP</a><br />Co-Author - <a href="http://www.whizlabs.com/scea/scea.html" target="_blank" rel="nofollow">SCEA@Whiz</a><br /><i>Where did you sip your Java Today?</i>
Joined: May 14, 2002
oops...the diagram did not come out right...anyway XxxHome and YyyHome extend javax.ejb.EJBHome and Xxx and Yyy extend javax.ejb.EJBObject.