Académique Documents
Professionnel Documents
Culture Documents
Consider the previous Car Rental case study, we identified a list of candidate classes and methods from the following
problem statement:
Textual Analysis
• √ Identify classes
underline nouns
list and combine nouns
eliminate inappropriate candidate classes
• √ identify methods
underline verbs
list and combine verbs
eliminate inappropriate candidate methods
We had also identify additional methods for classes by going through external events
Page 1 of 6
Structuring Class Diagram with Relationships.doc
We eventually obtained a list of classes and methods from the previous object identification process as follows:
Classes Methods
If we associate the methods to the classes, you will see the following classes as follows:
Classes Methods Data
Page 2 of 6
Structuring Class Diagram with Relationships.doc
This heuristics does us always justify to add association between the objects, but only trigger us to think whether the
association should be linked between them.
Association Example I:
An object sends a message to another is not always to be essential for us to add association between them. Consider the
case below:
The Method RentVehicle in Customer object sends a mark_rented message to an object of class Car should be
considered to associate between them, because Customer is always required which car he rented. If the Customer
Object does not reference to the Car object, we would have to search the list of cars that the company had rented out
in an ad-hoc manner!
:Customer
:Car
rent_Vehicle
mark_rented
attributes
updated
Page 3 of 6
Structuring Class Diagram with Relationships.doc
Association Example II
Again does customer always need to “memorize" its own Contract? Does Customer object often need to reference (navigate)
from itself to the Contract to get retrieve information during the system’s operation? However, it will create the customer
object(s) instead of passing just passing messages to it. What is the implication of this? Let’s us elaborate this in the next
example.
Page 4 of 6
Structuring Class Diagram with Relationships.doc
√ textual analysis
√ external events
• organizing relationships among classes
√ associations
compositions
generalizations
Structural Analysis Process: Step II & III – identify Composition and Generalizations
Composition
It is a “has a” relationship. If an instance of the object (whole) is deleted, the corresponding instances of the part(s) will also
be deleted. n this case, we discover this kind of relationship existed among the objects.
Generalization
Vehicle is a generalization of Car
Vehicle is a generalization of Truck
Vehicle can hold data like vehicle identification number, date purchased, is the vehicle currently rented and so on. Car can
hold data like number of passengers, is the car a station wagon and etc. in additional to the attributes hold by the more
general object – Vehicle. Likewise, the Truck can hold specialized data like weight capacity and etc. as shown in the Figure
below.
Page 5 of 6
Structuring Class Diagram with Relationships.doc
– √ textual analysis
– √ external events
• organizing relationships among classes
– √ associations
– √ compositions
– √ generalizations
Page 6 of 6