Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [delegation]

The tag has no usage guidance.

-2
votes
1answer
62 views

Delegation pattern in Python: is it unpopular? Is it considered not Pythonic?

As a Ruby/Rails person, I often deal with method delegation. It's often convenient to delegate a method to a composed object or a constant. Ruby even has a def_delegator helper method to easily build ...
-2
votes
1answer
42 views

Should we delegate user input sanitization/validation?

Consider this code: new FrameworkClass( [ 'query' => $_POST[ 'input' ] ] ); FrameworkClass is supposed to do input sanitization and validation. Should we just trust 3rd party code to do it's job? ...
3
votes
2answers
936 views

Alternatives to the delegation pattern allowing blind messages between components

Delegates and delegation exist to enable passing specific messages to an observer, regardless of that observer's type. In a coordinator-type architecture, where coordinators manage and run the flow of ...
9
votes
1answer
441 views

Code Design: Delegation of arbitrary functions

On PPCG, we frequently have King of the Hill challenges, which pit different code bots against each other. We don't like limiting these challenges to a single language, so we do cross-platform ...
4
votes
1answer
553 views

Extension versus Delegation

I am using Swift and am wondering about the concepts of Extension and Delegation. Recently I found a case where either one of these two concepts could be applied. This reminded of the "composition ...
3
votes
1answer
140 views

How to DRY decorator pattern and other delegation in java

I was refactoring some java to use decorators. All of the decorators inherited from a class ThingDecorator, let's say. This consisted entirely of: SomeType methodName(OtherType otherThing) { ...
6
votes
1answer
678 views

Best practice to authenticate third party to a website?

I've a website built with ASP.NET, and uses Cookie based Forms Authentication to protect it self from unauthorized access. It also has a REST based API which uses API key based Authentication. (Key ...
3
votes
1answer
153 views

Do conditional delegation or different member types break the Composite pattern?

Here's how I understand the composite pattern: In the composite pattern, a root object is composed of objects which may be further composed. Moreover, to be considered composite, all those objects ...
2
votes
2answers
112 views

Delegating work and programming to component interfaces

I have a MessageHandler class which receives and validates messages before determining which components in the architecture they should be delegated to so they can be processed. This involves calling ...
2
votes
1answer
206 views

Language support for (syntactic) delegation in Java

Composition over inheritance is an old trend or even accepted state of the art in object oriented programming. It would be even easier to use in Java, if there were language support for delegation. ...
3
votes
2answers
494 views

How to use scala case classes when delegation is needed

Let's assume in our application we want to model cars. We also want to model a car repository where we store some registered cars. How should that be modeled in scala? Here comes my approach: First, ...
7
votes
1answer
505 views

Why are Scala's Either and Option types not interfaces/traits but classes?

I wanted to create a class CompileResult, that can be treated like an Either type but has some additional useful methods. It should be a CompileSuccess or a CompileFailure (which, too, has some ...