0

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.

LukyFoggy
  • 519
  • 8
  • 31
  • Any reason for asking the same question once again? – qwerty_so Sep 11 '17 at 21:38
  • 1
    Possible duplicate of [Is this uml class diagram of an ordering software correct?](https://stackoverflow.com/questions/46144115/is-this-uml-class-diagram-of-an-ordering-software-correct) – qwerty_so Sep 11 '17 at 21:38
  • @ThomasKilian I wanted to specify the question, since the last one seemed to confusing for people. – LukyFoggy Sep 12 '17 at 00:11
  • 1
    You are confusing domain models with data(base) models. A domain model is not a model of database tables, but a model of the real-world domain for which an information system or app is to be developed, see also https://stackoverflow.com/q/20529071?rq=1 – Gerd Wagner Sep 12 '17 at 07:08
  • What @GerdWagner said is correct. Anyhow, at SO you don't ask the same question twice but try to edit the question you asked until it's clarified. Please decide which to keep and edit with the above comment in mind. – qwerty_so Sep 12 '17 at 08:08
  • @GerdWagner I try to represent the structural aspects of my Domain Model with the class diagram I posted. – LukyFoggy Sep 12 '17 at 10:48

1 Answers1

0

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.

Gangnus
  • 24,044
  • 16
  • 90
  • 149
  • I understand the logic behind the Basket - class, but I´m not sure if how to implement the Basket in my current project. Would the Basket - class be between the Order - class and the OrderProduct - class, so all ordered products are stored temporary in the basket - object? And would this additional class affect my current ER-diagram? – LukyFoggy Sep 13 '17 at 12:32
  • If you want to use OrderProduct... I would name it OrderItem instead... Then OrderProducts instances will have references to appropriate Basket instance. That way is classic, but a bit hard for understanding for a novice. Basket logically fills the gap between User and Order you were talking about. Yes, Basket will appear on the diagrams, both ER and class one. I can image class diagram without Basket, but not ER diagram. – Gangnus Sep 13 '17 at 13:57
  • Thanks for your input. I thought I could create my class-diagram without any changes on the existing ER-diagram, but I will try to visualize your suggestions and think about them. – LukyFoggy Sep 13 '17 at 14:35