One technique for coping with the complexity of state-specific behavior is the state design pattern. This pattern uses the concept of delegation to separate the implementation of a behavior from the object that is responsible for the behavior.
For example, most of us are responsible for filing taxes. However, for some of us, the process is extremely complex and requires
assistance from an expert. We retain ultimate responsibility for filing the taxes, but we delegate the actual process to a
specialist who does it for us. When the tax specialist is finished, he/she returns the results to us. Click the View Image button to see the key components of the state design pattern.
The statechart diagram provides an explicit description of the states of an object. To create the state pattern in your class
diagram click the View Image button and follow the steps.
State Design Pattern
The state pattern is not appropriate for every application of state-specific behavior. However, when you are faced with increasing numbers of states and a variety of behaviors, the pattern can pay huge dividends in ease of maintenance and understandability.