aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Home Interface.. Abstract Factory or Factory Method pattern? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Home Interface.. Abstract Factory or Factory Method pattern?" Watch "Home Interface.. Abstract Factory or Factory Method pattern?" New topic
Author

Home Interface.. Abstract Factory or Factory Method pattern?

andy armstrong
Ranch Hand

Joined: May 14, 2002
Posts: 154
For the ejb home interface which pattern
is it?


Certifications: <br />scp2, scea, scwcd, WL7.0, CISSP, XML
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
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.

HTH.


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>
Sanjay Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 148
oops...the diagram did not come out right...anyway XxxHome and YyyHome extend javax.ejb.EJBHome and Xxx and Yyy extend javax.ejb.EJBObject.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Home Interface.. Abstract Factory or Factory Method pattern?