Grokking the Object Oriented Design Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Confused by what uni-directional really mean...

Adrien

Aug 7, 2023

The description of uni-directional versus bidirectional association is confusing to me. You wrote:

• By contrast, in a uni-directional association, two classes are related - but only one class knows that the relationship exists. In the below example, only Flight class knows about Aircraft; hence it is a uni-directional association

But on the class diagram we see that Aircraft has a getFlights() method which seems to contradict this statement. Similarly the association between Airport and Flight is annotated as "Uni-directional" but we see that Airport has a getFlights() method and that Flight has some Airport-typed properties.

1

0

Comments
Comments
A
Adrien 2 years ago

To clarify: I understand we're not talking about simple dependencies between classes but here it's unclear why the association between Flight and Airport would not be described similarly to the FlightInstance and Crew one: i.e we could describe the Airport as "assigned"...

Raphael Reinauer
Raphael Reinauer2 years ago

The difference between the association of Flight and Airport to Airport and Flight is that the Flight class has two attributes that associate it with the Airport class:

  1. departureAirport of type Airport
  2. arrivalAirport of type Airport

On the oth...