Professional Documents
Culture Documents
CSE 425: Software Design and Pattern: Section 2
CSE 425: Software Design and Pattern: Section 2
Singleton:
Abstract Factory:
Builder
• Separates object construction from its representation.
• Separate the construction of a complex object from its
representation.
• Provides control over steps of construction process.
Structure of Builder Pattern:
1. Builder:
Specifies an abstract interface for creating parts
of a Product object.
2. Concrete Builder:
Constructs and assembles parts of the product
by implementing the Builder interface.
3. Director:
Constructs an object using the Builder interface
4. Product:
Represents the complex object under
construction.
Abstract Factory vs Builder:
• Builder focuses on constructing a complex object step by
step. Abstract Factory focuses on constructing a family of
product objects.
• Builder focus on building one Complex product. Abstract
factory focus on building many different types of families
to build many products.
Prototype
• Allows an object to create customized objects without
knowing their class or any details of how to create them.
• The concept is to copy an existing object rather than
creating a new instance from scratch, something that may
include costly operations.
• The newly copied object may change same properties only
if required.
Type of Clone:
1. Shallow Clone:
Shallow copy copies an object’s value type fields into
the target object and the object’s reference types are
copied as references into the target object.
2.Deep Clone:
A deep copy copies an object’s value and reference
types into a complete new copy of the target objects.
Question 1: