Delegation lets an object use behavior held by another object. In JavaScript, a missing property or method can be found through a prototype link, so the objects remain separate rather than copying behavior into one place. This supports reuse without making classes the default design model. section 3.0 section 3.1.1
Objects Linked to Other Objects (OLOO) makes those links the design model: objects are peers that delegate work to one another, not children described as deriving from a base class. `Object.create(otherObject)` establishes a link while leaving prototype-chain setup to the language. The link is still a `[[Prototype]]` link; OLOO changes how the relationship is expressed and understood, not the underlying lookup mechanism. section 3.2
Linking a store and a chain
`const Blockchain = Object.create(MyStore)` links one object to shared storage behavior. `const chain = Object.create(Blockchain)` adds another link; `chain.init(createGenesisBlock)` initializes the working object, and `chain.push(new Block(...))` uses behavior available along the links. `init` writes to `this`, so the initialized state belongs to `chain`. section 3.2
const MyStore = {
init(element) {
this.length = 0;
this.push(element);
},
push(b) {
this[this.length] = b;
return ++this.length;
}
}
const Blockchain = Object.create(MyStore);
const chain = Object.create(Blockchain);
chain.init(createGenesisBlock);
chain.push(new Block(...));
chain.length; // 2
The listing shows the two `Object.create` links and the separate initialization of the working object. section 3.2
The form of the link changes how delegation reads in code:
- With an implicit prototype link, a method can call `this.format(msg)`; property lookup finds `format` along the chain while retaining the caller's `this` context. Classes and constructor functions also use this mechanism. section 3.1.1
- With an explicit reference, a method calls `this.formatter.format(msg)`. This is a visible “uses” relationship between objects with separate life cycles; the reference may need checking before use. section 3.1.2
- Mixins offer a different reuse choice: they combine independent behavior into an object instead of relying on a longer lookup chain. `Object.assign` and object spread support this compositional approach. section 3.0 section 3.6
For domain objects, choose links when shared behavior should remain on related objects and be reached through lookup. A transaction can link to general transaction behavior while adding its own hashing method. Choose explicit references when the dependency should be visible as a separate collaborator, or mixins when combining independent capabilities into an object better fits the design. section 3.2 section 3.1.2

