ABSTRACT

Chapter 2 introduced UML statecharts as a very effective way of getting around the state-explosion problem that plagues the traditional “flat” state machines. The particularly valuable innovation of UML state machines in this respect is the concept of state nesting, because it allows reusing behavior across many states instead of repeating the same actions and transitions over and over again. Hierarchical nesting of states lets you get new behavior almost for free by inheriting all of what is common from the superstates. It lets you define new states rapidly by difference from existing states rather than create every state from scratch each time. Needless to say, formalism like this is a godsend to the developers of event-driven software, because only state hierarchy makes the whole state machine approach truly applicable to real-life problems.