UML类图澄清 我想确保所需的规则是否得到满足。

huangapple 未分类评论47阅读模式
英文:

UML class diagram Clarification I want to make sure if the rules needed are fulfilled

问题

以下是翻译好的部分:

我正在创建一个汽车租赁项目,在这个项目中,客户可以管理客户、汽车、停车、预订、合同、账单和处罚。这是我的UML类图:

我不确定是否满足以下规则:

一个客户可以租用一个或多个已经存在于停车场的汽车。

我不确定这是否应该是汽车和客户之间的简单关联,还是是否应该将停车场也添加进去,从而成为三个类之间的关联。

感谢您的提问!

英文:

I am creating a car rental project where a customer can manage clients, cars, parking, reservations, contracts, bills and sanctions. this my UML class diagram :
I am not sure if this rule is fulfilled :

A customer can rent one or more cars that already exist in the parking lot.

I am not sure if it will be a simple association between the car and the customer or should I add the parking also to make it an association between 3 classes.

UML类图澄清 我想确保所需的规则是否得到满足。

UML类图澄清 我想确保所需的规则是否得到满足。

Thanks,

答案1

得分: 0

使用当前的设计可能会变得复杂。如果您引入一个名为CarStock的对象,其中包含所有Vehicle及其当前状态,这将更容易实现。当前的设计要求Client与所有Vehicle建立关联以选择其中一个。请记住工作方式:您前往租车公司请求一种车型,然后获得一辆车。您不需要查看公司拥有的所有车辆列表(从而获知谁租了哪辆车)。此外,ReservationVehicle之间的关系需要是一对一的。

ClientBill之间的关联是多余的,因为客户已经通过合同进行了身份确认。

英文:

With the current design that might turn out to be tricky. If you would introduce a CarStock which holds all Vehicles and their current status, this would be much easier. The current design requires Client to have associations to all Vehicles in order to pick a single one. Remember how things work: you go up the rental company and ask for a car type and you get one. You don't go through the list of all cars owned by the company (thereby having insight who rented which car). Furher the relation between Reservation and Vehicle needs to be a 1--1.

The assocation Client-Bill is superfluous since the customer is already identified via the contract.

huangapple
  • 本文由 发表于 2020年4月9日 22:02:08
  • 转载请务必保留本文链接:https://java.coder-hub.com/61122964.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定