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

usage of Chain of Responsibility

I want to use the pattern Chain of Responsibility to check if a location (Latitude and Longitude) is on a distance. For this purpose I got a boolean which should be true if location is on distance and false if not. Before the pattern - my code…
Dennis
  • 90
  • 12
0
votes
2 answers

Chain of Responsibility

Why I need to use CoR if I could write if-else and instead of passing through multiple handlers I could just find whatever handler I need and delegate the processing to the specific one. I think, CoR is not being used as a pipeline to process the…
Narek
  • 38,779
  • 79
  • 233
  • 389
0
votes
0 answers

Right pattern to be used in situation where some handlers are independent and some handlers depend on other handlers execution

Working on redesigning a system which compute some attributes given input as an object like property. We are using handlers to compute property related attributes. Each handler takes care of computing single property attribute information.…
user3089214
  • 267
  • 3
  • 14
0
votes
1 answer

How to get rid of an explicit cast in a Chain of Responsibility?

I'm currently have an implementation of Chain of Responsibility which return objects that implement IResponse. public interface IRequest { } public interface IResponse { } public interface IFactory { bool CanHandle(IRequest request); …
thalesmello
  • 3,301
  • 3
  • 20
  • 20
0
votes
2 answers

How to decouple input params for different handlers in a filter/chain?

I have a list of filters. Every filter has different responsibility and accepts various input params. The interface looks like this: void doFilter(Context context); and I run it with: void main(){ context.setA(input_for_filter_a); …
Anderson
  • 2,496
  • 1
  • 27
  • 41
0
votes
1 answer

Chain of Responsibility Design Pattern

I want to get an intuitive feeling for Chain of Responsibility pattern. I guess a good way to get that would be to learn about some real world examples. Can you guys share such examples? One of the things about this pattern is that if the chain has…
theD
  • 135
  • 8
0
votes
1 answer

Java ActionListeners to stand-alone classes

Is there any way to move actionListener classes to stand-alone classes? I made an exaple using Java and MVC design pattern. I have 3 buttons that change background color. Here's Model public class ChangeFontColorApplicationModel { public…
0
votes
2 answers

Chain of Responsibility: remainder algorithm?

In the following method I am trying to do the following: If you have at least £20: Work out the number of £20 notes Work out what’s left (remainder) – pass it on to the next handler If you have less that £20 – call the next handler Note: The…
user3287264
0
votes
1 answer

Refactoring and removing if null checks in chain filtering

I'm doing some filtering on database entries and I ended up with somewhat ugly code, which I don't like. I have my MyFilterResolverFactory class where I build and return my MyFilterResolver chain. public abstract class MyFilterResolver { …
ioreskovic
  • 5,531
  • 5
  • 39
  • 70
0
votes
1 answer

Creating a pluggable StrategyFactory with DI

I have an engine that creates strategies for text file processing. These files are in various formats and the engine selects an appropriate strategy by passing the file through a chain of strategies until one of them asserts it can parse it. This…
0
votes
0 answers

Comparing enum for the Chain of Responsibility decending

I have a query about a project im doing. the scenario is that there is a space ship with 4 crew members on it and each crew member can handle a certain type of malfunction on the ship, the 4 crew members are: Space Monkey - he can handle TRIVIAL…
Jordan Atkinson
  • 202
  • 1
  • 6
  • 24
0
votes
1 answer

Namespaces and inheritance: super constructor with JavaScript chain of responsibility

I'm working with namespaces, classes, inheritance and pattern chain of responsibility with JavaScript, but it doesn't work - I've tried following this tutorial, but when I try to implement a namespace and a super constructor, it doesn't works, so I…
Cristian
  • 1,480
  • 5
  • 32
  • 65
0
votes
4 answers

Chain of Responsibility Dynamic Chain

I am working on a application that uses a chain of responsibility to process a request. I know how to build the chain, but if you look at the example below, I would have to call link1.Process(request); to initiate the chain process. What I am trying…
Mike
  • 1,718
  • 3
  • 30
  • 58
0
votes
1 answer

wpf events and chain of responsibility pattern

do routed events from wpf have something in common with the chain of responsibility pattern ? i googled for this and i don't see anyone talking about this :S, although i though that the routed events are an implementation of that pattern
Omu
  • 69,856
  • 92
  • 277
  • 407
0
votes
1 answer

Chain of responsibility with large configs

I am using the chain of responsibility design pattern for my pipeline. One problem I discovered is that the configuration object becomes larger and larger as I add more chains. Essentially, my config object is becoming a massive singleton. Is there…
1 2 3
10
11