Software Design and Architecture [Creational Design Patterns] – Chapter…
Software Design and Architecture
[Creational Design Patterns] – Chapter 06
Sara Al-Habashi ^_^
Recurring solutions to
design problems in a certain context.
Provide interface for creating families of related objects without specifying their concrete classes.
Components Separate concrete products, easy reuse.
Promote consistency within product families
Minimize complexity when future change.
Manage/encapsulated set of objects conceptually belong together/represent specific family of products.
Different product objects at once.
Many classes required.
Abstract/Control object creation way in software applications by specifying common creational interface.
The Factory Method.
The Abstract Factory.
: structure creation from existing ones.
: classes interaction, behavior variation, object responsibility assignment.
: object creations.
: during design time.
: during run time.
ensure a class has one instance, with global point of access to it.
Controlled access to single instance of given type
Customized to allow multiple instances
prevent multiple object instantiation in a running program.
Doesn't work well in multithreading environments.
The Factory Method.
Define interface for creating object, but subclasses decide which to instantiate.
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.
encapsulate/defer object instantiation to derived subclasses.
Separate complex object construction from its representation, same construction process, different representation
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.
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.