- For each logic unit, provide an interface that's used for later interaction. Different styles of implementations are subclasses of this interface.
- Create an interface for creating semantic products (units). Different styles are also implementation of this interface. However each subclass provides fully-functioned interface for creating all products in this style.
What are its advantages and disadvantages?
- If we want to add another style, the current framework can still be used without a change since the interface is fixed.
- If we want to add another logic/semantic unit, we have to add a function to the interface of Abstract Factory and implements all the styles of this logic/semantic unit. Thus it is a little difficult!
- Sometimes, there should be only one factory. Hence a singleton should be incorporated with it.
No comments:
Post a Comment