Search code examples
umlclass-diagram

UML class diagram design


I am trying to implement the UML class diagram for the first time. This is the class diagram which I have been work through: enter image description here

This is the requirement: enter image description here

I do not expect anyone do it for me, but I think I need someone help to check where I can improve or I anything is missing. Thank You.


Solution

  • A class diagram is a structural diagram. Behaviors (e.g. adding, deleteing, etc...) shall not appear therein, except if you decide to make them operations of one class.

    Here how to understand the requirements:

    • R1. Classes GroceryList, Item and User. Association between 0..n GroceryList and 0..n Item. Association class with property Quantity
    • R2. Class ItemType
    • R3. Association between 0..n Item and 1 ItemType. Both classes have a property Name
    • R6. Association class also has property CheckOff
    • R10. Association between 1 User and 0..n GroceryList. GroceryList has a property Name
    • Assumption: User has a property Name

    If your teacher never told you what an association class is, then use a class ListItem instead, with an association of 0..n ListItems with 1 Item, and a coposition link from GroceryList to ListItem

    Remove any other box in your diagram, because these are either behaviors, or a duplicate of an existing class.

    For the operations, it is not clear to me because it depends on the architecture of your application (e.g. will you use repository classes?).