Summary on basis of the book ,,Design Patterns: Elements of Reusable Object-Oriented Software'', by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Addison-Wesley, 1995.
Proxy pretends being an object when in fact it's not. There are several types of proxies:
** "copy-on-write" method - we have same proxy object referenced by different classes, when one proxy state changes, it copies itself. in such case we have to remember of counting number of references as not to leave the last proxy not destroyed
Proxy pretends being an object when in fact it's not. There are several types of proxies:
- Remote proxy ("Ambassador") - we have client and server, instead of communicating between server's and client's classes we create a proxy on client side, and a proxy on server side, and only the proxies communicate
- Virtual proxy - creates expensive object on first demand; it can also hold information about the object which is not instantiated yet (e.g. height and width of an image)
- Protection proxy - to control access
- Smart proxy - just an addition to an object, to have more control, e.g. lock/unlock, conuting number of references (to later destroy if no references)
** "copy-on-write" method - we have same proxy object referenced by different classes, when one proxy state changes, it copies itself. in such case we have to remember of counting number of references as not to leave the last proxy not destroyed
Comments
Want to leave a comment? Visit this post's issue page
on GitHub and just post your comment as the issue's comment (you'll need a GitHub account. What? Like you don't have one yet?!).
Comments: