CSE Roadmap

Common tier · about 2 hours · 7 parts

Part 4 of 7 · 1 min read

The six links

The words used in most diagrams and interviews.

Most modelling tools use a slightly larger set than GoF. These terms are common practice. Note that many sources use "aggregation" for a weak whole-part link and "composition" for a strong one, which differs from GoF's single word. Interview answers should say which meaning is used.

Link Meaning Lifetime Text sketch Java
Dependency Uses another briefly, such as a parameter Short A ..> B A method argument or local variable
Association Knows another over a longer time Separate A --> B A field holding a reference
Aggregation (weak whole-part) A whole holds parts that can exist elsewhere Separate A o--> B A field holding parts passed in
Composition (strong whole-part) A whole owns parts that end with it Shared A *--> B A field the whole creates itself
Inheritance A is a kind of B Same object A --|> B extends
Realisation A promises the interface B Same object A ..|> B implements

GoF's "aggregation" matches the strong version here, composition. GoF's "acquaintance" covers dependency and association.

A test for whole-part: ask whether the part makes sense after the whole is gone. A TimeSlot of a deleted booking has no use, so it is composed. A Room still exists, so it is only associated.

Multiplicity says how many objects sit at each end. Write it beside the line: Room 1 --- * Booking says one room, many bookings. Made-up numbers: a room has up to 16 bookings a day, and each booking has exactly one room.

Check yourself: 1. Which link is just a method parameter? 2. Which test separates composition from aggregation? 3. What does 1 --- * mean?