educative.io

Should there also be a relationship between the Order and the LockerService?

When the customer puts in an order, they will choose the locker location closest to them per requirement 1. So I’m thinking that during the instantiation of Order (in setting up the deliveryLocation), Order will most likely call a LockerService function to return the list of locker locations available for the customer to choose from? This is where the Strategy pattern comes into play where the LockerService chooses the location closest to the customer, with available lockers that will fit the LockerPackage size?

Right now in the class diagram, the only association between Order and LockerService is the Notification class, which notifies the customer when the order is shipped.


Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Class Diagram for the Amazon Locker Service - Grokking the Low Level Design Interview Using OOD Principles

Hi @Yunfei_Xie,

The customer will place an order and if there is a need for a locker, he/she will use the locker service to get the list of nearest lockers and choose from them based on the size, which will be its new delivery location. That is how requirement number 1 fulfills.

Happy Learning :slight_smile: