Key Concepts
Models are tools for thinking and communication — not bureaucratic artifacts. Use the diagram that answers your current question.
Use Case Diagrams
Show interactions between actors (users/systems) and the system. WHAT the system does, not HOW.
Class Diagrams
Show classes, attributes, methods, and their relationships (inheritance, association, composition).
Sequence Diagrams
Show interactions between objects OVER TIME — the order of messages, calls, and responses.
Activity Diagrams
Show the flow of activities in a process — like a flowchart with parallel activities and decision points.
State Diagrams
Show the states an object can be in and the events that trigger transitions between states.
Concept Deep Dives
Click each concept to expand — real examples, diagrams, pros & cons.
Use Case Diagrams
When to Use
Requirements phase — show system scope and actor relationships.
Real-World Example
E-commerce system: actors = Customer, Admin, Payment System. Use cases = Browse Products, Checkout, Process Refund.
✓ Advantages
- Non-technical stakeholders understand them
- Defines system boundary clearly
- Links to test cases
⚠ Watch Out
- No detail on behavior or data
- Easy to make too big or too small
Class Diagrams
When to Use
Design phase — defines the data model and object relationships.
Real-World Example
Every ORM (Django models, Rails ActiveRecord, Hibernate) is derived from a class diagram.
✓ Advantages
- Direct translation to code
- Shows data structure clearly
- Foundation for database design
⚠ Watch Out
- Static — doesn't show behavior over time
- Can become outdated quickly
Sequence Diagrams
When to Use
Design phase — trace a specific scenario through the system (e.g., login flow, payment processing).
Real-World Example
Documenting API call flows, debugging async issues, designing microservice communication.
✓ Advantages
- Shows exact call order
- Great for debugging complex flows
- Reveals timing issues
⚠ Watch Out
- Becomes complex for many objects
- Static snapshot, not dynamic
Activity Diagrams
When to Use
Modeling business processes, workflows, algorithms.
Real-World Example
E-commerce checkout: 'Add to cart → Choose shipping → Enter payment → Validate → Confirm OR Error'.
✓ Advantages
- Easy for non-technical stakeholders
- Shows parallel activities
- Good for business processes
⚠ Watch Out
- Can become very complex
- Overlaps with flowcharts
State Diagrams
When to Use
Modeling objects with distinct states — order status, user account, device state.
Real-World Example
Order: Created→Confirmed→Shipped→Delivered→Cancelled. Each state has valid transitions.
✓ Advantages
- Perfect for event-driven systems
- Reveals impossible state combinations
- Maps to state machine code
⚠ Watch Out
- Only useful for stateful objects
- Can explode in complexity
Quick Reference
- 1System models are abstract representations — they simplify reality to answer specific questions.
- 2Context models show the system boundary and what's external to it.
- 3Use case diagrams: show interactions between actors and system — for requirements communication.
- 4Class diagrams: show structure — classes, attributes, methods, and relationships.
- 5Sequence diagrams: show interactions over time — great for tracing specific scenarios.
- 6Activity diagrams: workflow and process flows with decisions and parallelism.
- 7State diagrams: object lifecycle — states and events that cause transitions.
- 8Model-Driven Architecture (MDA): platform-independent models that generate code.
Quiz — Test Yourself
Think through your answer first, then reveal.