In: Computer Science
Consider the classes involved when modeling a bicycle and all its parts. Draw a domain model class diagram that shows the whole-part relationships involved, including multiplicity. Which types of whole-part relationships are involved?
Solution:
step: 1 of 2
Domain model class diagram:
Domain model class diagram is that the class exhibits about the objects in the problem domain.
• The domain class contains the attributes and associations.
Whole-part:
Whole-part relationship is the association between the classes in which one class act as a part or component for another class.
• For example, “bicycle€ is made up of parts such as body, wheels, breaking mechanism, and steering mechanism.
Notation used for whole-part relationship:
• The diamond shape in the diagram represents that the classes are divided into subclasses and it shows the whole-part relationship between the classes.
Domain model class diagram:
Consider that the following domain model class diagram uses the whole-part relationship to model the biycle and its parts:
In the above diagram,
• The “bicycle€ is the superclass and it is further divided into five classes.
• The diamond shape in the diagram represents that the superclass is “bicycle€ and it is further subdivided into classes such as bicycleFrame, bicycleBody, Wheels, and exteriror decorations.
• The superclass bicycle has its own attributes such as ProductDeveloper, year, and modelOfCar.
o The subclass bicycleFrame has its own attributes such as sizeOfFrame and specifications.
o The subclass BicycleBody has its own attributes such as no.of pedals, crossbar, seat post, no
of tires.
o The subclass wheels has its own attributes such as numberOfWheels.
o The subclass ExteriorDecoration has its own attributes such as colorOfbicycle and type of bicycle.
• Additionally the multiplicity constraint for all the classes are “1†because the frame, body, exterior decoration are one except the class wheels.
• This is because the bicycle contains four wheels so the multiplicity constraint is “4†for “wheelsâ€.
step: 2 of 2
Aggregation whole-part relationship:
In the above domain model diagram, the type of whole-part relationship involved in the diagram is aggregation.
• Because, the “bicycle€ is the individual component and its parts are defined separately as bicycleFrame, bicycleBody, Wheels, and exteriorDecoration.
_____________________
Happy learning
Give upvote!!