[英]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
. 我目前正在尝试可视化订购软件的类图,其中
Employee/User
可以创建新订单,其中包含有关Customer
, Products
,当前状态以及在该特定Order
上工作的Employee
。
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. 方法
createOrder()
是在要创建自身的Order
类中还是在User
类中,因为User
是在软件中创建Order
的。
The methods I try to place inside the classes are: 我尝试放置在类中的方法是:
I would be very thankful for critiques and suggestion on my uml class diagram. 对于我对uml类图的批评和建议,我将非常感谢。
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. ER图的图像和简化的状态图 ,以更好地了解我的项目(两幅图合二为一,因为我只能发布两个链接。
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.
然后很明显,应调用createOrder()-篮应。 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. 至于GetAll ...函数-使它们成为静态,或者换句话说,属于类而不是实例。 It is easy - each class can count or list its instances or specific instances.
这很容易-每个类都可以计数或列出其实例或特定实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.