Configurable Objects with Explicit Defaults

A configurable object can construct valid settings by applying documented defaults only when the caller leaves those settings unspecified.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace zero and omission
  2. Check the assembled state

Trace zero and omission

For a retry controller, a retry count of zero can deliberately disable retries. An omitted value may request the policy default of two. Unset and zero values explain why generic truth testing would lose that choice.

Check the assembled state

If an interval and timeout must agree, validate their relation after applying defaults and overrides. Valid construction ensures later methods rely on usable values.[1]

References

  1. Python Software Foundation, Python Tutorial: Classes ↩