A Factory pattern is one that returns an instance of one of several possible classes depending on the data provided to it.
Usually all of the classes it returns have a common parent class and common
methods, but each of them performs a task differently and is optimized for
different kinds of data.
There are several similar variations on the factory pattern:
1. The base class is abstract and the pattern must return a complete working
2. The base class contains default methods and is only subclassed for cases
where the default methods are insufficient.
3. Parameters are passed to the factory telling it which of several class types to return. In this case the classes may share the same method names but may do something quite different.
Abstract Factory Pattern:
The Abstract Factory pattern is one level of abstraction higher than
the factory pattern. You can use this pattern when you want to return one of
several related classes of objects, each of which can return several different objects on request. In other words, the Abstract Factory is a factory object that returns one of several factories.
James Cooper's book is a good one on Design Patterns with examples in Java: http://www.patterndepot.com/put/8/JavaPatterns.htm