Explicit Dependencies for a Small Module

A module becomes easier to test when operations that read outside state are selected at its entry boundary and passed where needed.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace a clock choice
  2. Keep dependency direction readable

Trace a clock choice

A local scheduler can calculate deadlines from one supplied instant. The command handling live work reads the actual clock. Tests pass a fixed value using a test clock or an explicit date.

Keep dependency direction readable

Low-level time arithmetic need not import the scheduling command that calls it. Moving stable records and rules into a shared module can eliminate an import cycle.[1]

References

  1. Python Software Foundation, Python Tutorial: Classes ↩