Ghost
Ghost

Reputation: 11

UML diagram confusion with associations

enter image description here

Question: What is the association error in the diagram and explain how it can be changed so it
 avoids duplication?

What I think: I suspect inheritance between motorbike and cycles as motorbike is not a "kind of" cycles and aggregation engine and motor vehicle as the motor vehicle is not a part of the engine. However, there should only be one error.

Upvotes: 1

Views: 94

Answers (1)

bruno
bruno

Reputation: 32596

I am not sure a motor bike is not a cycle because a bike can be a bicycle which is a cycle no ? Note also a bicycle can have an electric engine to assist : I have one, and it is not considered as a motor bike/cycle in the law. Anyway warning my English is low level.

Yes the aggregation is in the wrong direction, must be MotorVehicule <>---> Engine. Note it must not be a composition because the destruction of a vehicle does not imply the destruction of its engine(s). Note also a vehicle can have several engines, so the multiplicity is * rather than just 1. I prefer to not use 1..* because the engine(s) can be removed and even without engine the vehicle cannot move by itself it is still a motor vehicle.

The fact a FuelType can be 'electric' is bad for me because the electricity is not a 'fuel', better to rename FuelType to EnergySource or something like

Upvotes: 1

Related Questions