Now I have a question not closely related with java,but I hope someone could give me advice:
there are two simaliar creation pattern,say "abstract factory"&"factory method".I think they all contain two kinds of classes:
"creating class" used to create
"created class" used to be created
both need to be inherited to concrete class.
and only the "concrete creating class" could create "concrete created class"
I know the dipiction is clumsy.But hope to find the difference of them.
thanks a lot
The abstract factory pattern is one level of abstraction higher than the factory method pattern. The abstract factory can be thought of as implementing using the factory method pattern. The abstract factory is a factory object that returns one of several groups of classes. Example: A system supporting multiple look-and-feel interfaces like windows or motif. You make the call to tell that your program should like windows and it returns a GUI factory that returns windows-like objects.
The factory method pattern can be thought of as a pattern where a superclass defers the decision of instantiating to each subclass. In other words, a class uses its subclasses to specify which objects it creates.