Design Patterns - 1
Design Patterns - 1
25
1
Software Re-Engineering
Course Code: SE473
02/08/
25
2
Contents
• Introduction to OO concepts
• Introduction to Design Patterns
• What are Design Patterns?
• Why use Design Patterns?
• Elements of a Design Pattern
• Design Patterns Classification
• Pros/Cons of Design Patterns
• Popular Design Patterns
• Conclusion
3
• References
What are Design Patterns? 4
4
Why use Design Patterns?
Good Design
Maintainability
Extensibility
Scalability
Testability
Reusablilty
Design Patterns
Singleton
Abstract Factory
DAO
Strategy
Decorator
Design Principles
Program to an interface, not an implementation
High cohesion
Low coupling 5
Open-Closed
Separation of concerns
Why use Design Patterns?
Good design
• Maintainability is the ease with which a software system or component can be
modified
• Extensibility is the ability to add new functionality or modify existing features
without significantly changing the core architecture of a system
• Scalability measures how well a system can adjust its performance and cost in
response to changes in processing demands
• Testability refers to the degree of ease with which a software system or
component can be tested
• Reusability is the use of existing software assets, such as code, components, test
suites, designs, and documentation, in the development of new software
6
• Decorator Design Pattern is a structural pattern that allows adding new
functionality to an existing object without altering its original class
Why use Design Patterns?
Design patterns
• Singleton Design Pattern ensures a class has only one instance and provides a
global access point to it. It's ideal for scenarios requiring centralized control,
like managing database connections or configuration settings, in the
development of new software
• Abstract factory pattern in software engineering is a design pattern that provides a
way to create families of related objects without imposing their concrete classes
• DAO (Data Access Object) design pattern is a structural pattern that aims to isolate
the logic for accessing and manipulating data from a database (or other persistence
mechanism) from the application's primary business logic
• Strategy design pattern is a behavioral design pattern often employed in software
engineering to enable the selection of algorithms at runtime 7
Why use Design Patterns?
Design principals
• Programming to an interface means that your code should depend on the
abstraction of a behavior rather than a specific implementation of that behavior
• high cohesion aim to create modular, maintainable, and flexible code by ensuring
that individual components within a module are closely related and focused on a
single task
• low coupling is minimizing dependencies between different modules
• Open-Closed Principle (OCP) states that software entities (classes, modules,
functions) should be "open for extension, but closed for modification
• Separation of Concerns (SoC) dividing a software application into distinct sections,
where each section is responsible for a specific, well-defined "concern"
(functionality or responsibility), minimizing overlap between different parts of the 8