<aside>
🏗️
L4.2 — UML: Class Diagrams covers the most common UML diagram type — class diagrams. These show the structure of a system: its classes, attributes, operations, and the relationships between them. Covers class notation (visibility, attributes, operations), parameter kinds (in, out, inout), association, aggregation (weak "has-a"), composition (strong "contains-a"), generalisation ("is-a" / inheritance), and how to distinguish aggregation from composition in Java code.
</aside>
At-a-glance Checklist
- [ ] Explain that class diagrams are structural diagrams showing classes, attributes, operations, and relationships
- [ ] Know the three rows of a class box: name, attributes, operations
- [ ] Use visibility symbols:
- (private), + (public), # (protected)
- [ ] Write attribute syntax:
visibility name [multiplicity] : type = initialValue
- [ ] Write operation syntax:
visibility name(kind param: type = default): returnType
- [ ] Distinguish parameter kinds: in (read only), out (produce only), inout (read and modify)
- [ ] Explain why
in is preferred over inout for display/read operations (clean design)
- [ ] Draw an association (solid line with optional label, arrow, multiplicity)
- [ ] Draw aggregation (empty diamond ◇) — weak "has-a", part can exist independently
- [ ] Draw composition (filled diamond ◆) — strong "contains-a", part cannot exist without the whole
- [ ] Distinguish aggregation from composition by asking: "does the part exist without the container?"
- [ ] Draw generalisation (hollow triangle arrow) — "is-a" / inheritance
- [ ] Identify where objects are instantiated in Java to determine aggregation vs composition
- [ ] Model a system as a class diagram from a use case description
1. What is a Class Diagram?
- A structural diagram showing the classes in a system, their attributes, operations, and relationships