Model Reconciliation  «Prev  Next»
Lesson 2 Test the scenarios
Objective Reconcile the sequence diagrams to the scenarios.

Reconcile Sequence Diagram to Scenarios

Yes, use case scenarios are often the source for interaction diagrams in UML. In fact, there's a natural progression from use cases to interaction diagrams in the UML development process. Here's how:
  1. Use Cases Define the "What":
    • Use cases capture the functional requirements of a system, outlining what the system should do from the perspective of its users. They answer the question: "What functionalities should the system offer?"
  2. Use Case Scenarios Describe the "How":
    • Use case scenarios delve deeper into the "how" of each use case, detailing the specific steps users take to achieve their goals within the system. They illustrate the sequence of interactions between users and the system.
  3. Interaction Diagrams Visualize the "How":
    • Interaction diagrams, specifically sequence diagrams, take the user interactions described in use case scenarios and translate them into a visual format. They show the message exchange between different actors and system components (e.g., objects, modules) involved in a specific scenario.
Think of it this way:
  • Use cases are like the script of a play, outlining the overall plot and characters.
  • Use case scenarios are like individual scenes of the play, detailing the specific actions and dialogues within each scene.
  • Interaction diagrams are like the stage directions, visually illustrating the movement and interactions between the actors and props on stage.
Benefits of Using Use Cases as a Source for Interaction Diagrams:
  • Clearer understanding: Use cases provide context and rationale for the interactions depicted in the interaction diagrams.
  • Improved communication: Both technical and non-technical stakeholders can easily understand the system's behavior through use cases and their corresponding diagrams.
  • Early error detection: Analyzing use cases and interaction diagrams together can help identify potential problems or inconsistencies in the system design early on.

Here's an example to illustrate the connection:

Use Case Purchase a Book Online
Use Case Scenario: "Buy Now" Button
  • User clicks the "Buy Now" button on a book's product page.
  • The system sends a request to the shopping cart service.
  • The shopping cart service adds the book to the user's cart and updates the cart total.
  • The system displays a confirmation message to the user.

Scenarios and sequences

Use case scenarios are the sources for interaction diagrams. In an earlier module, you learned how to build a sequence diagram using a single use case scenario. You have also seen that the process is designed to be iterative. That is, you create an initial draft of each diagram, then compare and contrast the diagrams, asking probing questions to enhance and refine the diagrams.
The scenarios are initially very high level. In fact, they should describe only what is visible to an actor from outside the system. When the sequence diagrams are drafted, there are really only two objects, the actor and the system. In the second iteration, you add the resources that the system uses to accomplish the events assigned to it. During design, this same process will continue as you add the software classes. You will replace the actor with user interface objects, and replace the "system" object with the software control and interface classes that make up the software.

Sequence diagram are more detailed than Scenarios

Invariably, the sequence diagram will become more detailed than the scenarios. The goals and the audiences are different. The scenarios are targeted at users outside the system. The sequence diagrams are targeted at describing the system and its internal resources.
As you add detail to the sequence diagrams, make certain that you do not alter or lose any of the information from the scenarios without reconciling the changes to the scenarios. The two diagrams must remain in agreement throughout the enhancement process. If you add detail to the sequence diagram, then add it to the scenario, and vice versa.
Click the View Image link to view an automatic teller machine (ATM) example illustrating the process of change and reconciliation.
Note that the sequence diagram changes as the scenario is updated. The two views remain in sync, with no information loss or corruption throughout the evolution of the model.
First draft: In the first draft of the sequence diagram it directly reflects the sequence of events described by the scenario.
1) First draft: In the first draft of the sequence diagram it directly reflects the sequence of events described by the scenario.

Step 2: Incorporate the flows referenced from other scenarios but not explicitly shown in the original sequence diagram
2) Step 2: Incorporate the flows referenced from other scenarios but not explicitly shown in the original sequence diagram.

Step3: Once you have drafted the sequence diagram you review it with team members. They ask whether you intend to include a daily limit check like they have in their banks. What do you do? Ask the users.
3) Step3: Once you have drafted the sequence diagram you review it with team members. They ask whether you intend to include a daily limit check like they have in their banks. What do you do? Ask the users.

Step 4: Identify the resources that the ATM System uses to satisfy the withdraw request. These resources are defined in the first draft of the class diagram where you identified the resources of the problem domain.
4) Step 4: Identify the resources that the ATM System uses to satisfy the withdraw request. These resources are defined in the first draft of the class diagram where you identified the resources of the problem domain.

Step 5: Scenario: Evaluate the sequence diagram to improve the flow of events.
5) Step 5: Evaluate the sequence diagram to improve the flow of events.
Scenario: Successfully withdraw $100


Enhance Scenario - Exercise

Click the Exercise link below to enhance a course project scenario and the corresponding sequence diagram.
Enhance Scenario - Exercise