Abstract Factory patterns effort about a super-factory which creates other factories. This factory is also called as factory of factories. This kind of design pattern comes below creational pattern as this pattern provides single of the best ways to create an entity.
In Abstract Factory pattern a line is accountable for creating a factory of related objects without openly specifies their classes. Each generated factory can give the substance as per the Factory pattern.
We are available to create a form and Colour interfaces and real classes implementing these interfaces. We make an abstract factory class summary Factory as after that step. Factory classes Shape Factory and ColorFactoryare define where each factory extends Abstract Factory. A factory creator/generator class Factory creator is created.
AbstractFactoryPatternDemo, our presentation class uses Factory maker to get an Abstract Factory object. It will pass information (CIRCLE / RECTANGLE / SQUARE for Shape) to Abstract Factory to get the form of entity it needs. It also passes in order (RED / GREEN / BLUE for Colour) to Abstract Factory to get the kind of object it requirements.
Make an interface for Shapes.
Create existing classes implementing the similar interface.
Create an interface for Colours.
Generate concrete classes implement the same interface.
Generate an Abstract class to get factories for Colour and Shape Objects.
Construct Factory classes extending Abstract Factory to generate entity of real class based on known in order.
Create a works creator/producer class to get factories by passing in sequence such as form or Colour.
Use the Factory maker to get Abstract Factory in direct to get factories of real classes by transient information such as form.
Verify the output.
Design Patterns Related Interview Questions
|Java Script Interview Questions||AJAX Interview Questions|
|Graphic Design Interview Questions||Adobe Indesign Interview Questions|
|Java-Multithreading Interview Questions||Database Design Interview Questions|
|Compiler Design Interview Questions||CSS Advanced Interview Questions|
|Java Design Patterns Interview Questions||Hardware design Interview Questions|
|Material Design Lite Interview Questions||Object Oriented Analysis and Design Interview Questions|
|Standard Template Library (STL) Interview Questions|
Design Patterns Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.