In one of the interviews, I was asked to design amazon like system and draw the class diagram. I have read numerous links and seen many videos on this topic.
But I was asked some specific questions like :
If amazon has lets say 50 Moto G5 phones, will there be 50 instances of Moto G5? Similarly, so for all inventory in amazon, will there be a single instance for each item?
From above phones, few are sold by different vendors at different prices, with different deals. So will all these information be stored in each instance, i.e. price will be different in each object and vendorId be different in each object.
Out of these 50 mobiles, if one mobile is sold, how will quantity get reduced. Will an instance of phone will be deleted, and will quantity will be a static variable in phone, which when decremented by 1, the quantity at all places will reflect same value. So basically quantity variable in on object will reflect quantity of all mobiles or not.
If amazon gets new inventory every hour, will it update its cache every time in one hour or is it based on an event.
I have tried to lookup answers for these questions, but could not find the optimal solution. Please help me understand this concept.