Cinemas has City Class
City has List of Cinema class
How and Why is this one way association
Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Class Diagram for the Movie Ticket Booking System
Cinemas has City Class
City has List of Cinema class
How and Why is this one way association
Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Class Diagram for the Movie Ticket Booking System
Hi @Psbdassani !!
This one-way association between the Cinema
class and the City
class is established to reflect the relationship between these entities in the movie ticket booking system. Let’s break down how and why this association is implemented:
One-Way Association:
Cinema
class knows about the City
class, but the City
class doesn’t necessarily need to know about individual cinemas within it.Implementation:
Cinema
class has a reference to the City
class, indicating that each cinema is associated with a specific city.City
class does not have a direct reference to individual cinemas. Instead, it maintains a list of cinemas within the city. This list allows the city to access information about the cinemas it contains, but it does not establish a direct link from a city to an individual cinema.Reasoning:
Benefits:
Overall, implementing a one-way association between the Cinema
class and the City
class provides a clear and efficient way to model their relationship within the movie ticket booking system.
Happy Learning