Design Pattern Proxy Versus Chain of Responsibility

Connect with

Design Pattern: Proxy Versus Chain of ResponsibilityLearn Design Pattern: Proxy Versus Chain of Responsibility. These two design pattern seems similarity somewhere or others. Structurally both are same but intent of both are different.

1. Proxy Design Pattern

control Access to it.

What is proxy?
Let me explain the similarity and differences of chain of responsibility vs proxy. For more details, visit Proxy Design pattern
It’s an intermediary between a client object and the target object. responsibility wise, It receives a call from client object and forwards them to the target Object.

2. Chain of Responsibility

allows an object to send a command without knowing what object will receive and handle it.

The Chain of Responsibility (CoR) design pattern allows an object to send a command without knowing what object will receive and handle it. The request is sent from one object to another making them parts of a chain and each object in this chain can handle the command, pass it on or do both.

The example of Chain of Responsibility is Filter Interceptor in core J2EE design pattern. In the Filter, there is a chain and no one knows about another if any filter does not fulfilled then request to the next filter if fulfilled then return from the same filter to the caller. There could be a possibility that no one fulfilled the request. Another example of approval of Purchase Order in workflow by Manager, Sr. Manager, Director, AVP, VP, COO etc.. Every person has a limit to approve if the limit exceeds, send a request to the next in the workflow.

3. Key Points Proxy versus Chain of Responsibility

I tried to cover the key difference between proxy and Chain of Responsibility (CoR) design patterns.

  • Proxy represents a single object while Chain of Responsibility can have many objects.
  • Proxy first received the request from the client but never processed by the proxy object, while in Chain of Responsibility it processes by the target object. In the Chain of Responsibility, an object that received the client request could process the request first.
  • Proxy always forward client request to target object while in CoR forward the request in the chain only current object can not process the request.
  • In Proxy response to the request guaranteed provided communication link between client and server location working while in CoR Response to request is not guaranteed. It means the request might reach the end of the chain but the request could not be processed.

Reference

Wiki pag for Proxy design pattern

I hope you enjoyed this post of proxy vs chain of responsibility design patterns, and you can visit design patterns tutorial for more details

Please write your comment to improve this post. Happy learning 🙂


Connect with

12 thoughts on “Design Pattern Proxy Versus Chain of Responsibility”

  1. Silicone Wristbands

    I have been rowsing online more thqn 3 hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my view, if all site
    owners and bloggers made goood content as you did, the net will
    be a lot more useful than ever before.|
    I couldn’t refrain from commenting. Well written!|

  2. www.siliwristband.com

    It is pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as
    you did, the net will be much more useful than ever before.|
    I couldn’t resist commenting. Perfectly written!

  3. I have beesn browsing online more than 3 hours today, yet I never found any
    interesting article like yours. It’s pretty worth enough for me.

  4. I’ve been surfing online more han three hours today, yet I never
    found any ihteresting article like yours. It’s pretty worth enough for me.
    In my opinion, iif all website owners and bloggers made good content as you did, the internet will be a loot more
    useful than ever before.|
    I couldn’tresist commenting. Perfectly written!

  5. customized rubber bracelets

    I have been surfing online more than 2 hours today, yet I never found any interesting
    article like yours. It’s pretty worth enouygh for me.
    Personally, if all site owners and bloggers made good content as you did,
    the internet will be much more useful than evr before.|
    I could not refrain from commenting. Very ell written!|

  6. I have been beowsing onlinne more than three
    hours today, yet I never found any interesting article like yours.
    It is pretty wrth enough for me. Personally, if all web owners aand bloggers made gpod content as youu did, the web will
    be much more useful than ever before.|
    I could not refrain from commenting. Very well written!

  7. Shopping Trolley Coin Keyring

    I have been browsing online more than 2 hours today, yett I never found any nteresting article like yours.

  8. I’ve been surfing online more than 2 hojrs today, yet I never found any interesting article like yours.
    It is pretty worth enough for me.
    I couldn’t refrain from commenting. Perfectly written!
    I will immediately grab your rss as I can not find
    your e-mail subscription link oor e-newsletter service. Do you’ve any? Kindly let me
    recognize so that I may subscribe. Thanks.

  9. I am no more sure where you’re getting your information, but good topic.
    I must spend a little while learning a lot more or exercising more.
    Thanks for magnificent information I found myself searching for this info for my mission.

  10. First of all I want to say fantastic blog! I had a quick question that I’d like to ask
    if you don’t mind. I was curious to know how
    you center yourself and clear your mind prior to writing.

    I’ve had trouble clearing my thoughts in getting
    my thoughts out there. I truly do enjoy writing but it
    just seems like the first 10 to 15 minutes are generally wasted just trying to figure out how to begin. Any ideas or hints?
    Thanks!

Leave a Comment

Your email address will not be published. Required fields are marked *