Proxy - what code (and where) translates ProxyService into RealService calls? Why/when use this? Layers - how to implement? Memento - why not just persist state to a cache or file?
My understanding of the Proxy pattern is that you have some kind of Service
interface that has ProxyService
and RealService
concretions. For some reason, you can't access the RealService
, so you code against a ProxyService
instance and then let the framework link the proxy to the real instance of your service. Only two problems:
- I can't think of a single example when I would have access to
Service
andProxyService
, but notRealService
- can someone provide examples as to when this could happen?
How is this different from the Memento pattern? My understanding of Memento's definition is that it is used for saving an object state, which is what a Proxy is really doing, yes? If not please explain how Memento is different than Proxy! Thanks in advance!