Pattern | What & When |
Decorator |
You have:
- An existing component class that may be unavailable for subclassing
You wants:
- Attach additional state and behavior to an object dynamically.
- Make changes to some objects in a class without affecting others.
- Avoid subclassing because too many classes could result.
|
******************
Proxy |
- It Supports objects that control the creation of and access to other objects
- In Proxy pattern, a class represents functionality of another class.
You have:
- Are expensive to create
- Need access control
- Access remote sites.
- Need to perform some actions when they are accessed.
You wants:
- Create objects when their operations are requested.
- Perform checks on objects whenever accessed.
- Have a local objects that will refers to a remote object.
- Implement access rights on objects as their operation are requested.
|
******************
Bridge |
- It decouples an abstraction from its implementation, enabling them to vary independently.
You have:
- Identify that there are operations that do not always need to be implemented in the same way.
You wants:
- Completely hide implementation from client.
- Combine different part of system at runtime.
|
|