Structural Patterns: Decorator Facade
Structural Patterns: Decorator Facade
Structural Patterns: Decorator Facade
Structural Patterns
Decorator
Facade
Structural patterns
2
Structural Patterns
3
Adapter:
Translator adapts a server interface for a client
Bridge:
Abstraction for binding one of many implementations
Composite:
Structure for building recursive aggregations
Decorator:
Decorator extends an object transparently
Facade:
Simplifies the interface for a subsystem
Flyweight:
Many fine-grained objects shared efficiently.
Proxy:
One object approximates another
Decorator Pattern
Decorator pattern
5
Intent
6
Structure
7
Participants
8
Consequences
9
Good:
Bad:
Example
10
we will decorate a shape with some color without alter shape class.
Sample cod
e
Example
create a Shape interface and concrete
11
12
Faade Pattern
Faade
13
Intent
Provide a unified interface to a set of interfaces in a subsystem.
Faade defines a higher-level interface that makes the subsystem easier to
use.
Applicability
Intent
14
Faade
15
Participants
Faade
Subsystem classes
Collaborations
Facade pattern
16
Implementation
17
Example
18
Sample Co
de
19