Skip to content

Class Diagram & Design Decision Rationale

jordanbuch13 edited this page Oct 13, 2024 · 1 revision

UML Class Diagram and Design Decision Rationale

UML_Diag_V4

Rationale

Classes & Associations

  1. Decision: Employee and Customer are subclasses of the abstract Person class.
  • Explanation: This avoids repeated common attributes among customers and employees. Also, a user must be either a customer or staff, thus the Person class is abstract.
  1. Decision: Manager is a subclass of Employee.
  • Explanation: Again, this avoids repeated common attributes. Manager inherits all the attributes from the Employee class, where the isManager field can be set to True. This also allows Manager to complete tasks that only they can do (e.g.: game approvals, promotions, etc.)
  1. Decision: Order class
  • Explanation: Each instance of the Order class will contain a unique ID and order Number that can be used to track, view, and manage specific orders from the system and the user respectively.

  • The status field relates to the separate enum class Status. Here, an order can be defined as “PendingPurchase” when a customer has added games to their cart without purchasing yet.

  • Next, once customer has purchased the items in their Order, the status changes to “Delivered” (since delivery issues and tracking are outside the scope of this project).

  • Alternatively, the customer can cancel a pending order in which case, the order status is “Canceled”, and the order can be deleted.

  • Finally, a “Delivered” order can be returned by the customer, thereby changing its status to “Returned”. Customers and Employees can view the purchase histories by filtering for “Delivered” orders.

  1. Decision: Game class
  • Explanation: Each instance of the Game class has a unique ID that can be used to manage it from the backend. Also the game’s title, description, image, price, and stock can be viewed by the user (Person).

  • When an employee adds a game to the GameStoreSystem, the isApproved field is defaulted to False, thereby setting the archivedDate to the current Date, and archiving the game until it has been approved by a manager.

  • Once a manager approves (or if they themselves add a game directly), the isApproved field changes to True. When this happens, the archivedDate field is emptied (set to null), meaning the game is no longer archived and can be viewed by the customer.

  • Additionally, if an Employee needs to remove a game, or if the stock is down to zero, the archivedDate can be changed. This not only acts as a Boolean to track if a game is archived, but also records the archived date for staff records.

  1. Decision: PaymentInfo is a separate class from Customer
  • Explanation: Although the fields in PaymentInfo could have been included in the Customer class, having them as separate classes with a 1-to-many association allows a customer’s payment information NOT to be stored in the system if they so choose.
  1. Decision: Wishlist class
  • Explanation: Wishlist is a separate class from Order because there is no imminent purchase implied in a wish list. Indeed, a Wishlist simply allows customers to save games they are interested in.

Multiplicities Composition Associations:

  1. Review and Game
  • a. A review cannot exist without a game.
  • b. If a game is removed (archived) from the system, it is logical that all the reviews about this game are also removed.
  • c. A game can have multiple or zero reviews.

NOTE: A case could be made that Review should have a Composition association with Customer as well (i.e. A review cannot exist without a customer). Although this is true logically, it is illegal to have Review depend on 2 classes in a part-whole relationship (Customer and Game) without and {xor} branch between associations. Additionally, if a customer is removed from the system, it is still beneficial to keep their reviews about a game.

  1. Promotion and Game
  • a. Promotions apply to games and cannot exist without a game.
  • b. If a game is removed, the promotions on this game should also be removed.
  • c. A game can have zero or one promotion. If multiple promotions exist, only the highest one should apply to the game (i.e. promotions do not add up).

Unidirectional Associations:

  1. Wishlist and Game
  • A wish list requires access to information available in the Game class, while the opposite is not true: a game does not need to know if it is included in a wish list, much less the details of a specific wish list.
  1. Employee and Category
  • A category does not need to know the information of the Employee creating it.