Download presentation
Presentation is loading. Please wait.
Published byClifford Elliott Modified over 9 years ago
1
Design Pattern
2
The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
3
The Observer Pattern
4
The Decorator Pattern Also known as Wrapper The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
5
The Decorator Pattern Wrapper could be achieved by the following sequence of steps: 1.Subclass the original "Component" class into a "Decorator" class (see UML diagram); 2.In the Decorator class, add a Component pointer as a field; 3.Pass a Component to the Decorator constructor to initialize the Component pointer; 4.In the Decorator class, redirect all "Component" methods to the "Component" pointer; and 5.In the ConcreteDecorator class, override any Component method(s) whose behavior needs to be modified.
6
The Decorator Pattern
7
The Factory Method Pattern The Factory Method Pattern defines an interface for creating an object, but lots subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
8
The Factory Method Pattern
9
The Abstract Factory Pattern The Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.
10
The Abstract Factory Pattern
11
The Singleton Pattern The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it.
12
The Singleton Pattern
13
The Command Pattern The Command Pattern encapsulates a request as an object, thereby letting you parameterize other objects with different request, queue or log requests, and support undoable operations.
14
The Command Pattern
15
The Adapter Pattern The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
16
The Adapter Pattern
17
The Fecade Pattern The Fecade Pattern provides a unified interface to a set of interfaces in a subsystem. Fecade defines a higherlevel interface that makes the subsystem easier to use.
18
The Fecade Pattern
19
Thanks for your attention
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.