Sadp Unit 4
Sadp Unit 4
Sadp Unit 4
DESIGN PATTERNS
SYLLABUS
1. Patterns
2. Pattern Description
3. Organizing catalogs
4. Role in solving design problem
5. Selection and Usage
6. Creational and Structural patterns
CREATIONAL PATTERNS
1. Abstract Factory
2. Builder
3. Factory method
4. Prototype
5. Singleton
STRUCTURAL PATTERNS
6. Adaptor
7. Bridge
8. Composite
9. Decorator
10. Façade
11. Flyweight
(Proxy)- 23
BEHAVIORAL PATTERNS
12. Chain of Responsibility
13. Command
14. Interpreter
15. Iterator
16. Mediator
17. Memento
18.Observer
19. State
20. Strategy
21.Template method
22.Visitor
DESIGN PATTERN
DEFINITION
"Each pattern describes a problem which occurs over and over
again in our environment, and then describes the core of the
solution to that problem, in such a way that you can use this
solution a million times over, without ever doing it the same way
twice"
IN GENERAL, A PATTERN HAS
FOUR ESSENTIAL ELEMENTS:
1.The pattern name is a handle we can use to describe a design problem,
its solutions, and consequences in a word or two. Naming a pattern
immediately increases our design vocabulary. It lets us design at a higher
level of abstraction. Having a vocabulary for patterns lets us talk about them
with our colleagues, in our documentation, and even to ourselves. It makes it
easier to think about designs and to communicate them and their trade-offs
to others. Finding good names has been one of the hardest parts of
developing our catalog.
2. The problem describes when to apply the pattern. It explains the
problem and its context. It might describe specific design problems such as
how to represent algorithms as objects. It might describe class or object
structures that are symptomatic of an inflexible design. Sometimes the
problem will include a list of conditions that must be met before it makes
sense to apply the pattern.
3. The solution describes the elements that make up the design,
their relationships, responsibilities, and collaborations. The solution
doesn't describe a particular concrete design or implementation,
because a pattern is like a template that can be applied in many
different situations. Instead, the pattern provides an abstract
description of a design problem and how a general arrangement of
elements (classes and objects in our case) solves it.
Singleton Ensure a class only has one instance, and provide a global point
of access to it.
CATALOG OF STRUCTURAL
PATTERNS
HOW DESIGN PATTERNS
SOLVE DESIGN PROBLEMS
Finding Appropriate Objects