I was looking at the Proxy Pattern, and to me it seems an awful lot like the Decorator, Adapter, and Bridge patterns. Am I misunderstanding something? What's the difference? Why would I use the Proxy pattern versus the others? How have you used them in the past in real world projects?
相关问题
- Name for a method that has only side effects
- What is a correct approach to manage test data usi
- Can a [GoF]-ConcreteSubject override the notify me
- Qt Webkit Bridge: C++ access to JavaScript
- Can the builder pattern ever be doing too much?
相关文章
- Builders in Java versus C++?
- Can the staticmethod and classmethod decoraters be
- Class decorators in ES7
- “Adapter” or “adaptor”?
- Is copy-and-paste coding ever acceptable?
- How to Create a Custom tabBarController to simulat
- Error building angular+ngrx 8 for production when
- Dependency Injection Container
All good answers from experts have already explained what does each pattern stands for.
I will decorate key points.
Decorator:
e.g. (with chaining ) :
java.io
package classes related toInputStream
&OutputStream
interfacesProxy:
e.g.:
java.rmi
package classes.Adapter:
e.g.
java.io.InputStreamReader
(InputStream
returns aReader
)Bridge:
e.g. Collection classes in
java.util
.List
implemented byArrayList
.Key notes:
Have a look at great SE questions/articles regarding examples of various design patterns
When to Use the Decorator Pattern?
When do you use the Bridge Pattern? How is it different from Adapter pattern?
Differences between Proxy and Decorator Pattern