简体   繁体   中英

Are the relations of this domain model based uml class diagram correct and in which class should required methods be placed?

I´m currently trying to visualize a class diagram for an ordering software, in which an Employee/User is able to create new orders, which have information about the Customer , the Products , the current status and the Employee who works on that specific Order .

My problem is that I don´t know which methods should be called in which class. Should the method createOrder() be in the class Order to creat itself or in the class User , because the User creates the Order in the software.

The methods I try to place inside the classes are:

  • getAllOrders(), getMyOrders(), getAllCustomers(), getAllEmployees(),
  • getOrderByID(orderID), getCustomerByID(customerID), createOrder(),
  • createCustomer(), updateOrder(), updateCustomer(),

I would be very thankful for critiques and suggestion on my uml class diagram.

Image of my current domain model class- diagram .

Image of ER- diagram and a simplified state- diagram for a better understanding of my project (Both in one picture because I can only post two links.

I would advice you one more class - Basket. Every user has a basket, probably empty. An instance of the basket has a map of pairs Product - Number. Then it is obvious, what shall call createOrder() - the basket shall. At the moment, when the order is finished, the basket will lose it and will be free again.

As for GetAll... functions - make them static, or, in other words, belonging to the class, not instance. It is easy - each class can count or list its instances or specific instances.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM