3. Table of Contents
Design Patterns
Why Design Patterns
Design Pattern: Usage
The Concept OF Patterns Construction Architecture Patterns
Design Pattern: Essential Elements
GoF Design Patterns
8/29/2021
3
4. Design Patterns
1. It describes a general usable solution to a recurring problem in an environment
2. It describes core of solution in a procedural-like structure
3. It isn’t a finished design that can be transformed directly into code, but a description or
template for how to solve a problem that can be used in many different situations
4. Design patterns are “descriptions of communicating objects and classes that are
customized to solve a general design problem in a particular context.”
8/29/2021
4
5. Why Design Patterns?
1. Simplifies object identification
2. Simplifies system decomposition
3. Proven & tested technique for problem solving
4. Improves speed & quality of design / implementation
5. Can be adapted / refined for specific system under construction.
8/29/2021
5
6. Design Patterns: Usage
Design patterns:
• Provide general solutions, documented in a format that doesn’t require specifics tied to a
particular problem
• Can speed up the development process by providing tested, proven development
paradigms
• Help you benefit from the experience of fellow developers
• Prevent subtle issues that can cause major problems
• Improve code readability for coders and architects familiar with them
8/29/2021
6
7. THE CONCEPT OF PATTERNS Construction Architecture
Patterns
The first idea of using patterns was for building and proposed by the architect Christopher
Alexander.
He found recurring themes in architecture, and captured them into descriptions
He called them patterns.
The term 'pattern' appeals to the replicated similarity in a design
The similarity makes room for variability and customization in each of the elements
8/29/2021
7
8. Cont…
Alexander defines: «Each pattern is a three part rule which express a relation between a
certain context, a problem and a solution.
Each pattern is a relationship between
A certain context,
A certain system of forces which occurs repeatedly in that context
A certain spatial configuration which allows these forces to resolve themselves.
A pattern is an instruction and shows how this configuration can be used over and over
again.
The pattern is a thing that happens in the world
The rule which tell us how to create that thing and when we must create it.
8/29/2021
8
9. Design Patterns: Essential Elements
A pattern has four essential elements:
The pattern name that we use to describe a design problem
The problem that describes when to apply the pattern
The solution that describes the elements that make up the design
The consequences that are the results and trade-offs of applying the pattern
8/29/2021
9
10. GoF Design Patterns
The Gang of Four are the four authors of the book « Design Patterns: Elements of
Reusable Object-Oriented Software »
Defined 23 design patterns for recurrent design issues, called GoF design patterns
Classified by purpose:
Structural : Concerns the composition of classes and objects
Behavioral : Characterizes the interaction and responsibility of objects and classes
Creational : Concerns the creation process of objects and classes
… and by scope:
Class scope: relationship between classes and subclasses, defined statically
Object scope: object relationships, dynamic
8/29/2021
10