dcsimg
Whats the difference between Abstract Factory Method Pattern(AFMP) and Factory Method Pattern(FMP)
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Raja_Sarkar
Posted On:   Thursday, August 1, 2002 11:42 AM


Other than making the base class abstract is there any other reason for going for abstract factory pattern over factory method pattern?
Both serve the same purpose : defers instantiation of the class to its subclasses. What can be achieved by extending the abstract class for AFMP can also be achieved by extending the base class for FMP. Is it NOT? Pls do clarify

Re: Whats the difference between Abstract Factory Method Pattern(AFMP) and Factory Method Pattern(FMP)

Posted By:   David_Liu  
Posted On:   Monday, August 5, 2002 06:21 AM

Patterns are a tricky subject. If you only look at patterns as to how it is create, you will notice (like now) that many of the patters are similar. After all, almost every patterns start off with some type of interface or abstract class.


To effectively use the appropriate pattern means that you have to know the intent of what you are trying to do. In the case of Abstract factory vs. Factory method.


Abstract Factory is a tool kit; the usage is when you want to create related objects.


Factory method's purpose is for you to differ your instantiation of a subclass.


From the intent perspective, there is nothing similar about the two. I know this sounds just like another jargon from the GOF book, however, you must realize that using patterns is not something that will come to you overnight. If you read different books, work with people are more fluent in patterns, one day.. BAM! You will get it.

Re: Whats the difference between Abstract Factory Method Pattern(AFMP) and Factory Method Pattern(FMP)

Posted By:   Jason_Stell  
Posted On:   Thursday, August 1, 2002 12:13 PM

Well, I've never heard of the "Abstract Factory Method Pattern". However, there is the Abstract Factory Pattern, which is often implemented using the Factory Method Pattern or, sometimes, using the Prototype Pattern.
About | Sitemap | Contact