volume_mute

State Diagram — Washing Machine Programs

publish date2026/06/08 22:17:21.814021 UTC

volume_mute

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

Use a superstate called 'Washing' that encapsulates the common states (Fill, Wash, Rinse, Spin, Done), which is shared across programs, and use transitions into this superstate that set program-specific parameters (temperature, spin speed, duration)

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


Quizzes you can take where this question appears