Questions tagged [chain-of-responsibility]

Design pattern consisting of a source of command objects and a series of processing objects. One of the Gang of Four's behavioral design patterns.

Design pattern consisting of a source of command objects and a series of processing objects. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain. A mechanism also exists for adding new processing objects to the end of this chain.

This is one of the Gang of Four's behavioral , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

More information is available on Wikipedia.

160 questions
0
votes
1 answer

chain of responsibility and generics

I have a chain of responsibility that applies filters to a collection. I am trying to make a factory to build that chain of responsibility from a configuration. My concrete types for the chain arent generic but their abstraction are, and the…
FooBar
  • 132
  • 1
  • 9
0
votes
0 answers

changing id in chain of responsibility c++ Qt

I have to do an online game but i'm experimenting some trouble with my chain of responsibility. The point is that the "int level" a every step of my chain is changing. I mount up the chain in a TcpClient class contructor, every thing work fine when…
BJauss
  • 1
  • 1
0
votes
1 answer

CoR vs simple if else and matrix based functional calls where the chain is request dependent

I have used Handlers mapping along with if else conditional construct to handle chains which are request dependent. Request r(TYPE1, ACTIVE); std::vector mapping; mapping[TYPE1][PENDING] = myHandlerA(); // ... and so…
cryptickey
  • 169
  • 8
0
votes
1 answer

How to implement chain of responsibility with Java Swing

I have the task of creating a simple drawing app, where one can draw basic shapes (ovals,lines,rectangles) with border and fill colors of choice, using Java Swing and MVC. The shapes part of the model is implemented using the composite pattern. The…
J.Dow
  • 103
  • 9
0
votes
1 answer

Implement chain of responsibility in StructureMap

Imagine I implement the chain of responsibility design pattern in the following classes; interface IDoStuff { IDoStuff Next {get;} void Configure(); } class StepOne { public IDoStuff Next {get; set} public StepOne(IDoStuff next) { …
Steztric
  • 2,832
  • 2
  • 24
  • 43
0
votes
0 answers

Is it possible to handle convergence in chain of responsibility implementation?

I want to implement fan out and convergence in handlers in my implementation. What is best practice to handle such instances. e.g. handler1->handler2,handler3 handler2->handler4 handler3->handler4 handler4->handler5 //this should be executed only…
0
votes
0 answers

What is a good way to maintain/pass state across in "Chain of Responsibility" pattern?

For any chaining implementation for puposes like piping (similar to Java servlet filter chain), if I need to, how do I pass context between filters?/steps? Also, does it violate the design principle because now I am introducing states and coupling…
BenhurCD
  • 81
  • 1
  • 12
0
votes
1 answer

Singleton & "sequential execution" design patterns

I'm implementing a game library for mobile using Singleton design pattern as below Game.initialize("game_id") .downloadMap() .showMap() .setAutoAdjustMapResolution(true) I have no problem with Singleton & Builder design pattern but my problem…
Uni
  • 187
  • 2
  • 7
  • 18
0
votes
0 answers

How to inject multiple different dependencies using Unity IoC in Chain-Of-Responsibility pattern?

I am working on a project where I am using Unity, DI. Also I use COR (Chain of Responsibility) pattern which my application demands. I ran into an issue and got stuck with DI. I am hoping someone would shed some light. public interface…
0
votes
2 answers

Does spring boot provide an implementation of 'chain of responsibility pattern'

Does spring boot provides an implementation of 'chain of responsibility pattern'. Something like the pipeline (request pipeline or a commerce pipeline ) .Where we can have the components involved added or removed based on configuration changes.
Philip
  • 13
  • 4
0
votes
2 answers

Inverted pipeline/chain of responsibility pattern

I am wondering whether there is an establish pattern to control the flow that my application will have. Simply put, it's supposed to be something like that: User provides a file File is being processed User receives a processed file There will be…
Bartosz
  • 4,406
  • 7
  • 41
  • 80
0
votes
1 answer

How to build chain of responsibility using constructor for initializing next chains?

How to build a chain of responsibility using constructor for initializing chains. Here is my Runner.class where i'm building my chain using setNext method. public class Runner { private static final String ENTER_PATH = "Enter path: "; private…
Serg Shapoval
  • 707
  • 1
  • 11
  • 39
0
votes
0 answers

can chain of responsibility have a predecessor

can Chain of Responsibility have a predessesor or there should be only successor in chain. I mean that if we need to call previous objects in chain. Is it possible. As much as I have seen online there are only successor. Will setting up a…
ela
  • 67
  • 1
  • 1
  • 6
0
votes
1 answer

Design Pattern for executing requests on different "output levels"

I am parsing a string like: \read(customer) hello world ~> \method(arg, arg, ...) into a composite data structure that persists of 1 to n arguments, which are requestLeaf objects, which arguments can be a requestLeaf object (if it's just plain…
0
votes
0 answers

A condition on an argument used in multiple calls of a method: enforced by caller or by the method?

Let's assume I have an object a of a class A. It has a method that needs an argument in form of another object of a particular type - but the argument should also be in particular state, because the operation performed by the method (let's say it's…
vikingr
  • 103
  • 2
  • 7