Statecharts are an important tool for specifying the behavior of
reactive systems, and development tools can automatically generate
object-oriented code from them. As the system is refactored, it is
necessary to modify the associated statecharts as well, performing
operations such as grouping or ungrouping states, extracting part of a
statechart into a separate class, and merging states and transitions.
Refactoring tools embedded in object-oriented development environments
are making it much easier for developers to modify their programs.
However, tool support for refactoring statecharts does not yet exist.
As a result, developers avoid making certain changes that are too
difficult to perform manually, even though design quality
deteriorates.
Methodologically, statecharts were meant to enable a systems engineer
to describe a complete system, which would then be refined into a
concrete implementation (object-oriented or other). This process is
not supported by object-oriented development environments, which force
each statechart to be specified as part of a class. Automated tool
support for refactoring statecharts will also make this kind of
refinement possible.
We describe two case studies that shows the usefulness of refactoring
support for statecharts, and show the mutual relationships between
statecharts and code. The first case study demonstrates that a
top-down refinement process helps identify the tasks and classes in a
natural way. The second shows how to extract a procedural
implementation of a finite-state machine into a statechart.
We present an initial catalog of relevant refactorings, and discuss
the difficulties in automating these in a refactoring tool.