UML Dynamic Diagrams

While the static diagrams (use case and component diagrams) pertain to a system, the dynamic diagrams (state, sequence, activity, and communication) pertain to key components or a single component for a state diagram. Study the examples in this section.

Dynamic UML models

  • While static models (use cases, class diagram, component diagram) are done for the system as a whole, dynamic models are done only for key components
  • State diagram
    • Specifies behavior of a single object 
    • Diagram has states and transitions only 
  • Sequence diagram
    • Shows details of one scenario and messages that flow between objects/organizations in that scenario over time
    • Heavily used in standards
  • Activity diagram 
    • Shows flow of logic, data, messages
    • Diagram has activities, decisions, forks, joins (parallel) 
    • Replaces flow charts
  • Communication diagram
    • Shows flow of messages as a graph
    • Used as variant of sequence diagram 
  • Others, as needed
State diagram example

State diagram example

An object (account in this example) can be in only one state at any time


State diagram exercise

  • Model the state transitions of a student's registration in this class: 
    • Preregistered
    • Registered
    • Listener
    • Dropped 
    • Complete, incomplete (not resolved), etc.
  • Remember that an entity can only be in one state at any time. It cannot be in two or more states.
State diagram solution

State diagram solution


Activity diagram 

  • Shows flow of messages, logic, actions 
  • This is at a much higher level of abstraction than flow charts
    • Flow charts show logic for single method (if statements, loops, etc.) 
    • Activity diagrams show flow among objects
Activity diagram example

Activity diagram example


Activity diagram exercise 

  • Draw an activity diagram for getting an apartment. Example activities are: 
    • Find roommates
    • Find apartment
    • Sign apartment lease
    • Get electric service 
    • Get phone or cable TV service
    • Get gas or oil heat account set up 
    • Obtain furniture
    • Move in 
  • (Use this as a simple model of setting up a warehouse…)
  • Use activities, decision nodes, fork/join nodes
Activity diagram solution

Activity diagram solution


Sequence diagram (optional)

  • Objects or entities are diagrammed at the top
  • Each object's life is represented by a vertical line from creation to destruction
  • Messages or events are diagrammed from the sending object to the receiving object, in the order in which they occur
  • Responses may or may not be diagrammed, depending on complexity/obviousness 
  • These are sometimes called ‘swim lane' diagrams
    • Swim lanes can be used in activity diagrams as well
Sequence diagram example

Sequence diagram example


UML Summary

  • Use UML while writing scenarios and narratives as an initial requirements document 
    • Diagram use cases, then refine them into scenarios
    • Focus on completeness of use cases
  • Use UML component diagrams to list all system elements
    • Focus on completeness, and use to set system boundaries
  • Prepare the initial data model (next lecture)
    • Add operations/methods to the entities, after understanding the data, to create a class diagram
  • Use UML state diagrams, sequence diagrams and activity diagrams to specify objects and processes 
    • Prepare these selectively for complex or interesting objects
  • UML is becoming a 'universal' language: staff coming to a project know it, which sharply reduces learning curve
    • Developers and analysts can both understand it readily
    • Consultants/analysts use UML even for analysis-only projects (as well as writing requirements and modeling data)
    • Business process execution language (BPEL) in Web lectures is UML extension to directly create systems

Source: Massachusetts Institute of Technology, https://ocw.mit.edu/courses/1-264j-database-internet-and-systems-integration-technologies-fall-2013/resources/mit1_264jf13_lect_7/
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.

Last modified: Friday, December 8, 2023, 12:53 PM