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
3
votes
1 answer

Is there a design pattern for validation?

Is there any adequate design pattern that should be used in order to do number of validations? For example, let's say that I have an application containing a toolbar with icons, each representing a picture on my file system. I am dragging an icon on…
ehh
  • 3,412
  • 7
  • 43
  • 91
3
votes
8 answers

Application design for processing data prior to database

I have a large collection of data in an excel file (and csv files). The data needs to be placed into a database (mysql). However, before it goes into the database it needs to be processed..for example if columns 1 is less than column 3 add 4 to…
IaCoder
  • 12,300
  • 11
  • 37
  • 45
3
votes
3 answers

C# -Pipeline Style event model

In ASP.NET Web Apps , events are fired in particluar order : for simplicity Load => validation =>postback =>rendering Suppose I want to develop such pipeline -styled event Example : Event 1 [ "Audiance are gathering" ,Guys{ Event 2 and Event 3…
user160677
  • 4,233
  • 12
  • 42
  • 55
2
votes
1 answer

Chain of Responsibility vs Interceptor

Every request is sent through interceptors defined in a group similar to classes created as chain for passing through. How different is the Interceptors vs Chain of Responsibility?
Phani
  • 5,319
  • 6
  • 35
  • 43
2
votes
1 answer

Chain of Responsibility Logging

I have an abstract class called ChainHandler and many implementations of the ChainHandler. Other programmers will write other implementations of that ChainHandler. My program implements the Chain of Responsibility design pattern. Each concrete…
pablosaraiva
  • 2,343
  • 1
  • 27
  • 38
2
votes
1 answer

Implementing Chain of Responsibility with LinkedList

I'm having a hard time wrapping my head around this, and I'm hoping someone can help me. I have a Chain of Responsibility class, and I'm wondering if I can (and would want to) implement it as a derivative of the LinkedList class. At its core, a…
user502255
2
votes
1 answer

How to decrease cyclomatic complexity of the multiple conditions in if?

I have been trying to learn how to reduce cyclomatic complexity. I have here 5 or more conditional checks inside a if statement e.g if(something1() && something2() && something3() && something4() && something5()){ doThatThing(); }else{ …
2
votes
1 answer

Good chain of builder pattern

i have a complex business object like so public class BusinessObject { public Team1Object object1; public Team2Object object2; public String debug; ... } I am using slight modification of chain of responsibility pattern to build…
2
votes
2 answers

Chain of responsibility - handling more than one request

Right, this one might be a bit hard for me to explain since I am new to this. I was given a task to use Chain of Responsibility to solve one of the problems. I had no problem with understanding it and implementing until I found out I have to make…
Gonper
  • 31
  • 4
2
votes
0 answers

Chain of responsibility pattern rookie attempt

I'm trying to find understanding of Chain of responsibility pattern, and, as an exercise, I've wrote some code. This code class SomeObject: def __init__(self): self.integer_field = 0 self.float_field = 0.0 …
mr_bulrathi
  • 514
  • 7
  • 23
2
votes
0 answers

How is the chain of responsibility design pattern used with regard to the handling of mouse-click and keyboard events in Windows?

I've just finished working my way through the Head First Design Patterns book and I noticed that the chain of responsibility pattern is "Commonly used in windows systems to handle events like mouse clicks and keyboard events." To what extent is this…
Josh Hardman
  • 721
  • 6
  • 17
2
votes
1 answer

Which is the Design Pattern of Fallback services in an array

Let's suppose I've seen a FallbackCompositeService that is used by a client object to obtain a result with a fallback mechanism. It implements a FallbackServiceInterface with a method doSomething(). We have a DI container providing the service,…
Cranio
  • 9,647
  • 4
  • 35
  • 55
2
votes
1 answer

Chain of Responsibility Scope

Hi I am wondering Chain of Responsibility Scope. In general it is a common used pattern which has handlers in itself and each handler is passing the functionality action to it's supervisor. What I see in the example scenarios is: "Only one related…
Akiner Alkan
  • 6,145
  • 3
  • 32
  • 68
2
votes
0 answers

Is it correct to say that the design pattern for exception in Java is "Chain of Responsibility"

Is it correct to say that the exception mechanism in Java is "chain of responsibility"? from the one hand, as far as I understand, for every exception that we have in Java, we "run over" the "catch blocks" and check which one is responsible for to…
2
votes
5 answers

Pattern where only one handler of many should act based on specialization

I'm trying to rewrite some code to break some coupling issues and make it easier to modify in the future. Right now, I have a static factory method in a base class that, depending on the situation, picks an appropriate implementation. The…
user1228