Java Reference
In-Depth Information
A further refinement is to eliminate those entities that do not really need to be modeled in the
system. For instance, the description identified various ways in which the taxi company might
be contacted: by individuals, hotels, entertainment venues, and tourist organizations. Will it re-
ally be necessary to maintain these distinctions? The answer will depend upon the information
we want from the model. We might wish to arrange discounts for hotels that provide large num-
bers of customers or send publicity material to entertainment venues that do not. If this level
of detail is not required, then we can simplify the model by just “injecting” passengers into it
according to some statistically reasonable pattern.
Exercise 14.2 Consider simplifying the number of nouns associated with the vehicles. Are
“vehicle” and “taxi” synonyms in this context? Do we need to distinguish between “shuttle” and
“taxi”? What about between the type of vehicle and “driver”? Justify your answers.
Exercise 14.3 Is it possible to eliminate any of the following as synonyms in this context:
“location,” “destination,” and “pickup location”?
Exercise 14.4 Identify the nouns from any extensions you have added to the system, and
make any necessary simplifications.
Using CRC cards
Figure 14.1 contains a summary of the noun and verb associations we are left with once some
simplification has been performed on the original description. Each of the nouns should now be
assigned to a CRC card, ready to have its responsibilities and collaborators identified.
Figure 14.1
Noun and verb
associations in the
taxi company
operates taxis and shuttles
receives a call
schedules a vehicle
transports a passenger
transports one or more passengers
calls the company
picks up passenger
arrives at pickup location
notifies company of arrival
notifies company of drop-off
From that summary, it is clear that “taxi” and “shuttle” are distinct specializations of a more gen-
eral vehicle class. The main distinction between a taxi and a shuttle is that a taxi is only ever con-
cerned with picking up and transporting a single passenger or coherent group, but a shuttle deals
with multiple independent passengers concurrently. The relationship between these two vehicles
is suggestive of an inheritance hierarchy, where “taxi” and “shuttle” represent subtypes of vehicle.
Search WWH ::

Custom Search