8 Cross-cutting Concepts
This chapter defines concerns that affect several of the Station’s building blocks at once, rather than belonging to any single one of them.
Domain Type Safety
Identifiers and physical quantities that could otherwise be confused, such as a Pod’s identity versus a dispenser’s, or a volume versus a plain number, are kept as distinct types throughout the domain model, so that mixing up two different kinds of value is a compile error rather than a runtime bug. Every physical quantity always carries its unit, removing an entire class of unit-conversion mistakes in a system where an incorrect quantity is a food-safety concern. STA-004.
Single-Executor Concurrency
All Pod communication and recipe execution run as coroutines on one shared execution context rather than across multiple threads, so the domain and UI state they touch is never accessed from two places at once. Every exchange with a Pod carries an explicit timeout, so a Pod that stops responding cannot stall the Station indefinitely (System protocol concept). All background work is owned by one scope, which is stopped and joined before the Station shuts down. Related decisions: STA-005, which supersedes STA-003.
UI/Domain Separation
The user interface never owns domain or Pod state itself. A small set of dedicated components sits between the declarative UI and the Domain Model, each reflecting one part of the live state into the UI and translating user actions back into calls on the Domain Model, so the UI can be redesigned without touching domain logic and vice versa (5 Building Block View). Related decision: STA-001.
Configuration and Data as Files
Recipes, ingredients, and glasses are plain data, validated against a published schema, rather than code, so they can be authored and changed without a rebuild. The Station’s local state, which physical dispenser serves which ingredient, which pour volumes each glass offers and how full each dispenser is, is likewise persisted as plain files rather than requiring a database.
Operator Authentication
The Operator UI is gated behind a PIN with attempt-based lockout, entered through a hidden gesture rather than a permanently visible control. This keeps it out of a Guest’s way while still requiring a deliberate, authenticated action before any calibration or configuration change.
Logging and Observability
Application logging is captured centrally and made visible directly on the device, in the Operator UI, rather than requiring separate tooling. This lets an Operator diagnose a problem without extra equipment, supporting the Serviceability goal in the System quality goals.
Error Handling Toward the Guest
A failure during a mix, such as a dispenser running out of ingredient, is translated into a Guest-facing error screen naming the affected ingredient rather than a generic failure, and the Guest is always returned to a known-good screen. This supports Usability alongside Reliability.
Continue with 11 Risks and Technical Debt.