educative.io

Https://www.educative.io/courses/grokking-the-low-level-design-interview-using-ood-principles/class-diagram-for-the-parking-lot

Payment and ParkingTicket has two-way association with each other, then why Payment class does not have object of ParkingTicket.
And why ParkingTicket has objects of Entrance and Exit classes since they are not even having association relation between each other?

It will be helpful if anyone can clarify this. Thank you.

For Reference : public class ParkingTicket {
// Following are the instances of their respective classes
private Vehicle vehicle;
private Payment payment;
private Entrance entrance;
private Exit exitIns;
}

Hello @siddharth_chatla,

The association between Payment and ParkingTicket seems to be designed in a way that each parking ticket has information about its associated payment, and each payment has information about the ticket it is associated with. This design choice allows for easy retrieval of payment details for a given parking ticket and vice versa.

The ParkingTicket class having references to Entrance and Exit classes suggests that each parking ticket is associated with a specific entrance and exit in the parking lot. This design choice may be useful for tracking a vehicle’s entry and exit points, especially if the parking lot has multiple entrances and exits. It can help record and manage vehicle flow through different parts of the parking facility.

Happy Learning :slight_smile: