UML and Software Modeling Tutorial
Learn UML and Software Modeling step by step: 39 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Is UML and Why Model Software? Learn what UML is, where it came from, why teams draw models before and while they code, and how much modeling is actually worth doing on a real project.
- The 14 UML Diagram Types A tour of all 14 UML 2 diagram types, split into structure and behavior families, with one question each answers and a guide to which ones you will use most.
- Modeling Tools and Diagrams as Code Compare whiteboards, drawing tools, full modeling suites and text-based tools such as Mermaid and PlantUML, and learn the diagram-as-code workflow used in this course.
- UML Notation Essentials Learn the notation elements shared by every UML diagram: names, visibility marks, multiplicity, stereotypes, notes, constraints, tagged values, packages and profiles.
Class and Object Diagrams
- Classes, Attributes and Operations Learn how to draw a UML class: the three-compartment box, attributes with types and defaults, operations with parameters, static and abstract members, and good class design.
- Associations and Multiplicity Learn how to draw associations between UML classes: names, role names, multiplicity, navigability, association classes, reflexive and qualified associations.
- Inheritance, Abstract Classes and Interfaces Model is-a relationships with UML generalization, show abstract classes and interfaces, use realization and polymorphism, and learn when composition beats inheritance.
- Aggregation, Composition and Dependency Understand the whole-part relationships of UML: aggregation, composition, and the weaker dependency, with diamonds, lifetimes, examples and code that shows the difference.
- Object Diagrams: Snapshots of a Running System Use UML object diagrams to show concrete instances and links at one moment in time, validate a class diagram with examples, and debug a design with real data.
Use Case and Activity Diagrams
- Use Case Diagrams: Actors and Goals Learn to draw use case diagrams: actors, use cases, the system boundary and associations, how to find use cases from user goals, and how to avoid common modeling errors.
- Use Case Relationships: Include, Extend, Generalization Understand the three relationships between use cases and the generalization between actors: when to use include, extend and generalization, with examples and pitfalls.
- Writing Use Case Specifications Write complete use case specifications with preconditions, main success scenario, alternative and exception flows, and postconditions, using a template and a worked example.
- Activity Diagram Basics Learn UML activity diagrams: initial and final nodes, actions, decisions, merges, loops, and how to model a business process or algorithm step by step.
- Swimlanes, Forks and Joins Extend activity diagrams with swimlanes to show who does what, forks and joins for parallel work, object flows, signals and interruptible regions, with examples and code.
Sequence and Communication Diagrams
- Sequence Diagram Basics Learn to read and draw UML sequence diagrams: participants, lifelines, synchronous and asynchronous messages, return messages, activation bars, self-calls and creation.
- Alternatives, Loops and Combined Fragments Add logic to sequence diagrams with combined fragments: alt, opt, loop, par, break, critical and ref, with guards, examples, and advice on when to split a diagram instead.
- Lifelines, Gates and Interaction Use Go beyond the basics of sequence diagrams: lost and found messages, gates, interaction use, state invariants, durations, system sequence diagrams and real design workflow.
- Communication Diagrams Learn UML communication diagrams: objects connected by links with numbered messages, decimal numbering for nesting, how they differ from sequence diagrams, and when to choose them.
State and Component Diagrams
- State Machine Diagrams Learn UML state machine diagrams: states, transitions, events, guards, actions, entry and exit behavior, with a runnable order example in Python.
- Composite States, Regions and History Go beyond flat state diagrams: nested substates, orthogonal regions, choice and fork pseudostates, and history states, with a runnable hierarchical machine.
- Component Diagrams Learn UML component diagrams: components, provided and required interfaces, ports and assembly connectors, with a runnable dependency checker in Python.
- Composite Structure, Ports and Parts Learn UML composite structure diagrams: parts, ports, connectors and collaborations to show the internal structure of a class or component, with Python examples.
Deployment and Packaging
- Deployment Diagrams Learn UML deployment diagrams: nodes, execution environments, artifacts, communication paths and deployment specifications, with a runnable capacity checker.
- Package Diagrams and Dependencies Learn UML package diagrams: packages, visibility, import and access dependencies, layered architecture and metrics for coupling, with runnable Python.
- Profiles and Stereotypes Learn how UML extends itself: stereotypes, tagged values, constraints and profiles, with examples such as a REST profile and a runnable stereotype validator.
- Timing and Interaction Overview Diagrams Learn the two least-known UML interaction diagrams: timing diagrams for state changes over time, and interaction overview diagrams that chain scenarios.
From Models to Code
- Class Diagrams to Code Translate UML class diagrams into code: attributes, associations, multiplicity, composition, inheritance and interfaces, with a runnable Python generator.
- State Machines to Code Turn UML state machine diagrams into code with three techniques: nested switch, transition table and the State pattern, plus tests for every transition.
- Sequence Diagrams to Tests Use UML sequence diagrams as executable specifications: map messages to calls, lifelines to objects, and alt/loop fragments to test cases with mocks.
- Reverse Engineering and Round-Trip Learn forward, reverse and round-trip engineering: generate class diagrams from existing code, keep models and code in sync, and know where the limits are.
Modeling Practice
- Choosing the Right Diagram Pick the right UML diagram for the question you need to answer: audience, abstraction level and purpose, with a decision table, a model-first workflow and a runnable chooser.
- OCL Constraints Learn the Object Constraint Language: invariants, preconditions, postconditions, navigation and collection operations, and how to check them in code.
- Design Patterns in UML See how UML documents design patterns: class diagrams for structure, sequence diagrams for behavior, and collaborations for roles, with Strategy, Observer and Decorator.
- Model Review and Common Mistakes Review UML models like code: a checklist per diagram, the most common mistakes with fixes, and a runnable model linter that finds naming and consistency problems.
Projects and Practice
- Project: Library System Model Build a complete UML model of a library: use cases, domain classes, a borrowing sequence and a book copy state machine, then check it with running code.
- Project: Online Shop Model Model an online shop at architecture level: components and interfaces, a checkout activity, a deployment view and OCL rules, then validate the wiring and rules in code.
- Project: ATM State and Sequence Model Model an ATM: a hierarchical state machine with PIN retries and timeouts, sequence diagrams for withdrawal, a contract for withdraw, and a running simulation.
- UML Practice Exercises Twelve UML exercises on state machines, components, deployment, packages, OCL and code mapping, each with a solution sketch and runnable checkers.
- UML Interview Questions Common UML and software modeling interview questions with clear answers: diagram types, relationships, state machines, components, OCL and modeling in practice.