A proxy functions as an interface to something else. Proxy can interface to a network connection, complex object, file etc. The operations performed on proxy is forwarded to the original object it can also provide additional functionality if required.
Types of proxies,
Whereas proxy is creating a interface on top of another interface or a class to get access. Both may look same but serves two different purposes. Adapter is like having multiple proxy classes for each interface.
Both uses wrapper classes but serves different purposes.
Wikipedia
https://sourcemaking.com/design_patterns/proxy
Types of proxies,
- Virtual proxy : placeholder for expensive to create objects. The real object created only when client accesses it
- Remote proxy: local representative to an object resides somewhere else
- Protective proxy: Controls access to master object
Difference with Adapter Pattern
Adapter pattern allows unrelated interfaces to work together by adapting to a common interface which again implemented by Adapter classes. This adapter class will contain a property for each unrelated interface.Whereas proxy is creating a interface on top of another interface or a class to get access. Both may look same but serves two different purposes. Adapter is like having multiple proxy classes for each interface.
Both uses wrapper classes but serves different purposes.
Wikipedia
https://sourcemaking.com/design_patterns/proxy
0 comments:
Post a Comment