UML Diagrams - A Standardized Visual Language for Software Design
Standardized ways of diagramming software systems.
Overview
Concept
Primitive, standardized, easy-to-draw diagrams to quickly communicate software structure and behavior.
Types of diagrams
UML (Unified Modeling Language) provides for many types of diagrams, divided into two categories:
Structural | Behavioral |
---|---|
Class diagrams | Activity diagrams |
Package diagrams | Sequence diagrams |
Object diagrams | Use case diagrams |
Component diagrams | State diagrams |
Deployment diagrams | Communication diagrams |
Interaction diagrams | |
Timing diagrams |
Types of diagrams
We will explore just a few diagram types for example.
The book, “The Elements of UML Style”, by Scott W. Ambler is a good reference for more - we have pulled many insights from it here.
Best Practices
Overview
Regardless of which diagram type, following best practices keeps diagrams understandable and avoids common pitfalls.
- Avoid crossed lines
- Avoid diagonal and curved lines
- Use consistent sizes
- Flow from top-to-bottom, left-to-right
Avoid crossed lines
Don’t do this:
Avoid crossed lines
Do this:
Avoid diagonal and curved lines.
Don’t do this:
Avoid diagonal and curved lines.
Do this:
Use consistent sizes
Don’t do this:
Use consistent sizes
Do this:
Flow top-to-bottom, left-to-right
Don’t do this:
Flow top-to-bottom, left-to-right
Do this:
Classes
Concept
Used to display the attributes, methods, and interactions of object-oriented classes in code.
One Class
A single class:
Multiple Classes
Relationships among classes, plus annotations, in a casual style:
Use Cases
Concept
Used to indicate interactions between actors and the system.
Single actor
A single actor, a single system:
Multiple actors
Multiple actors, multiple systems:
Read more about the use of use cases in requirements engineering.
Activities
Concept
Flow charts often used to document a complex operation, the logic of one or more use cases, or any other process.
Example
Sequences
Concept
Used to validate and work out the logic and completeness of a certain scenario, often a use case or a part of a use case.
These show the entire sequence of messages sent among the objects and systems involved in the scenario.
Example
State Charts
Concept
Indicate the dynamic behavior of an entity based on its response to events, showing how the entity reacts to various events based on its current state.
- Only useful when behavior changes significantly based on internal state of the object.
Example
A seminar, partial lifecycle:
Example
A seminar, complete lifecycle:
Conclusions
Thank you. Bye.