mercredi 23 août 2023

Why are distinct classes necessary for Customer and Account in the design of the Amazon Shopping System?

I've been studying the low-level design (LLD) of the Amazon Shopping Website on Educative. In this context, I've come across two classes: 'Customer' and 'Account' (details provided below). Could someone offer insights into the reasons behind keeping these classes separate? How is this approach a better design than having a single class that combines the information from both?

Definitions

Customer: The Customer abstract class refers to a user trying to buy a product from Amazon. Hence, it can access the items present in the shopping cart through the getShoppingCart()function.

Account: The Account class accesses and showcases the personal details of the authenticated user and the admin, who are the two types of registered accounts available in the system. Users with an account will have the option to add and access multiple shipping addresses as well as add and delete different products and product reviews.

Class Diagrams: Customer Account

I am unable to figure out why this design is good

Aucun commentaire:

Enregistrer un commentaire