UML (Unified Modeling Language)
This article is a conceptual explanation of UML – including exam questions, core components, and tags.
In a Nutshell
UML is a standardized visual language for modeling software and systems. It helps to document requirements, design, and communication consistently.
Compact Technical Description
UML separates structure and behavior:
- Structure diagrams (e.g., class diagram, package diagram, component diagram)
- Behavior diagrams (e.g., activity diagram, sequence diagram, state diagram)
Relationships:
- Association
- Aggregation
- Composition
- Generalization
Cardinalities (multiplicities) describe relationships (e.g., 1, 0..1, 0..*). With OCL, constraints can be formally defined (invariants, pre-/postconditions) – tests can be derived from these.
Exam-Relevant Key Points
- Structure diagrams vs behavior diagrams
- Relationships correctly: association/aggregation/composition/generalization
- Cardinalities are a typical IHK exam point
- OCL for precise conditions → derive tests
- Model states with guards
- Version/review/approve models
Core Components
- Class/attribute/operation + visibility
- Relationships (association, aggregation, composition)
- Multiplicities + roles
- Packages/namespaces
- Components/interfaces
- Activity (decision, parallelism)
- Sequence (lifeline, message)
- State machine (guard, entry/exit)
- Stereotypes/profiles
- OCL + test derivation
Practical Example (Library)
Class diagram:
Reader 1..* Loan
Medium 1..* Loan
Loan: startDate, endDate
OCL invariant:
endDate > startDate
Advantages and Disadvantages
Advantages
- Common language for business/technical departments
- Earlier error detection
- Better test derivation
- Clear documentation
Disadvantages
- Learning curve
- Risk of overly complex models
- Loses value without maintenance
Typical Exam Questions (with Short Answer)
- Main categories of UML diagrams? Structure diagrams and behavior diagrams.
- Aggregation vs composition? Aggregation is weak; composition binds lifecycle.
- What is OCL used for? Formal constraints → tests.
Free Response
For the exam: prefer a few diagrams that are correct and consistent. Cardinalities and relationships must match business rules. Models should be versioned and linked to requirements/test cases.
Learning Strategy
- Reconstruct a class diagram from a small project.
- Create activity and sequence diagrams for a use case.
- Practice and justify cardinalities.
- Apply consistent naming/cardinalities consistently.