Common Modeling Techniques
- Modeling a workflow
- Modeling an Operation
To model a workflow:
- Create a focus for the workflow and assess if one or more activity diagrams are needed to represent it
- Choose the business objects that have high-level responsibilities for different parts of the overall workflow
- Build a swimlane for each important business object Recognize the preconditions of the initial state of workflow and post conditions of the final state of workflow. This helps model the boundaries of the workflow
- Indicate the activities and actions that take place over time, starting with the workflow's initial state, and finally include them in the activity diagram as either activity states or action states
- For complicated actions and for the actions that appear multiple times, collapse them into activity stages. Then, include a separate activity diagram that expands on each
- Indicate their changing values and state them wherever necessary
Modeling an Operation
To model an operation:
- Gather the abstractions involved in this operation
- It includes the parameters of operation (including its return type), the respective attributes of the enclosing class, and the neighboring classes
- Recognize the preconditions at the initial state of the operation and the post conditions at the final state of the operation
- Identify the activities and actions over time, starting with the operation's initial state and include them in the activity diagram as activity or action states
- Use branching wherever necessary to indicate conditional paths and iteration
- Use forking and joining wherever necessary, to specify parallel flows of control; only if this operation is owned by an active class
Forward Engineering
Forward engineering, which is the creation of code from a model, is possible for all activity diagrams, especially if the context of the diagram is an operation.
Point Line::intersection (line : Line) {
if (slope == line.slope) return Point(0, 0);
int x = (line.delta - delta) / (slope - line.slope);
int y = (slope * x) + delta;
return Point(x, y);
Reverse Engineering
Reverse engineering, which is the creation of a model from a code, is even possible for programs that involve activity, especially if the context of the code is the body of the operation. By implementing the class line, the previous diagram can be easily generated.
Activity at a Glance