Design Amazon - Online Shopping System
Design Amazon - Online Shopping System
Here are the top use cases of the Online Shopping System:
Add product
Add product category
Update catalog
Block/Unblock
<<include>>
account
Modify product
Cancel
membership
Update account
Login/Logout
Admin
Add shipping
address
Customer
Checkout
<<include>> Make payment
shopping cart
Register account
Class diagram
Product: This class will encapsulate the entity that the users of
our system will be buying and selling. Each Product will belong
to a ProductCategory.
Item: This class will encapsulate a product item that the users
will be buying or placing in the shopping cart. For example, a
pen could be a product and if there are 10 pens in the inventory,
each of these 10 pens will be considered a product item.
ClassName
property_name: type Class: Every class can have properties and methods.
Abstract classes are identified by their Italic names.
method(): type
A B Generalization: A implements B.
Activity Diagram
Customer searches
More shopping
for a product
More shopping
More shopping
Update items in
the shopping cart
View shopping cart
Checkout
Sequence Diagram
1. Here is the sequence diagram for searching from the catalog:
Search Catalog
(/learn)
searchProducts(string)
getInfo(string)
addItem(productId, quantity)
verifyItem()
Verification Status
Operation success/fail
getItems()
Items
getBillingInfo()
getShippingInfo()
verifyItem()
verification Status
processPayment(billingInfo, amount)
paymentStatus
processShipment(address)
Shipment Status
Order Status
Code
Enums, data types, and constants: Here are the required enums,
data types, and constants:
Java Python
public class Address {
(/learn)
private String streetAddress;
private String city;
private String state;
private String zipCode;
private String country;
}
Java Python
// For simplicity, we are not defining getter and setter functions. The read
(/learn)attributes are private and accessed through their
// assume that all class
// public getter methods and modified only through their public methods func
Java Python
public class ProductCategory {
(/learn)
private String name;
private String description;
}
Java Python
public class Item {
(/learn)
private String productID;
private int quantity;
private double price;
Java Python
public class ShipmentLog {
(/learn)
private String shipmentNumber;
private ShipmentStatus status;
private Date creationDate;
}
Java Python
← Back Next →
(/courses/grokking- (/courses/grokking-
Mark as Completed
the- the-
object- object-
oriented- oriented-
Design
design-
a Parking Lot Design Stack
design-
Over ow
interview/gxM3gRxmr8Z)
(/learn) interview/m2YWoEq06AR)
Stuck? DISCUSS
Get (https://discuss.educative.io/c/grokking-the-object-oriented- 17
Send
help design-interview-design-gurus/object-oriented-design- Recommendations
feedback
on case-studies-design-amazon-online-shopping-system)