Back to list
Views:   0
Replies:  0
Archived
,
Reply 1

1. The intent of factory method pattern is to "Define an interface for creating an object, but let subclasses decide which class to instantiate". Whereas when if i see the source code  AgentStatusFactory class defining the "Parse" function and returning the instance of AgentStatus class. After checking the source code i would say this is just a variation of factory method pattern which we can call it as simple factory pattern. If the mentioned structure is changed according to enclosed class diagram, it will turned to be factory Method pattern.

2. Yes the mentioned point is correct.

3.Factory Method Pattern provides an interface for creating an object, but let subclasses decide which class to instantiate. Whereas Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete class. Please refer to following URL.

http://img34.imageshack.us/i/absfactory.png/
http://www.codeproject.com/KB/architecture/FactoryPattern.aspx

4. For the given scenario Factory Method pattern is best. Builder has to be used when the creation process is tedious and has to be reused. In other words Builder design pattern has to be used when the creation of a specific object  has to be done over several steps.

5. I think given the secnario the above code snippets looks good in many ways maintainability/reusability. But if you could provide more information or goal you want to achieve, it would be helpful.



Saurabh Saxena, Sep 15, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas