8 - Creational Design Pattern
8 - Creational Design Pattern
Mohsin Bilal
Design patterns
• design pattern:
A standard solution to a common software problem in a
context.
• describes a recurring software structure or idiom
• is abstract from any particular programming language
• identifies classes and their roles in the solution to a problem
• Each generated factory can give the objects as per the Factory pattern.
Abstract Factory: Participants
• AbstractFactory
Declares an interface for operations that create
abstract products
• ConcreteFactory
Implements the operations to create concrete
product objects: usually
instantiated as a Singleton
• AbstractProduct
Declares an interface for a type of product
object; Concrete Factories produce the concrete
products
• ConcreteProduct
Defines a product object to be created by the
corresponding concrete factory
Implementation
1. Create a Shape interface