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.

1

There are 1 answers

3
Gangnus On BEST ANSWER

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.