• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about Proxy pattern

 
air lulu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
143You are currently designing your own Desktop Publishing application, as you have not found any that do exactly what you want with existing applications. As part of the design you are using a Controller to which you send all GUI requests. Not all objects can process the same commands. For example you can't select the spell check tool when an image has the focus. To stop any possible errors you would like to filter out some of the messages as they are passed from these objects to the Controller object. What pattern could you use?

AFirewall
BProxy
CAdapter
DObserver
EChain of Responsibility
FFilter

Choice B is correct.

but i prefer E. what about you?
 
Cleuton Sampaio
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

IMO you could use both, but there is a subtle difference here. Chain-of-responsability is best applied in situations where you may want to add or re-organize request filters. A proxy controls access to other component, in this case the controller, so Proxy is the best answer, but not the only one.
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ya,

I think the key bit of the question is
To stop any possible errors you would like to filter out some of the messages as they are passed from these objects to the Controller object[/
QUOTE]

The only mentioned pattern that fits this in accordance with the GOF book (Design Patterns) is the Proxy pattern.

The Chain of Responsibility pattern essentially passes a command along a chain until it finds something that can process the command. This doesn't fit with the requirement of filtering out messages.

Matt
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic