How do you write software for controlling home appliance such as High Tech Seat (a.k.a. Washlet) ?
When you write bad code, water may flood or may not be flushed...
Even after you write correct code, you might want to add some nice features like open and close the cover working with flusher. How do you verify the behavior of it?
State machine diagram is usually used to verify the behavior, especially for embedded systems.
In UML 2.x, nested states and orthogonal regions are supported to describe complex behaviors.
Through the diagrams, you can learn what is "good" design for controlling devices.
In addition, Ruby lets us convert the diagrams into executable code easily.
Let's try to implement High Tech Seat from state machine with mruby.