Factory method pattern:
The intent of Factory method pattern is to let a class developer define the interface for creating an object while retaining control of which class to instantiate.

What is:
Factory method pattern

Example:
1. AppLab’s Factory method pattern

2. Bob Tarr’s Factory method pattern

3. Principles, Patterns, and Practices: The Factory Pattern

4. Core J2EE Patterns – Data Access Object

Summary:
You might think that any method that creates and returns a new object is a “factory method”. However, methods that return new objects are common, and not every such method is an Factory method pattern.
The fact that Factory method is an operation that both creates an object and isolates a client from knowing which class to instantiate.In Factory method, you will find several classes that implement the same operation, returning the same abstract type but internally instantiating different classes that implement the type.

###

Abstract Factory pattern:
The intent of Abstract Factory method pattern is to allow the creation of families of related or dependent objects.

What is:

Abstract Factory pattern

Summary:

As with Factory method, Abstract Factory isolates client from knowing which class to instantiate. Abstract Factory lets you provide a client with a factory that produces objects that are related by a common theme.

Advertisements