Concept · Core

UML Relationships

The arrows ARE the design. Dependency, association, aggregation, composition and inheritance say exactly how tightly two classes are bound — and who owns whose lifecycle.

Asked atAmazonGoogleAtlassianMicrosoft
step 1 / 10
1/2The strength spectrum
usesdriveshas*owns1..*
Order
+ total()
TaxService
Driver
Car
Team
Player
House
Room
The strength spectrum
1// ⇢ depend — uses a parameter, stores nothing
2class Order { total(TaxService t){ ... } }
3 
4// → assoc — holds a long-lived reference
5class Driver { Car car; }
6 
7// ◇ aggregate — has-a, shared, part outlives whole
8class Team { List<Player> roster; }
9 
10// ◆ compose — owns, parts die with the whole
11class House { House(){ rooms = new Room[n]; } }
State
⇢ dependuses transiently (a param)

DEPENDENCY (⇢, the weakest). Order just USES TaxService — it’s a method parameter, nothing is stored on Order. When the call ends, the link is gone. Like taking a taxi: you use it, you don’t own it.