SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 31 of 31
  1. #26
    SitePoint Addict been's Avatar
    Join Date
    May 2002
    Location
    Gent, Belgium
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    Perhaps the name of those wooden dolls from Russia that you keep finding more little dolls inside would be appropriate.
    "Matryoshka"
    Per
    Everything
    works on a PowerPoint slide

  2. #27
    SitePoint Guru dagfinn's Avatar
    Join Date
    Jan 2004
    Location
    Oslo, Norway
    Posts
    894
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Request/response processor?
    Dagfinn Reiersøl
    PHP in Action / Blog / Twitter
    "Making the impossible possible, the possible easy,
    and the easy elegant"
    -- Moshe Feldenkrais

  3. #28
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must be psychic. I'm working on an implementation of this idea and that's exactly how it all starts off:

    PHP Code:
     new Response(new Request); 
    ..or at least it would do if I wasn't getting some wierd referencing issues which are forcing me to declare vars first.

  4. #29
    SitePoint Guru dagfinn's Avatar
    Join Date
    Jan 2004
    Location
    Oslo, Norway
    Posts
    894
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by McGruff
    That's the strict GoF CoR. It's also often used more loosely ie where several - or all - of the items on the chain are executed.

    Either way I think it's important to be clear that this is not a heavy pattern to implement. It works very well in php anywhere you might have loosely-coupled objects to stick in a chain (Observer can sometimes be an alternative option).

    PS: it's probably also best if there aren't a huge number of handlers in the chain.
    I was just thinking...how much difference is there between this "modified Chain of Responsibility" and Subject-Observer? Modified CoR lets several objects handle a request passed to the chain, Subject-Observer lets several observers or listeners handle an event they're notified of. There are some implementation differences, but these differences are probably less crucial than the conceptual similarity.
    Dagfinn Reiersøl
    PHP in Action / Blog / Twitter
    "Making the impossible possible, the possible easy,
    and the easy elegant"
    -- Moshe Feldenkrais

  5. #30
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    TEH INTERWEBS
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have nothing to add except that I am so confused by this thread.

  6. #31
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dagfinn
    how much difference is there between this "modified Chain of Responsibility" and Subject-Observer?
    The GoF chain is kind of like a switch/case but, provided you remove all the decision-making, it's hard to see any differences between this pattern and Observer.

    Observer could decide on program flow if the observers also observe each other (a while back I wrote a controller which worked like that and it was just as hideous as it sounds). A chain of responsibility is a much better fit for situations where only one object should ever be active (for example, only one web page is served for any http request).

    Thinking out loud, observer/observables might possibly be useful if you needed to pass messages between observers. Or maybe that's a smell.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •