Please enable JavaScript.
Coggle requires JavaScript to display documents.
Software Design and Architecture [Creational Design Patterns] – Chapter…
Software Design and Architecture
[Creational Design Patterns] – Chapter 06
Sara Al-Habashi ^_^
Design Patterns:
Recurring solutions to
object-oriented
design problems in a certain context.
Abstract Factory:
INTENT:
Provide interface for creating families of related objects without specifying their concrete classes.
PROS:
Components Separate concrete products, easy reuse.
Promote consistency within product families
Obeys OCP.
Minimize complexity when future change.
DEFINITION:
Manage/encapsulated set of objects conceptually belong together/represent specific family of products.
Different product objects at once.
CONS:
Many classes required.
SCOPE:
Object creational
COMPONENTS:
Creator Class(es).
Product Class(es).
Creational
Design Patterns:
Abstract/Control object creation way in software applications by specifying common creational interface.
The Factory Method.
The Builder.
The Abstract Factory.
The Singleton.
Design Pattern
Classification
:
a-
Purpose
:
ii-
Structural
: structure creation from existing ones.
iii-
Behavioral
: classes interaction, behavior variation, object responsibility assignment.
i-
Creational
: object creations.
b-
Scope
(applies to):
i-
Classes
: during design time.
ii-
Objects
: during run time.
The Singleton.
INTENT:
ensure a class has one instance, with global point of access to it.
PRO:
Controlled access to single instance of given type
Customized to allow multiple instances
DEFINITION:
prevent multiple object instantiation in a running program.
CONS:
Doesn't work well in multithreading environments.
SCOPE:
Object creational
COMPONENTS:
Creator Class(es).
Product Class(es).
The Factory Method.
INTENT:
Define interface for creating object, but subclasses decide which to instantiate.
PROS:
Separate code from product-specific classes, code works with existing/new product classes.
Different developers work on different parts same time, efficient.
Easy reuse/maintain specific parts.
Improve testability
DEFINITION:
encapsulate/defer object instantiation to derived subclasses.
COMPONENTS:
Creator Class(es).
Product Class(es).
SCOPE:
Class creational.
The Builder.
INTENT:
Separate complex object construction from its representation, same construction process, different representation
PROS:
Separate object construction from representation, easy to add future representations.
Change representation without modifying creational process code.
Finer control over construction process, object parts created at discrete points in time.
Maintainable, testable, reusable.
DEFINITION:
Encapsulate creational process & representation of product objects.
Client controls (multi-step) creational process of single product object.
Builder dictates creation of individual parts of object at discrete points throughout software operations.
COMPONENTS:
Creator Class(es).
Product Class(es).
SCOPE:
Object creational.