State Diagram — Washing Machine Programs
publish date: 2026/06/08 22:17:21.814021 UTC
A washing machine has different programs for different types of clothes (e.g., cotton, delicates, wool, quick wash). In a state diagram for its control software, how would you best handle this variation in programs?
Correct Answer
Explanation
The best approach is to use a superstate for the common washing process states (Fill, Wash, Rinse, Spin, Done) that are shared across all programs, with transitions into the superstate carrying program-specific parameters. This avoids duplicating the entire state sequence for each program. The superstate approach — hiding detail in a high-level diagram and expanding it when needed — is exactly the technique described for managing complexity in large state models.
Reference
Software Engineering, Ian Sommerville, 9th edition
