1. Home
  2. Docs
  3. Mastering UML 2.5: A Use ...
  4. Module 4: The Heartbeat –...
  5. Practical 4: Behavioral Simulation

Practical 4: Behavioral Simulation

In this practical session, you’ll model dynamic behavior using Sequence Diagrams in Visual Paradigm. We’ll focus on the Borrow Book use case from Module 2, showing how objects (from your class diagram) interact over time to realize the main success scenario and one key alternative (book unavailable).

Sequence diagrams bring use case flows to life: lifelines represent participants (Patron, System/LibrarySystem, Book, Loan, Member), messages show interactions, and fragments handle conditions/loops. By the end, you’ll see direct traceability from use case narratives to runtime interactions — perfect for validation, test case derivation, and guiding implementation in Agile sprints.

Generating a Sequence Diagram with AI

Visual Paradigm’s AI can generate a sequence diagram draft from a use case description — great for rapid prototyping.

  1. Select Tools > AI Diagram Generation from the main menu.

    To generate diagrams with AI

  2. In the AI Diagram Generation window, select Sequence Diagram as the type. In the Topic field, enter a clear description based on the use case, e.g.:
    “Sequence diagram for Borrow Book use case in Library Management System: Patron searches and selects a book, system checks availability, Patron requests borrow, system validates member status and borrowing limit, records loan, assigns due date, confirms success. Include alternative: if book unavailable, notify Patron. Participants: Patron, LibrarySystem, Book, Member, Loan.”

    Enter the diagram prompt

    Click OK.

  3. The AI generates a sequence diagram. Review lifelines, messages, and any fragments (e.g., alt for conditions).

    A UML sequence diagram generated by AI

  4. Refine manually: adjust message names/ordering, add activation bars, create or edit fragments (alt/opt/loop), or add notes. Detailed manual editing follows next.

Drawing a Sequence Diagram Manually

For precision and learning, create the diagram manually. We’ll model the **Borrow Book** happy path + simple alternative (book not available).

  1. Select Diagram > New from the main menu.

    To create a new diagram

  2. Choose Sequence Diagram and click Next.

    To create a sequence diagram

  3. Select Blank and click Next.
  4. Name the diagram (e.g., “Borrow Book”) and click OK.

    Entering the name of the sequence diagram to create

  5. Add lifelines: From the toolbar (left), click Actor, then click on the canvas. Name the first one :Patron (actor).

    An Actor is created from the diagram palette

  6. Repeat by creating Lifelines: :LibrarySystem, :Book, :Member, :Loan. Arrange left-to-right: Patron → LibrarySystem → Book → Member → Loan.

    Actors and lifelines are created in a sequence diagram

  7. Create the first message: Hover over :Patron actor, press on the Resource Catalog icon and drag towards the Library System lifeline.

    To relate an actor with lifeline via the Resource Catalog

  8. Select Message.

    Selected to create a Message in between an actor and lifeline

  9. Release the mouse button and name the message searchAndSelectBook(bookTitle).

    A sequence message is named

  10. Continue messages for happy path:
    • :LibrarySystem → :Book: checkAvailability() → reply available: true
    • :Patron → :LibrarySystem: requestBorrow()
    • :LibrarySystem → :Member: validateBorrowingLimitAndStatus() → reply valid: true
    • :LibrarySystem → :Loan: createLoan(book, member)
    • :Loan → self: assignDueDate()
    • :LibrarySystem → :Patron: confirmBorrowed(dueDate)

    A sequence diagram is created but without alternative combined fragment

  11. Add alternative fragment for “book unavailable”: Select message from checkAvailability onward, right-click → Create Combined Fragment → choose alt.

    To create a combined fragment for selected messages

  12. Name guard: [available] for happy path. You can double click on [alt] to enter the guard.

    The operand of a combined fragment is named

  13. Right click on the combined fragment and select Operand > Add Operand.

    Add another operand to the Alt combined fragment

  14. Name the guard [not available] for else branch with reply notifyUnavailable() to Patron.

    A sequence diagram with a combined fragment

Tip: In Visual Paradigm, link this sequence diagram to the original Borrow Book use case:

  1. Right click use case Borrow Book and select Sub Diagrams > Existing Diagrams….
    To add a subdiagram to a use case
  2. Select the sequence diagram and click OK.
    To select a sequence diagram to be the subdiagram of a use case
  3. From now on, you can easily open the sequence diagram from the use case model.

    Open a sequence diagram from a use case diagram with ease

Excellent work! You’ve now bridged from static structure (classes/components) to dynamic behavior — directly realizing use case scenarios. Sequence diagrams are invaluable for spotting interaction issues early, writing unit/acceptance tests, and communicating “how it works” to developers.