System Design  «Prev  Next»
Lesson 6

State | State-specific Behaviors Conclusion

State and state-specific behaviors are important elements of any application's final design. The statechart diagram is a tool specifically designed for
  1. representing object state,
  2. state transition events, and
  3. state-specific behaviors in the forms of actions and activities.
States are represented by the values of attributes of the object. Actions triggered by events represent the implementation of the event that causes the actual change in state. Activities represent behaviors internal to the state of the object.

Applying Patterns to simplify Design

The state design pattern is one way to handle complex state-specific behavior and avoid complicated code. The state design pattern is specifically designed to distribute and isolate state-specific behavior. This arrangement makes the solution visible at the model level. Any time a problem can be solved at the model level rather than within the code, the time and cost of maintenance is reduced substantially.

Updating the work Products

Every time new classes are added to the model you must reconcile the work products again. Understanding the relationships between the work products provides you with a set of tools to help you fully understand and describe the role of each new resource and its relationship with the other elements of the model.
Note: One way to know that your model is well designed is if you are able to add new features with little or no change to the models. Changes should be isolated to a small subset of model components. In contrast, a poor design will rapidly grow in size and complexity with each additional behavior. A single change may result in multiple and often redundant changes to many parts of the model.

You should now be able to:
  1. Describe the diagrams used during design and explain how they interact with one another
  2. Explain why and how the statechart diagram is used during design
  3. Build a statechart from multiple sequence diagrams
  4. Apply the state design pattern to handle complex state-specific behavior


This module introduced you to the following terms and concepts:
  1. Statechart diagram: The UML diagram used to model object states, state transitions, and the behavior of an object during the state changes and during each state.
  2. State design pattern: A design pattern that addresses the need to control an object's behavior differently depending on the state of the object.

Statechart Diagram to Object Design - Quiz

Click the Quiz link below to apply the statechart diagram to object design.
Statechart Diagram to Object Design - Quiz