DESIGN PATTERNS TASK:
Describe the following software design pattern: Abstract Factory
In this sample we will provide a description of Abstract Factory software design pattern. First of all, it deals with objects know as “factories”, which is (in terms of object-oriented programming) an object used for creating other objects.
What Abstract Factory pattern does is: providing an encapsulation to a group of individual factory objects. The classes of such factory objects would not be specified (hence Abstract), but they must still have something in common in order to justify being encapsulated together. This construction typically allows the user to create concrete objects for his own needs by using generic interface provided by Abstract Factory.
Once everything is set, the user (which may happen to not be the initial author of the code, but rather the client) may care little about what’s inside the initial Abstract Factory class, which ones of internal factory objects are used, and how everything works in the first place. In other words, client’s code is insulated from Abstract Factory code and object creation process.
In this class diagram, we can see that the client refers to a pair of interfaces called GUIFactory and Button, forcing the Abstract Factory to use appropriate concrete factories (encapsulated inside Abstract Factory) in order to create concrete objects (WinButton or OSXButton respectively), to which Abstract Factor returns abstract pointers the client can use to access them.
The design patterns assignment sample was completed by one of AssignmentShark experts. If you have any questions, or need your similar project to be completed, contact us any convenient way for you. Any time, any difficulty level, any discipline!