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 pattern C++

I am studying designs patterns. I'm not sure about how to implement the chain of responsibility pattern in C++. I am using the Argo tool to generate my code from my diagram . In this diagram, the Oracle class is a "client". The Oracle.cpp…
Juan
  • 2,073
  • 3
  • 22
  • 37
0
votes
2 answers

How would you test something that filters complex objects

I have a persistent object with 7 pertinent fields. The fields can hold the number of values listed here: Field # of Possible Values 1 5 2 20 3 2 4 2 5 19 6 2 7 8 Which is a potential for 121600…
Steven Evers
  • 16,649
  • 19
  • 79
  • 126
-1
votes
1 answer

How print the entire data structure created with Composite?

I have class-Composite: public class CompositeText implements ComponentText { private TypeComponent type; private String value; private final List childComponents; private CompositeText() { childComponents =…
West Side
  • 166
  • 3
  • 10
-1
votes
3 answers

Is this possible in PHP?

Consider the following PHP snippet: $key = new $class(); } …
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
-2
votes
1 answer

Overriding overloads C#

Ok, so I've already solved this but I want to ask/share what you guys think. I have a base class with 2 overloads for a method, for instance public class Entity{ public virtual bool Save() { //ReallySave()... } public virtual…
user5328504
  • 734
  • 6
  • 21
-2
votes
2 answers

Why is this a Chain of Responsibility or a Decorator pattern?

A company has 3 kinds of employees: Manager, Software Designer, andHardware Engineer. Each employee category has a different PTO (PaidTime Off) scheme. For example, the Software Engineer is part of a Bonus-Holiday scheme wherein his/her PTOs depend…
-2
votes
2 answers

Is there any scenario where i can say Only solution is use Chain of responsibility pattern?

I was reading COR(Chain of responsibility pattern),I felt it works as simple as a if else or switch case in system level and this pattern can be easily replaced by similar pattern like factory or composite pattern. Is there any scenario or example…
keerti_h
  • 383
  • 2
  • 13
-3
votes
1 answer

Chain of responsibility going back by pointers for no reason

So I had a task to do a shop class, products class a basket class bla bla bla, I did all of this, tested, everything is working fine and that has nothing to do with the problem. Now what I had to do is create discounts and a chain of responsibility,…
Aldomond
  • 171
  • 6
-3
votes
1 answer

Chain of responsibility - lambda function implementation

How would you implement Chain of Responsibility pattern using Lambda in Java 8? I only found a paragraph in this article: Chain of responsibility A lambda that may or may not delegate to another lambda, which may or may not delegate to another…
-5
votes
1 answer

Chain of responsibility automatic generator

i have 8 handler class, is there a way i can create the chain dynamically in java? What I mean, if I have two classes right now like: HandlerA HandlerB HandlerChain HanddlerChain will create the chain, HandlerA->HandlerB, (using loop read all class…
1 2 3
10
11