Delegation
Delegation is a composition pattern in which one object forwards operations or property lookup to another object that provides the behavior.
The Joy of JavaScript
A composition style in which an object forwards behavior or property lookup to another object through delegation links rather than copying or class inheritance.
- How it is used
- Uses delegation to reuse behavior across linked JavaScript domain objects without requiring a class-inheritance design.
- How deep it goes
- Works through Object.create links, prototype lookup, and initialization; contrasts explicit references without developing that technique further.
- Examples
- Shows a linked blockchain store and transaction objects, plus implicit and explicit formatter calls.
- What you can do after
- Build it from scratch with Object.create links and initialization methods, then distinguish prototype delegation from explicit references and mixin composition.
Kotlin in Action, 2E
- How it is used
- Reduces wrapper and accessor boilerplate when behavior should be forwarded to a contained object or helper.
- How deep it goes
- Explains compiler-generated class forwarding and property delegates through observable-property refactoring, including getValue and setValue conventions.
- Examples
- Uses a CountingSet wrapper and observable Person age and salary properties to demonstrate selective forwarding.
- What you can do after
- Apply it via Kotlin’s by syntax and Delegates.observable to customize selected behavior without rewriting routine forwarding code.
Related concepts
- method_missingused by · method_missing is a Ruby method invoked as a last resort when an object receives a message for which no matching method is found.
- delegated propertyimplements · A delegated property is a Kotlin property whose read and write behavior is provided by a separate delegate object.
- classcontrasts with · A class is a programming-language construct that defines a type’s structure or behavior and provides a basis for creating or representing objects.
- Kotlinimplemented by · Kotlin is a statically typed general-purpose programming language that targets the JVM and other platforms and interoperates with Java.
- backward compatibilityimplements · Backward compatibility is the property of a changed or newer system remaining usable by existing clients and consumers of its earlier interfaces, behavior, or data.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

