Delegating Part of an Object's Work

Delegation lets an object use a collaborator to perform a defined operation while keeping responsibility for the surrounding behavior.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace an audit call
  2. Decide what failure means

Trace an audit call

A booking service can reserve a seat and ask an event recorder to record it. The recorder's interface can allow tests to verify the data passed. Object composition describes how the collaborator is supplied.

Decide what failure means

If recording is required for a successful reservation, the service needs a contract for partial failure. Returning success before the audit completes can violate the advertised rule. See observable effects and values.[1]

References

  1. Python Software Foundation, Python Tutorial: Classes ↩