liveBook · Manning

Delegation

Delegation is a composition pattern in which one object forwards operations or property lookup to another object that provides the behavior.

How 2 Manning books explain it

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.

Read how The Joy of JavaScript explains delegation →

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.

Read how Kotlin in Action, 2E explains delegation →

Related concepts

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.