ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A2
p. 5 Classifying software.
a)*Custom; real-time.
b) Embedded; real-time.
c)*Generic; real-time (but soft real-time).
d) Custom; data-processing.
E1.2
E1.3
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A3
ANSWERS TO EXERCISES
E2.2
E2.3
p. 33 Naming different classes derived from words with multiple English meanings.
a)*Title: Describes published books independently of the number of copies CopyOfTitle: or perhaps
LibraryItem: Represents physical books (as well as other things, such as videos) that the library places
on its shelves.
b) VideotapeRecording; CopyOfRecording; VideotapePlayer (the latter meaning of Video
is only used in certain parts of the English-speaking world).
c)*RegularlyScheduledFlight: has a flight number, departure time, origin and destination and is
flown every day; SpecificFlight: flies on a particular day.
d) Series: has a name, description, producer, set of regular actors, etc.; Episode: has a length, a plot, and
other information that differs from episode to episode in a series; ShowingOfEpisode: has a start time
and date.
E2.4
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A4
p. 35 Identifying associations
a)*boughtFrom:ProductionCompany, producedBy:Producer, episodes:Episode,
leadActors:Actor
b) bookings:Booking
c)* meetingRoom: MeetingRoom
d) building:Building
e)*caller:CallParty, called:CallParty
f) productBeingProduced:Product,
E2.6
E2.7
p. 36 Identifying operations
In the following, operations that would probably be polymorphic are shown in italics, however, exactly which
operations are polymorphic would depend on the design.
a)*getArea, getPerimeterLength, getPoints, move, resize, rotate,
flipHorizontally, flipVertically
b) getName, getDepartment, getWard (except Doctor), getRoom (Patient only),
getDiagnosis (Patient only), getSpecialty (Doctor and Nurse only)
c) getName, getNumberOfPages (except Videotape), getRunningTime (Videotape only)
E2.8
E2.9
E2.10 pp. 41-42 Arranging potential classes into inheritance hierarchies (See also E5.21, p. 189)
In the following, the hierarchies are shown using indented text to save space. Whether it would be appropriate
to actually include all the classes in a given system would depend on the applications requirements. There are
many possible variations on these answers. Note: See also E5.21 for additional exercises based on these
problems.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A5
ANSWERS TO EXERCISES
a)*In this problem we create two separate hierarchies, Vehicle and PartOfVehicle. These could also
have something like Machine as a common superclass, although the problem suggested creating separate
hierarchies.
Vehicle
LandVehicle (Added)
Car
SportsCar
Truck
Bicycle
AirVehicle (Added)
Aeroplane
AmphibiousVehicle
PartOfVehicle
Engine
JetEngine
ElectricMotor
Wheel
Transmission
Vehicle could instead be divided into PoweredVehicle and UnpoweredVehicle; multiple
inheritance could be then used for superclasses of the vehicle leaf classes.
b) This problem is trickier than the last, since most students will initially not figure out the distinction among
the first three hierarchies.
EditionOrIssue (Added to represent members of a series, these can have copies)
EditionOfBook
IssueOfNewspaper
IssueOfMagazine
Copy (Added to represent physical things one can check out of a library)
CopyOfBook
CopyOfIssueOfMagazine
Publication (The general things that can have editions or issues)
WorkOfLiterature
Periodical
Magazine
Newspaper
PartOfPublication (Added)
VolumeOfBook (Changed name to make clearer)
Chapter
Author
Publisher
Author and Publisher could perhaps be given a common superclass such as LegalEntity
c)*Schedule (We will learn later that this may not be needed since the whole system stores the schedule)
RegularlyScheduledTrip (Added as a superclass representing something that runs at a given time)
RegularlyScheduledExpressBus (renamed for clarity)
BusRoute
ActualTrip (Runs at a given time on a given day; could also be called Run)
CharteredTrip (Renamed for clarity)
ScheduledTrip (Added to properly complement unscheduledTrip)
UnscheduledTrip (Runs on a route, but not at the normal time)
BusVehicle (Renamed from bus to distinguish different types of bus)
LuxuryBus
TourBus
2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIRE
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A6
d) ElectronicDevice (Added)
RecorderOrPlayer (Added)
VideoRecorderOrPlayer (Added)
VideoCassetteRecorder (Avoid 3-letter class names)
AudioRecorderOrPlayer (Added)
AudioTapeDeck
RemoteControl
TelevisionSet
WorkOfArt (Added)
Film (More general word than Movie, Sound Of Music would be an instance)
Song (Added for consistency)
VersionOfSong
RecordingMedium (Independent of the individual items recorded on it)
Cassette (Added, but may not be necessary)
VideoCassette (Added to complement AudioCassette)
AudioCassette
CompactDisc (Avoid 2-letter class names)
DigitalVideoDisc (Avoid 3-letter class names)
CopyOfRecording (Better name than item on tape; several could be on any RecordingMedium)
CopyOfFilm (Renamed for consistency)
CopyOfSong (Better name than song on CD)
The hierarchy of Cassette could be a hierarchy of Tape instead.
e)*Currency (Canadian Dollars and US Dollars are Instances)
ExchangeRate (Attributes or associations could be fromCurrency, toCurrency, rate)
FinancialInstitution (Added)
Bank
CreditUnion
CreditCardCompany (Visa and MasterCard are instances)
FinancialInstrument
ReusableFinancialInstrument (Added)
CreditCard
DebitCard
SingleTransactionInstrument (Added)
Cheque
BankAccount
Loan
ElectronicDevice (Added)
AutomaticTellerMachine (better than BankMachine)
BankBranch
f) HotelCompany (Hilton is an instance)
Hotel (Ottawa Hilton is an instance)
RentableSpace (Added)
HotelBedroom (Renamed from hotel room for clarity)
MeetingRoom (probably same as conference room)
Ballroom
Suite
Person (Added)
MeetingOrganizer
Guest
Booking (same as Reservation)
Event (Added)
CateredFunction
Meeting
Conference
ItemOnBill
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A7
ANSWERS TO EXERCISES
g) InsurancePolicy
AutomobilePolicy
HomePolicy
LifeInsurancePolicy (Renamed for clarity)
Transaction (Added)
Claim
PolicyRenewal
Deductable (Could also simply be an attribute)
Person (Added)
InsuranceClient (Could also simply be an attribute)
Beneficiary (Could also simply be an attribute)
InsuredProperty
h) ElectronicDevice (Added)
Telephone
PhoneLine
DigitalPhoneLine (Renamed for clarity, but digital may work better as an attribute)
ExtensionLine (Renamed for clarity)
PhoneCall
ConferenceCall
Feature
CallWaiting (Could be an instance of Feature instead)
CallForwarding (Could be an instance of Feature instead)
VoiceMail (Could be an instance of Feature instead)
CallStatus (Added)
CallOnHold (on hold may work better as an attribute of PhoneCall)
ForwardedCall (Forwarding information may be better as attributes of PhoneCall)
Caller
TelephoneNumber
VoiceMailMessage
VoiceMailBox
E2.11 p. 47 Describing how polymorphic implementations of certain shape operations would work.
a)*translate: In SimplePolygon (as inherited by Rectangle and RegularPolygon), and
EllipticalShape (as inherited by Circle), the method translate would move the center.
b) changeScale: In Rectangle, the method changeScale would multiply the height and width
by its argument. In RegularPolygon it would multiply the radius by the argument. In
EllipticalShape (as inherited by Circle) it would multiply the semiMajorAxis (which acts as
the radius) by the argument.
c)*getArea: In Rectangle, the method getArea would return height * width. In
RegularPolygon, it would compute the area by dividing the polygon into numPoints individual
triangles (see the answer to E2.30 for the detailed algorithm). Once this area is calculated, the total area of
the RegularPolygon would be calculated by multiplying the area of each triangle by numPoints. In
Circle, the method getArea would return pi * radius2.
d) The getCenter method inherited by Shape2D would always be used. No overriding methods would be
needed.
E2.12 p. 47 Incorporating new polymorphic operations into an existing class hierarchy.
There would be an abstract methods in Shape2D, since flipHorizontally and flipVertically
would make sense for all classes. There would have to be specific concrete methods in the following classes:
Ellipse (would just adjust the orientation since an ellipse is symmetrical)
Circle (would do nothing)
SimplePolygon (would simply adjust the orientation appropriately)
ArbitraryPolygon (would have to move each of the points)
2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIRE
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A8
E2.13 p. 47 Incorporating new classes into an existing class hierarchy that contains considerable polymorphism.
a)*IsoscelesTriangle: One might think of making this a subclass of ArbitraryPolygon, however
that would be inappropriate since you dont want it to inherit methods such as addPoint and
removePoint. A better solution is to make it a subclass of SimplePolygon. As attributes you would
have to store the baseLength and height, or else you could store one of the two values for angles and
the length of one of the sides, letting the other angle value and side be computed when needed. As
methods, you would need changeScale, setBaseLength, setHeight, getArea,
getPerimeterLength, getVertices, getBoundingRect, getBaseAngle, getTopAngle,
and perhaps setBaseAngle and setTopAngle.
b) Square: This should probably not be a subclass of Rectangle, since a Square can have a simpler
implementation than a Rectangle. One solution is to make a new sub-hierarchy with
RectangularShape as the abstract superclass (a subclass of SimplePolygon), and make
Rectangle and Square subclasses of this. However, it turns out that there will be almost no shared
attributes or methods between Rectangle and Square, except for those inherited from
SimplePolygon and above. Therefore, Square can be simply made a subclass of SimplePolygon.
In this case it would have a sideLength attribute, and methods changeScale, setSideLength,
getArea, getPerimeterLength, getVertices, getBoundingRect and getSideLength.
E2.14 p. 47 Designing the details of shape operations.
Methods addPoint and removePoint would have to maintain the points in order, since depending on
the order of the points, different shapes would result. Also, it is important to note that changing a point
would affect the geometric center(to visualize this, imagine adding some points far from the existing
points). The addPoint and removePoint methods would therefore either have to modify the center
instance variable, or else adjust all the other points so that the center remains the same.
E2.15 p. 47 Determining the methods needed to polymorphically implement an operation.
There would be separate getEnclosingCircle methods in each leaf class, and an abstract
getEnclosingCircle operation in Shape2D. Here are descriptions of the implementation of
getEnclosingCircle in the various leaf classes:
In Circle, the method getEnclosingCircle would simply return itself.
In the other leaf classes, the methods would compute the radius of the new Circle as the distance to the
farthest point from the centre; they would use the same centre as in the original shape.
The radius used for the enclosing circle of an Ellipse would be the semiMajorAxis.
The radius used by Rectangle would be sqrt((height/2)2 + (width/2)2).
The radius used by RegularPolygon would be the same radius as the original shape.
To compute the enclosing circle of an ArbitraryPolygon, it would be necessary to compute the
distance of each point from the centre and find the maximum of those distances.
E2.16 p. 48 Determining immutable operations that may return instances of a different class.
You might add a changeScale(x,y) method to several classes; this would distort a shape by a
different amount in the x and y dimensions. In RegularPolygon such a method would return an
ArbitraryPolygon (since the result would no longer be regular). Similarly, distorting a Rectangle
that was rotated would result in an ArbitraryPolygon.
The addPoint and removePoint methods of ArbitraryPolygon could be made to determine
whether the resulting shape was now in fact a Rectangle or a RegularPolygon, and return an
instance of the appropriate class.
Similarly, the changeNumPoints method of RegularPolygon might be made to return a
Rectangle if the number of points was set to four.
If you made either of the above two changes, you should presumably add changeNumPoints to
Rectangle that would convert one into a RegularPolygon or an ArbitraryPolygon.
(However, if the rectangle is not square, it is be unclear exactly where the extra point should be added.)
You would also need to add addPoint and removePoint methods to Rectangle and
RegularPolygon that would return instances of ArbitraryPolygon.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A9
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A10
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A11
ANSWERS TO EXERCISES
Advantages
Allows the programmer to easily
optimize his or her program if there is a
need to use both types of co-ordinate
system in different parts an algorithm
the programmer can quickly experiment
with the co-ordinate storage format of
each object to determine which gives the
best results.
Very simple; uses the least memory.
Same as above.
Disadvantages
Somewhat complex; could give bad
performance if the wrong type of
data is stored and the programmer
does not optimize.
// Now in PPoint
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A12
Design 5: (CPoint.java)
public double getX()
{
return x;
}
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A13
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A14
E3.2
E3.3
E3.4
p. 70 Determining differentiating features of framework-based applications, as well as its hooks and slots.
a)*Reservation framework.
Differentiating features:
- The classes of objects that can be reserved and their attributes, associations and other operations
- The attributes of the reservation itself, and perhaps subclasses representing different types of
reservation
- The classes of objects that a reservation can be made on behalf of
- The user interface
- Rules regarding the reservation, such as who can make one, whether the item can be reserved, etc.
Hooks:
- A function that would be called when a reservation is complete (e.g. to send an email)
- An function to call when reservations are full that could be used, for example, to add a waiting list,
or to give some form of notification to the user.
- A function called to load a reservation from a database.
- A function called to save a reservation.
Slots:
- There may be no slots in this system.
b) Scheduling framework.
Differentiating features:
- The classes of events to be scheduled
- The classes of objects that will be attend/operate the event
- Rules for how scheduling is managed
- Automatic scheduling algorithms
- The user interface
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A15
ANSWERS TO EXERCISES
Hooks:
- A function to be called when an the time for an event arrives (e.g. to sound an alarm or send an
email)
- A function to be called when a reservation changes (e.g. to notify people of changes)
- A function to be called when an event is complete
Slots:
- There may be no slots in this system.
c) Language-processing framework.
Differentiating features:
- The grammar or patterns
- The actions to be taken
- The feedback on inappropriate input
- The sources of input
- The destinations of output
- The chunk size of input (whether the input is processed one token at a time, one line at a time or a
file at a time, before any actions can be taken).
Hooks:
- A macro pre-processor that would be invoked prior to processing input.
- A post-processor that could do extra processing on the output.
- A logging mechanism that would count the commands, statements, etc. processed.
- Code to generate understandable output when certain kinds of standard errors are encountered (e.g.
nothing matches the input, end-of-file, etc.). Most of the time, you would expect these hooks to be
filled, but there may be certain applications where the default do-nothing response is needed.
Slots:
- There may actually be no slots. This would mean that the basic system could function by having a
user interface simply call the services.
E3.5
E3.6
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A16
Generic mechanism, given two cities, that would calculate how many points would be required to
fly between them for free for a given user. This would be called when customers are doing queries,
and also when a person actually books a free flight to determine how many points to deduct. This
would call the first slot below to do detailed calculations.
Generic mechanism, given two cities, that would calculate how many points to credit to a particular
frequent flier who pays for a ticket. It would be called when the user is making queries, and also
when a person actually takes a flight, in order to credit points. This would call the second slot below
for detailed calculations.
Generic mechanism that runs every month, calling the slot (below) for producing reports, and the
hooks (below) for deleting inactive accounts, and perhaps promoting users to different classes.
ii. Slots (code that must be provided)
A method to evaluate rules regarding how many points are required to fly certain routes for free.
A method to evaluate rules regarding how many points are obtained from flying certain routes
(might be specific to certain classes of frequent flier, certain times, etc.)
A method to produce a formatted printout of a frequent fliers account (each airline may want to
make these appear stylistically different from other airlines). Note that instead of creating a slot, this
functionality could be left out of the framework entirely.
Note that the user interface would have to be provided, but would probably not actually appear as
slots in the basic system; the user interface would be a separate subsystem that would simply call the
services.
iii. Hooks (places where optional add-ons can easily be plugged in)
Ability to manage additional types of information about frequent fliers (e.g. work address, email,),
beyond the basic minimum information. Different airlines might want to keep different kinds of
information for use in marketing etc.
Ability to have different classes of users (e.g. prestige users who have accumulated large numbers of
points)
Mechanism to delete accounts after a certain time period with no activity (this might be activated by
the monthly run that prints reports)
Ability to add different kinds of points to be used for different purposes (e.g. some airlines, in
addition to miles, also keep track of a separate count of miles flown in first class; such points might
have different rules, such as expiring after the end of a year).
b) If you wanted to create a horizontal framework that would work for any kind of frequent buyer program,
your framework would be much more basic and generic. For example, it would not have such specific
classes as Flight, instead you would have more general superclasses of these such as Purchase. Such
a framework would require considerably greater effort to turn into a frequent flier application.
i. Services:
Maintenance of accounts to which points can be added and redeemed (same as in part a, above)
Maintenance of basic personal information (same as in part a)
Keeping a record of transactions (unlike part a, this would not have any specialized knowledge of
flights with origins and destinations)
Methods to add, delete and query the number of points (same as in part a)
ii. Slots (code that must be provided)
A very simple framework such as this may not have any slots it might simply provide the above
services that could be used by any software that wants to add and delete points.
iii. Hooks (optional add-ons)
Ability to add extra details to each transaction (e.g. so that each transaction could track the flight
number, origin and destination city)
Ability to add extra details to the personal information (similar to part a)
E3.7
p. 70 Evaluating whether or not one should first develop a framework when designing an application.
a)* Arguments in favour of developing a full frequent flier framework:
Developing the framework improves your overall design. Since you would have to build flexibility into the
framework to allow it to be used by others, you would benefit from that flexibility when you have to make
changes yourself.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A17
ANSWERS TO EXERCISES
As a consequence of the above, you would expect maintenance costs to be reduced; you would also expect
to be able to respond faster to market-driven requirements changes.
You might be able to sell your framework to others, or to provide frequent-flier services to other smaller
airlines.
Should two airlines using the same framework decide to work together in an alliance (or to merge) their
systems would be more compatible with each other, reducing costs.
b) Arguments against developing a frequent flier framework:
The time to develop a framework, although an investment, might somewhat delay the day when the first
release is available. This is probably the biggest obstacle.
The total amount of code might be greater than if you did not use a framework, so if you do a bad job of
designing the framework and have to abandon it, you have lost more.
It might require greater effort to convince management that framework-development is the best approach.
E3.8
E3.9
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A18
E3.10 p. 79 Evaluating the balance of work on the client and server side of a system.
a)*For an airline reservation system:
i. Server work: See exercise E3.9.
ii. Client work:
Enter queries about available flights and display the results.
Enter bookings
Display and print itineraries
iii. Information transmitted from server to client:
Results of queries (relatively simple text)
iv: Information transmitted from client to server:
Simple commands and their arguments.
v: How the clients work could be minimized or maximized:
The client might be interacting with several different reservation systems, producing overall
itineraries that would combine the results from several servers. A server could be developed to
provide this function interacting with other servers and managing itineraries.
The client could, on the other hand, be given a lot of intelligence to work out itineraries and good
deals. It could find the best prices, and even run a bidding mechanism that would try to get airline
servers to give better deals.
The client could simply be a web browser with no intelligence at all about the frequent flier domain.
vi: Network effects of changing the clients workload:
Putting more intelligence into the server (such as having the server interact with other servers)
would have only a moderate effect on the quantity of information transmitted in the network as a
whole.
Adding extra intelligence to the client might result in large numbers of queries being transmitted,
and large numbers of replies returned. The client would need to perform these queries in order to
marshal the information it needs to make decisions.
Having the client become nothing more than a web browser, would probably increase network
traffic from the server to the client, since now the server would have to transmit images and all the
other information that will make the UI of the client look nice.
b) For a toll-free number server:
i. Server work: See exercise E3.9.
ii. Client work:
Making calls (it asks the server for the actual toll number to call and bill)
Presenting statistical information to phone company systems.
iii. Information transmitted from server to client:
Very simple pieces of data (primarily phone numbers)
iv: Information transmitted from client to server:
Very simple commands
v: How the clients work could be minimized or maximized:
For this application, the client could cache the mappings so that if telephone users repeatedly dial
the same toll free number within a specified period of time, the client would not have to repeatedly
query the server.
The database of mappings could be distributed to several sites so that the impact on any one server is
reduced.
vi: Network effects of changing the clients workload:
Caching would reduce the total number of queries needed.
Distributing the database would mean that queries could be made locally if there was a local server.
c) For a central building alarm server:
i. Server work: See exercise E3.9.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A19
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A20
A21
ANSWERS TO EXERCISES
b) Toll-free-number server
Messages to server
queryNumber tollFreeNumber
mapNumber tollFreeToMap callerNumber
usageCount tollFreeNumber
c) Building alarm system. Note that if this system was set up on the Internet, it would be a prime target for
hackers. Such a system needs to be either on a dedicated network, or to incorporate sophisticated
encryption and other security features.
Messages to server
Possible replies to client
alarm unitNumber alarmType
acknowledge
- Signals that an alarm condition has been detected by a sensor
statusReport unitNumber status
acknowledge
- Reports that the sensor is working well (or not); if a server does not receive such a message at a
specified interval, it might display a trouble signal.
listStatus
statusReply unit status unit status
- Used by the systems main console client to obtain information about all the sensors
addUnit type description address responseNum unitAdded assignedUnitNumber
- Used to add a new sensor, whose input the server should expect, and to specify what response to
take when the server receives an alarm from this sensor.
removeUnit unitNumber
acknowledge
- Used to indicate that a sensor is no longer part of the system
addResponse responseNum phoneNum action acknowledge
- Used to specify one of several possible responses to different types of alarm
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A22
E4.2
E4.3
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A23
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A24
E4.5
E4.6
E4.7
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A25
ANSWERS TO EXERCISES
E4.9
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A26
A27
ANSWERS TO EXERCISES
- Complete sale
Telephone operator supervisor
- All telephone operator functions
- Display statistics about operators
- Override default pricing
E4.14 p. 126 Creating a list of use-cases for the microwave oven system.
Open door, halting cooking
Set cooking by time
Set cooking by auto-reheat without temperature
Set cooking by auto-reheat with temperature
Set cooking by auto-defrost without weight
Set cooking by auto-defrost with weight
Set time of day
Start cooking
Press start while door is open
E4.15 pp. 129-130 Describing the type of requirements document needed.
a)*Software controlling a manned spacecraft sent to Mars
There would need to be a considerable amount of detailed technical requirements documentation.
Technical terminology could be used since all readers would be expected to have a technical
background. There would probably initially be a very high-level description of the missions overall
objectives used to obtain funding for the mission. Then there would be a requirements document for the
high-level system requirements of the combined hardware-software system. Next, the system would be
allocated into hardware and software subsystems, which in turn would each be divided into several
subsystems. At each level there would probably be general and detailed requirements documents. The
rationale for this level of detail is that a spacecraft is novel, is technically complex, will involve many
different people with different types of expertise to develop, is difficult or impossible to change once
launched, and is expensive (with high failure cost and hence a high level of required reliability).
b) Payroll software for a large company
This will require somewhat less documentation than the spacecraft, but since the company is large, it
will probably involve significant complexity in its payroll (perhaps several different unions, stock
options, different pension plans etc.). There will thus need to be a high level requirements document, as
well as requirements for several different lower-level subsystems. Readers of these documents may no
little or nothing about computers (they will typically be managers, human resources staff etc.)
c) Computer game software for a cell phone
Computer game software in general can be quite complex with many different subsystems. However,
on todays cell-phones the amount of functionality is likely to be rather limited, hence the game will
probably be quite simple. Probably just one reasonably detailed requirements document will be needed.
d) Software to search email folders
This is probably a rather simple function that might be developed for personal use with little need for
formal process. However, if the function is to be part of a larger system, a single short requirements
document would probably suffice.
E4.16 pp. 135-136 Finding problems in requirements statements.
a)*Simple interest calculation program
The requirements are not separated into individual points
This is a handy utility is too informal
It is not clear whether the fields are updated upon every keystroke, or whether the user has to hit enter
or click on some button to cause an update of the fields.
It is not clear whether the monthly payments are at the start or end of each month (this effects the
computation).
(The computations themselves are well-known by accountants, so it is legitimate to exclude them)
There is no information about the platform on which the program runs,
2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIRE
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A28
Maximum and minimum dollar amounts and interest rates that can be handled should be specified.
Precision of calculations should be specified.
What happens if the user enters invalid keystrokes?
It would be desirable to describe the user interface in a little more detail.
b) Dispatcher automation system (this is a particularly atrocious requirements statement for such a critical
system!)
The requirements are not separated into individual points
It doesnt seem even remotely realistic that a voice recognition system could classify cases; this has to
be a human function.
What happens to non-urgent cases?
How can, in general, the ambulance dispatcher receive the patients record? The patient may not have a
record on the system or may be too badly sick to provide sufficient information to look up the record.
What information is in the record?
How is the summary of the conversation with the operator created, and what is in this summary?
It is unclear the difference between the dispatcher and the operator. And the fact that there is a
difference seems confusing and likely to result in dangerous delays.
In what format is all the information about the case made available to the ambulance operator? And
what constitutes all the information?
c) Inventory recording system
This requirements documents delves into the design aspects of the UI and the exact naming of the
fields. This offers way too little flexibility when actual design is to take place.
The word number is ambiguous. Does it mean the number of items, or some kind of identifier.
Inconsistency between the terms product id and product code.
A dialog box with list of product ids would be impractical in a warehouse with thousands of product
types.
What does add a product code mean. Does it mean entering an existing product code by searching for
a matching description? Or does it mean adding a totally new type of product. Probably the latter, but
you have to be crystal clear in requirements.
Inconsistency between Clerk and Staff member.
After the system prints out the sticker with the bar code, it clears the fields. But what if there was no
paper in the printer, and so the sticker was not actually printed? If the staff member tries again, the
system will record that an extra item is in inventory! Also, there needs to be better feedback that the
sticker has printed more than simply clearing the fields; this does not tell the user anything
informative.
What happens if barcode is illegible?
What happens when two identical products are in the warehouse but have different codes due to user
error?
No non-functional requirements described.
E4.17 p. 136 Rewriting requirements to remove defects.
a)*Simple interest calculation program
Functional Requirements
- When the system starts, a window appears, whose content and function is describe below.
- The window has the title Simple Interest Calculation, as well as standard close and minimize icons
in the title bar.
- The window has labels Principal:, Annual interest rate:, Interest paid at the end of each month:.
The right edges of these are vertically aligned, and each is followed on the right by an input field
- The principal and interest fields are capable of accepting 10 characters of input, the interest rate field
is capable of containing 8 characters.
- The user may enter numeric values in each field; as each key is typed (including the delete key), the
other fields are updated instantly. An empty field is taken as having the value zero.
- Editing the interest rate causes a change to the monthly payment.
- Editing the monthly payment causes a change to the interest rate
- Editing the principal causes a change to the monthly payment
- The user may use the mouse to move the insertion point or select characters in any field, as in
standard Windows applications.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A29
ANSWERS TO EXERCISES
- The system can handle dollar amounts from -999999.99 to 9999999.99, and interest rates from 999.99% to 999.99%. The percent symbol is automatically added if the user does not specify it.
- All calculations are rounded to the nearest cent. Two decimal places are always shown in all three
places.
- Any edit to a field that would result in an invalid input, or a computed result that could not be
displayed in the other fields, will not be accepted the system will beep and display an error
message at the bottom of the window describing the error. Error messages include:
The largest value accepted for <field> is xxx
The smallest value accepted for <field> is xxx
Input must be numeric
Input is only accepted to two decimal points
A <field> input value of xxx would result in an invalid value for <field>
Non-functional Requirements
- The program will run on all Microsoft Windows operating systems starting with Windows 95 and
Windows NT 4.0 (on all CPUs of at least 33Mhz).
- Response time will appear instantaneous to users.
b) Dispatcher automation system
To be provided at a later date.
c) Inventory recording system
Functional requirements:
- When system starts, a window appears with contents and functions as described below:
- The window has title Warehouse management system and the standard window icons
- At the top of the window are two fields identified as Product Code and Number of Items
- Below this is a button labelled Record arrival of items. This button is emphasized in the standard
way to show that pressing return will activate its function.
- Below this button, separated visually from the above, is a field marked 'Description of new product
that lacks a code'
- Below this is a button marked Create a new product code with the above description, and record
arrival of items'
- Each of the labels is right-aligned and each is followed by a text field
- The Product Code field is capable of accepting text of unlimited length, but displays at least 25
characters (the user has to use the mouse to scroll the field left or right if there are more than 25
characters in it.
- The Number of items field is capable of accepting a positive integer up to 6 digits. Attempts to
enter non-digits into this field will result in the computer issuing a sound and not accepting the
pressed key.
- The Description ... field is capable of accepting any string up to 500 characters long.
- When the user clicks on the Create a new product code button, a new product code appears in the
product code field.
- When either button is entered
- A set of products is considered to be entered into the database and stored inside the warehouse.
- Barcodes labels are then printed for use at retrieval of the product from the warehouse and
removal from the database.
- The number of barcode labels printed equals the value of the number of items field.
- If the user omits the Product Code when clicking the Record arrival button, then the system will
display a scrollable list of all currently valid product codes along with their description for the user
to select.
- Upon selection from this list, the product code appears on the first screen, ready for the user to
click the 'Record arrival' button.
- If the user types a Description when clicking the Record arrival button, the system will display a
message indicating that the description is not needed and will take no action. The description is
highlighted so the user can press the delete key to remove it if he or she wants to do that.
2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIRE
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A30
- If the user omits the Description when pressing the Create new product code button, a
message will be displayed prompting the user to provide a description, and no change is made to the
database.
- If the user omits the Number of items field, it defaults to 1.
- When the system reads a barcode, one item of the specified product code is removed from the
database. If the barcode is unreadable, the system will ask the user to input the barcode number into
a dialogue box.
Non-Functional Requirements
- The program will run on all Intel based processors having a processor speed of at least 100MHz, and
having at least 32MB of RAM.
- Response times to user input are no more than 0.1s at any time
- Response times when reading the barcode are no more than 0.2s at any time
E4.18 p. 136 Reviewing requirements for the microwave oven system.
Here are a few possible flaws in the microwave oven example:
According to the requirement 2, the user can not interchangibly press the power button while setting the
time. Yet, these two have no impact on each other theoretically.
Entry of time of day in requirement 4 requires four digits (i.e. the user has to enter a zero, prior to entering
1-9). This is awkward; the system should allow the entry of times up to 9:59 using 3 digits.
Should consider the option of allowing a 24 hour clock instead of imposing 12 hour clock in requirement
5.
Requirement 7: Would you want to display invalid sequences, or just valid ones?
Requirement 10:
- Is the amount of steam really a good indicator of the fact that the food is warmed up properly. (eg. The
outside is nice and cooked, but the inside of the food may still be frozen solid!)
- A tone could perhaps be emitted when the system updates the time estimate for auto-reheat
We would like the input of readers in case there are additional comments. Email us at tcl@site.uottawa.ca
E4.19 p. 141 Reviewing requirements for the GANA system.
Here are some possible issues, we invite readers to send us others:
The system should perhaps automatically adjust the brightness according to the ambient lighting conditions
so that it is always readable.
There is no way to completely turn the system off.
E4.20 p. 146 Reviewing requirements for SimpleChat.
We invite the comments of readers.
P4.1
P4.2
P4.3
P4.4
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A31
ANSWERS TO EXERCISES
The proposed software system will be used to manage the front-desk activities of a hotel. It will be able to
accept reservations, to record information about the hotel guests, to verify room availability, and to allocate
rooms to guests.
B. Background information:
See Lethbridge and Laganire Object-oriented Software Engineering page 149 for a short description of the
problem. Note that the writing of this document would normally have been preceded by a sound domain
analysis.
C. Environment and system models:
In its first version, the SHORS will be a simple application to be run from a single computer. The second
version should be a client/server system where the client component is used to manage the reservations and
the server centralizes the corresponding data. A third version is also envisaged where guests will be able to
make their reservations from the Internet.
D. Functional requirements:
`
1. Guest
1.1.
1.2.
1.3.
1.4.
1.5.
1.6.
The information associated with each guest is: name, address and phone number.
The full name of a guest is represented by a single string of characters.
Guests are searched using a substring, any guest name that contains that substring is returned by the
search operation.
The address of a guest is represented by a single string of characters. This contains the complete
address (street, city, postal code, )
The phone number is represented by a string of characters.
An account can be printed and contains the information about a guests stay and the amount to be paid.
The printed account also includes the name of the hotel and the date at which it has been issued.
2. Room
2.1.
2.2.
2.3.
2.4.
2.5.
2.6.
2.7.
2.8.
2.9.
2.10.
2.11.
2.12.
2.13.
2.14.
Each room has a number. Some of them are also designated by a special name.
A quality level is associated with each room.
A quality level is identified by a number. Standard rooms usually have quality number 0. This number
increases as the quality of the associated increases.
Quality level can also be given a name.
A list of characteristics is associated with each quality level. It describes the equipment common to the
room having this quality level as well any other special elements such as location, views or privileges.
All rooms having the same quality level have the same maximum daily rate.
The maximum daily rate is for one person. There may be an additional charge for each extra person.
The room charge per night can be less than the specified daily rate.
A room is either smoking or non-smoking.
A room contains a certain number of beds, all of the same type. Typical configurations are 2 Queen
beds or 1 King bed.
Some rooms can adjoin 1 or 2 other rooms.
Adjoining rooms always belong to the same quality level.
Equivalent rooms are said to belong to the same category. When a guest makes a reservation, recording
the room category is sufficient. On check-in, any available room of the required category can be
assigned to the guest.
Two rooms are equivalent if they belong to the same quality level, they have the same smoking status
and they have the same type and number of beds.
3. Reservation
2002 TIMOTHY C. LETHBRIDGE AND ROBERT LAGANIRE
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
3.1.
3.2.
3.3.
3.4.
3.5.
3.6.
3.7.
A32
To make a reservation, the guest must specify the arrival date and the departure date (or the number of
nights) for the proposed stay.
Normally, a room is not allocated when a guest makes a reservation, the room allocation being made
only when the guest checks in.
A reservation is accepted only if rooms are available.
A room is available if the total number of rooms of the required category is greater than the number of
rooms of that category requested by the reservations, throughout the specified period.
When a reservation is made for a suite (i.e. two or more adjoining rooms), the room allocation must be
done immediately.
A reservation is for one guest, for one sequence of consecutive nights for rooms of one category.
A reservation can be cancelled at any time.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A33
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A34
E5.2
Vehicle
Wheel
b) In the following, there could also be a class VideoRentalShop that might have one-to-many
associations to both RentableItem and Member. We will see in Chapter 6 that such a class is a
Singleton class; often when drawing domain diagrams we do not need to explicitly show it, since its
presence is understood, and it makes the diagram more complex. The following diagram could also have
been shown as an association class (as in Figure 5.7). Many students will think that there should be an
association called purchase; this is a common error, since purchase is an action, not an association.
Adding a class Membership (as distinct from Member, or in place of Member) is another possible
variant.
RentableItem
Rental
Member
c) A one-to-one solution might seem obvious for this exercise, however we have chosen a * to 0..1
multiplicity pattern for the following reasons: The 0..1 multiplicity is used because there might be cases
where you know a country, but do not know the head of state, or perhaps the head of state has been
deposed and no new one has been appointed/elected. The * multiplicity at the Country end accounts for
those situations where two independent countries have the same person as the head of state (e.g. Queen
Elizabeth II is formally head of state of several countries). The 0..1 at the HeadOfState end could
perhaps be changed to 1..* since it seems reasonable that a head of state must have some state of be head
of!
Country
* HeadOfState
0..1
There is another issue which could give rise to a different answer to this exercise. If the system in question
was describing the history of various countries, rather than the current status of each country now, then the
multiplicity might be * to * (or 1..* to *).
d) This answer is actually shown on page 161! If you flip the diagram so Student is on the right ad
CourseSection is on the left, you will see that the answer is also analogous to part b. Those readers
who bother to read ahead and make the appropriate connections will benefit. There could also have been a
School singleton class. CourseSection could also have been called CourseOffering. However,
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A35
ANSWERS TO EXERCISES
Course on its own would have been a much weaker choice since it is important to distinguish the
multiple offerings of a particular course. Registration could have been shown as an association class,
as in Figure 5.7.
Student
Registration *
CourseSection
e) This is largely analogous to parts b and d. You could conceivably leave out the class Registration if
you did not need to store information such as whether a particular member has paid for the particular
activity. Also, we have not given the class Activity the name ActivityOffering, although this
would be a valid alternative.
Member
Registration *
Activity
f) This is analogous to part b, d and e. Class LibraryItem could also be called BorrowableItem,
CopyOfPublication etc.
LibraryItem
Loan
Patron
g) We have shown the TheatreCompany singleton in the following, but it could be omitted. A
presentation could also theoretically involve many plays, so the right-hand association could be many to
many.
TheatreCompany
E5.3
* Presentation *
Play
p. 160 Explaining the consequences of associations in terms of creation and destruction of instances
This exercise has several parts that are strongly analogous to each other, and which turn out to be candidates
for association classes, which are described on page 161.
a)*A Vehicle could exist, and then a Wheel could be created and associated with it; conversely, the wheels
could exist first. Similarly, the order in which these associated objects are destroyed does not matter.
b) The RentableItem would be expected to exist before it is rented i.e. before an associated Rental
object is created. A Member, on the other hand might be created at the time of rental, if this is the first
rental. If a Rental is destroyed, then it would not automatically have an impact on instances of Member
or RentableItem. However, if a RentableItem or Member is destroyed, it makes no sense to keep
associated instances of Rental, so these should either be destroyed first, or at the same time as the
destruction of the Rental. Of course, you may prevent a Member from being removed while he or she
still has some Rentals.
c)*Under normal circumstances in the real world, a country exists over a longer period of time than any of its
heads of state. However, if we imagine an information system storing biographical information, then a
person might be created in the system who later on is recorded as the head of state of a country. So there
are no necessary constraints on the order of creation or destruction of these instances.
d) This part is similar to part b. The Registration would be created after both the Student and he
CourseSection, and would have to be destroyed first, or at the same time as its Student or
CourseSection.
e)*This is similar to parts b and d. The Registration would be created after the Member and the
Activity, and would have to be destroyed no later than these associated instances. (In some
circumstances, the Member and the Registration could be created together).
f) This is also similar to parts b, d and e. The Loan would be created after the Patron and the
LibraryItem, and would be destroyed no later than these. (In some circumstances, the Patron and the
Loan could be created together).
g) This would typically be handled in the same way as parts b, d, e and f in the sense that a Presentation
should require the prior existence of a TheatreCompany and Play. However, you could imagine a
situation where the Presentation is planned first (i.e. a time-slot in a theatre schedule), and then a
TheatreCompany is booked to perform in that time slot. In that latter circumstance, the theatre
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A36
company could be disbanded, without requiring the destruction of the Presentation (some other
company could take its place).
E5.4
E5.5
SportGame
PlayingRecord
positionPlayed
goalsScored
penalties
timeOnField
b) The association class Ticket might include attributes seatNumber, ticketNumber, price, and
dateBought.
Spectator
Show
Ticket
seatNumber
ticketNumber
price
dateBought
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A37
ANSWERS TO EXERCISES
c) The
association class Stay might
plannedDepartureDate, and roomRate.
include
Guest
attributes
such
as
dateArrived,
HotelRoom
Stay
dateArrived
plannedDepartureDate
roomRate
E5.6
*
isMutuallyExclusiveWith
*
prerequisite
PrerequisiteReason
MutualExclusionReason
description
description
*
materialNeededBySuccessor
E5.7
*
overlappingMaterial
Topic
p. 162 Transforming association classes and their associations to regular associations and classes.
This is a surprisingly tricky question. Firstly, students have to realize that, unlike in Figure 5.7, for each
association there will only be two classes involved, instead of three.
For the prerequisite-successor association, the transformation is then relatively straightforward: it becomes
a pair of associations (each PrerequisiteReason has two separate many-to-one associations with the
Course class.
The isMutuallyExclusiveWith association, on the other hand, represents a symmetric relationship.
It is therefore unreasonable to give MutualExclusionReason two separate but identical many-to-one
associations to Course; instead, the two associations should be merged into a single many-to-two
association!
After making these transformations, advanced readers might realize that the class names
PrerequisiteReason and MutualExclusionReason should perhaps be changed to the simpler
namesPrerequisite and MutualExclusion.
mutuallyExclusivePair
successor
Course
prerequisite
*
PrerequisiteReason
description
description
*
*
materialNeededBySuccessor
MutualExclusionReason
*
Topic
*
overlappingMaterial
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
E5.8
OrganizationalUnit
Department
E5.9
A38
Division
Employee
ProfessionalEmployee
TechnicalEmployee
SupportEmployee
p. 168 Drawing a class diagram corresponding to an instance diagram (See also E6.3, p. 208).
PoliticalEntity
name
borders
*
Territory
Country
isMemberOf *
InterGovernmentalOrganization
*
StateOrProvince
isPartOf
A39
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A40
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A41
ANSWERS TO EXERCISES
Person
name
sex
placeOfBirth
dateOfBirth
placeOfDeath
dateOfDeath
*
witnesses
child
partner
* 0..2
{partner->forAll(p1,p2 |
p1 <> p2
implies p1.sex <> p2.sex)}
*
Union
dateStarted
dateEnded
0..1
parents
Marriage
placeOfMarriage
certificateNumber
officiant
divorceCertificateNumber
adoptiveParents 0..2
Person
Person
*
name
adoptedChild
sex
placeOfBirth
dateOfBirth
placeOfDeath child
dateOfDeath *
partner
* 0..2
{partner->forAll(p1,p2 |
p1 <> p2
implies p1.sex <> p2.sex)}
*
dateOfMarriage
*
name
adoptedChild
sex
placeOfBirth
dateOfBirth
placeOfDeath child
dateOfDeath *
Adoption
dateOfAdoption
partner
* 0..2
{partner->forAll(p1,p2 |
p1 <> p2
implies p1.sex <> p2.sex)}
*
Union
placeOfmarriage
*
0..1
Union
0..1
parents
dateOfDivorce
placeOfmarriage
dateOfMarriage
0..1
parents
dateOfDivorce
2. A significantly different approach is to make the Union be the entity doing the adopting. This makes
adoptions more similar in implementation to ordinary parent-child relationships, but requires a fake
union to be created in the case of single-parent adoptions.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A42
Person
name
sex
placeOfBirth
dateOfBirth
placeOfDeath
dateOfDeath
0..1
adoptedChild
Adoption
dateOfAdoption
*
child
partner
* 0..2
{partner->forAll(p1,p2 |
p1 <> p2
implies p1.sex <> p2.sex)}
*
Union
placeOfmarriage
dateOfMarriage
dateOfDivorce
0..1
parents
0..1
adoptiveParents
b) This exercise may be slightly offensive to certain cultures, although omitting the exercise may be offensive
to other cultures; in software we try to model reality.
The simplest way to change Figure 5.23 (c) to account for same-sex unions is to change the constraints.
The existing OCL constraint can be moved to the Person class, and modified slightly as follows:
context Person inv:
parents.partner.forAll(p1,p2 |
p1 <> p2
implies p1.sex <> p2.sex)
E5.18 p. 184 Making a preliminary list of classes by listing noun phrases in requirements.
In the following, we simply list a reasonable initial set of classes based on a first scan of the nouns in the
problem descriptions. Other lists are possible. Not all the nouns shown will end up in the final answers, shown
in the answer to E5.20. Classes where there is some initial doubt are marked ??.
a)*Bank account management system (p. 448)
Service ??
BankAccount
Branch
Client
MortgageAccount, ChequingAccount, CreditCardAccount
Property ??
CreditCard
JointAccount ??
Privilege ??
Division, SubDivision ??
Manager, Employee ??
Nouns not on the list because they will probably not be classes in the system:
System (because it is not part of the domain)
OOBank (an instance)
address, branch number (attributes)
account number, balance, credit limit, overdraft limit (attributes)
interest rate, monthly fee (attributes)
husband, wife (information in an example only)
cheque, insurance (possibly beyond the scope, may become classes later)
Planning, Investments, Consumer, Consumer Division (instances)
personal banker (association)
b) Election management system (p. 448)
To provide later.(but see diagram at E5.20)
c) Geographical information system (pp. 448-449)
To provide later (but see diagram at E5.20)
d) Investments system (p. 449)
To provide later (but see diagram at E5.20)
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A43
ANSWERS TO EXERCISES
Person
subdivision
*
name
OrganizationalUnit 0..1
manager
0..1
Employee
interestRate
monthlyFee
checksAllowed
insuranceAvailable
personalBanker
Branch
address
number
0..1
AccountType
Customer
*
1..2
accountHolder
*
*
Account
number
balance
creditOrOverdraftLimit
CreditCard
name
1..*
ChequingAccount
MortgageAccount
collateralProperty
CreditCardAccount
expiryDate
The distinction between AccountType and Account is important (so that each Account does not
need to store its own interest rate). There is a good chance, however, that students will not make this
distinction in their initial answers.
The following are some variations:
A customer is not always a person, so the generalization here may need to be changed so the top class is
LegalEntity, which has Customer as a subclass (or the generalization can be removed entirely)
There can be separate Department and Division classes, although the solution shown, using
OrganizationUnit is more flexible). It is important, however, not to add a separate class for each
division, as that would be very inflexible.
Each individual credit card may have its own number.
CollateralProperty and Address may be classes instead of simple attributes
You might add a separate Privilege class associated to AccountType, instead of the attributes
checksAllowed and InsuranceAvalable.
b) Election management system: The first diagram below (which is not the correct answer) shows the
central core of a very simple election system. We often use this as a starting point for discussion.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A44
Voter
name
address
CandidateForPosition
Position
isIncumbent
totalVotes
isWinner
title
The following is a more complete answer that accounts for the following:
The fact that voters might be able to run for more than one position
Keeping a record of different elections that occur on different dates
Tracking where each voter is supposed to vote.
Different positions on different elected bodies (e.g. school boards or city councils)
CandidateForPosition
*
isIncumbent
totalVotes
isWinner
*
runsAs
Voter
Position
name
address
*
ElectionForPosition
ElectedBody
name
title
*
votesAt
represents
Poll
location
number
locatedIn
Area
containedIn
description
*
c) Geographical information system: The association between the Feature and the FeatureType is
important (as will be discussed in Chapter 6, this is an example of the Abstraction Occurrence pattern).
However, you could instead have three associations between each feature subclass and its respective
feature type subclass, although this would be more complex to code (code for manipulating the
relationships would be the same in every pair). The association between Feature and FeatureType
could be one-directional. Making RegionFeature a subclass of CurveFeature is not the only
possibility; it could be made a direct subclass of Feature (same for the corresponding types).
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A45
ANSWERS TO EXERCISES
Map
scale
name
lattitide
longitude
height
width
*
Feature
name
FeatureType
description
CurveFeatureType
colour
thickness
dashLength
gapLength
PointFeatureType
*
symbol
PointFeature
Bitmap 0..1
fillPattern
bits
CurveFeature
Point *
RegionFeatureType
colour
RegionFeature
d) Investments system: The key insight in this question is to realize that mutual funds are, themselves,
investors. If multiple inheritance were to be used, MutualFund could be made a subclass of Investor.
InvestmentAdvisor
name
specialty
advises
arranged
Transaction
shares
pricePerShare
date
commissionRate
*
Investor
name
owner
actsAs
Investment
sharesOwned
*
amountInvested
MutualFund
Security
name
currentPricePerShare
Stock
Bond
* manager
FundCompany
name
e) Manufacturing plant controller: This is a particularly challenging problem simply because of the large
number of classes and associations. We will solve the problem paragraph by paragraph, showing at each
stage the new additions to the class diagram.
Paragraph 1: This is the central core of the system.
The manufacturing plant itself is a singleton and can be left out.
The class ProductType has been used instead of DeviceType or MechanicalDeviceType;
this generalizes the model.
Assembly step and manufacturing step are the same thing
ProductType
description
*
*
AssemblyLine
number
ProductRun
timePeriod
numUnits
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A46
{ordered}
AssemblyStep requiredToProduce
*
description
*
RobotAllocation
*
timePeriod
Robot
number
ProductType
description
*
*
AssemblyLine
number
ProductRun
timePeriod
numUnits
BillOfMaterialsLineItem
Bin
numberRequired
putTogetherDuring
{ordered}
requiredToProduce
AssemblyStep
*
description
*
RobotAllocation
*
timePeriod
Robot
number
Bin
number
*
keptIn
Supplier
obtainedFrom
name
0..1
*
* *
* availableFrom
ProductType
* Product*
description
0..1
ProductRun
* serialNumber
*
madeDuring
timePeriod
* *
*
numUnits
fulfilledBy
AssemblyLine
number
OrderLineItem
E5.21 p. 189 Additional exercises in drawing class diagrams, based on E2.10 (p. 41).
Since each of these lacks detail regarding the requirements, we have had to suggest the attributes and
associations that should be present. Note that each of these represents only part of a final system many
details (e.g. additional classes) have been omitted.
a)*Vehicles: We assume data is being maintained for hobbyists interested in data about a wide variety of
vehicles and their parts. In this answer, we decided to follow the pattern found in Figure 5.12 creating a
VehicleCategory class instead of modelling each type of vehicle as its own class. Students who
created the class hierarchy in E2.10 might simply transcribe it here; however, it is a good learning exercise
to show that although the hierarchy of E2.10 might have been good for preliminary domain modelling, the
answer below is much more flexible (it allows new vehicle types to be added without extra programming).
Note also that question E6.2 is related to this.
VehicleCategory
description
powerSource
isOfCategory
*
*
*
subcatgegory
Vehicle
name
* manufacturer
hasParts
VehiclePart
description
typicalNumber
*
subparts
b) Library: We assume a system for a university or city library. Note the following points:
The classes IssueOfNewspaper and IssueOfMagazine have been merged.
Similarly, the subclasses of Copy, Periodical and PartOfPublication have been eliminated
(the superclass suffices in each case)
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A47
ANSWERS TO EXERCISES
The author, publisher and part of publication have all been attached to EditionOrIssue instead of
Publication, since they can change from one issue/edition to another.
See Figure 6.1 on page 204 for a related problem; the answer given here has the additional concept of
edition or issue that Figure 6.1 lacks.
subparts
{ordered}
PartOfPublication
title
pageNumber
Publisher
tableOfContents *
{ordered}
Author
name
name
*
EditionOrIssue
Copy
*
issueNumber
publishedDate
barCodeNumber
Publication
hasEditionsOrIssues
name
{ordered}
EditionOfBook
IssueOfPeriodical
Periodical
isbn
volume
issn
libOfCongress
Book
frequency
c)*Bus scheduling: We assume a system for a bus company that runs regular routes as well as charters. This
has much in common with the Airline system (see the answer to E5.26). Note the following points:
The subclasses of BusVehicle have been merged, and the attribute category is used to determine
whether the bus is a luxury one or not.
Although it would seem that TripOnRoute would have no distinguishing features, and thus not need
to exist as a separate class, in fact it could contain the abstract operation getRoute, which would be
implemented differently in its two subclasses.
Information about bus stops not included in this model, but would be rather important.
BusVehicle
model
category
yearMade
identificationNumber
ActualTrip
*
date
CharteredTrip
startPoint
charterer
startTime
expectedReturnTime
TripOnRoute
ScheduledTrip
*
RegularlyScheduledTrip
depTime
UnscheduledTrip
*
BusRoute
routeNumber
origin
destination
normalRunningTiime
d) Video store: We assume a system for a store that sells music and videos as well as equipment for playing
the such works. Note the following points:
Many classes have been removed for flexibility: The different types of ElectronicDevice are now
represented using instances of the ProductCategory class; the media on which recordings are
available are represented using RecordingMedium (the type of music or film can be represented
using ProductCategory)
The individual copies of recordings have been left out since in a video store application, it would not be
conventional to keep track of each copy (unlike in a library). However, the expensive electronic
devices, which have serial numbers, are separately tracked.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A48
Product
isOfCategory
ProductCategory
description
name
ElectronicDevice
Recording
* Work
name
*
*
SpecificDevice
RecordingMedium
serialNumber
description
e)*Financial institution: See 5.20a for a similar problem (that also includes the notion of customers which
are omitted here). Note the following points about this answer:
We have decided to make BankAccount a kind of FinancialInstrument; this is a bit different
from what we did in the answer to E2.10e, but has the advantage that it allows the denomination
association to inherit nicely.
It is well known that debit cards have PINs. Some have argued that credit cards dont. In fact they do
but the PINs are not used in some jurisdictions.
FinancialInstitution
name
Branch
CreditCardCompany
hasBranches
Bank
name
address
Currency
issuer
FinancialInstrument
denomination
*
code
exchangeRate
ReusableFinancialInstrument
Cheque
BankAccount
number
PIN
drawnAgainst
amount
date
*
sequenceNumber
accountNumber
balance
overdraftOrCreditLimit
1..*
CreditCard
creditLimit
name
DebitCard
connectedAccounts
Loan
monthlyPayment
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A49
ANSWERS TO EXERCISES
* subsidiaryBookings
ItemOnBill
HotelCompany
owns *
name
Hotel
description
charge
name
address
*
assignedSpace
composedOfRooms
Booking
*
RentableSpace
costPerDay
floorArea
startDate
endDate
startTime
endTime
* bedroomsRequired
creditCardToBill
responsablePerson
Person
name
address
Event
description
HotelBedroom
MeetingRoom
roomNumber
qualityLevel
isSmoking
name
maxSeatingCapacity
Suite
g) Insurance company. Note that this drastically oversimplifies the insurance industry!
Transaction
date
InsurancePolicy
policyNumber
monthlyPremium
startDate
endDate
insuredValue
Renewal
Claim
description
amountClaimed
*
holder
LifeInsurancePolicy
beneficiary
InsuredProperty
Person
name
address
dateofBirth
PropertyInsurancePolicy
yearBuilt
insuredLife
Vehicle
Building
identificationNumber
manufacturer
model
address
floorArea
h) Telephone system. We assume a system for a Central Office (telephone exchange) or PBX (private branch
exchange). Note the following points:
Telephone systems are some of the most complex pieces of software ever written. The answer given
below is an extreme over-simplification.
All of the generalizations have been removed because they did not add any apparent benefit in the final
class diagram.
The notion of call status is captured by examining the attributes and associations of a telephone call. No
separate class is therefore needed. Similarly, the notion of conference call is captured by examining the
number of telephone numbers connected to the call.
forwardedTo
*
originator
PhoneCall
isOnHold
startTime
duration
0..1
ringsOn
TelephoneNumber
parties
*
digits
*
hasWaiting
digitizedSound
VoiceMailBox
location
digOrAnalog
subscribesTo
belongsTo
*
VoiceMailMessage
PhoneLine
*
0..1
attachedTo
Feature
Telephone
description
model
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A50
It is important that these be simple phrases. Suitable classes for the responsibilities are given in parentheses. In
some cases the word singleton is used to indicate that the responsibility could be added to a singleton class
not shown in the answer to E5.20. There are sometimes several choices for suitable classes; all suitable
choices are listed, with the suggested one in italics. The plus symbol indicates that there should be several
polymorphic implementations in subclasses
a)*Bank account management system.
Adding a new customer (singleton, static Customer)
Changing details of a customer (Customer)
Opening an account (static Account +)
Crediting an amount to an account (Account)
Debiting an amount from an account (Account)
Changing the credit or overdraft limit on an account (Account)
Issuing a new credit card (CreditCardAccount)
Adding a new employee (OrganizationalUnit)
Changing details of an employee (Employee)
Assigning a personal banker to a customer (Customer, Employee)
Adding a new branch (singleton, static Branch)
Changing the address of a branch (Branch)
Changing an employees reporting relationship (Employee)
Changing the divisional structure in the organization (OrganizationalUnit)
Adding a new account type (singleton, static AccountType)
Changing details of an account type (AccountType)
b) Election management system (class allocation to be done)
Add election
Add elected body
Add area
Add position
Add election for position
Add voter
Change voter information
Delete voter
Add candidate for position
Add poll
Change poll location
c) Geographical information system
To be done
d) Investments system
To be done
e) Manufacturing plant controller
To be done
E5.23 p. 192 Determining responsibilities in the genealogical example.
The same notation is used here as was used in the last exercise.
Add person (singleton, static Person)
Remove person (Person)
Change person name (Person)
Change person attribute details (Person)
Add union (Person)
Remove union (Union)
Add a partner to a union (Union)
Change marriage details (Union)
Change divorce details (Union)
Create parent-child relationship (Person, Union)
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A51
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A52
changeSex(newSex)
changePlaceOfBirth(newPlaceOfBirth)
changeDateOfBirth(newDateOfBirth)
changePlaceOfDeath(newPlaceOfDeath)
changeDateOfDeath(newDateOfDeath)
addUnion(person)
Union
deleteUnion()
changePlaceOfMarriage(newPlaceOfMarriage)
changeDateOfMarriage(newDateOfmarriage)
changeDateOfDivorce(newDateOfDivorce)
createChildRelationship(childPerson)
addPersonToUnion(person)
E5.26 p. 194-195 Extending the airline system to add new features.
The following is the complete class diagram incorporating the added features. Explanations of the features
follow. An alternative solution is also presented at the end.
PersonRole 0..2
Person
Airline
name
idNumber
PlannedLeg
EmployeeRole
PassengerRole
jobFunction
points
plannedStartTime
plannedEndTime
*
supervisor
origin
1..*
PlannedFlight
time
flightNumber
destination
AirportTerminal *
*
Booking
seatNumber
*
*0..1
Ticket
City
name
name
SpecificLeg
from
actualStartTime
actualArrivalTime
to
**
Fare
1..* *
0..1
number
price
class
distance
*
SpecificFlight
date
a) Flights fly from one airport terminal to another, but may also have several intermediate stops. A passenger
can be booked onto one or more of the legs of a flight.
Split flights up into legs;
Each leg has an origin and destination AirportTerminal;
Multiplicity from Booking to SpecificLeg is many to many.
Alternatives:
You could have omitted AirportTerminal, and instead had an Airport class or even simply had
origin and destination attributes. A string describing the terminal could then be stored in the
PlannedFlight class.
You could have both an Airport and an AirportTerminal classs.
You could have decided that every Booking will be for just one SpecificLeg, although the above
solution is probably better.
b) Passengers can query the system to determine at what times flights are available from their desired origin
city to their desired destination city (assume they do not care, within a city, about which terminal or
airport is used by the airline)
Added a City class, which can have several airport terminals.
It is important not to have classes called Query (because it is not part of the domain),
DestinationCity or OriginalCity (because they are just ordinary cities).
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A53
ANSWERS TO EXERCISES
c) Flights have scheduled departure and arrival times, but they can be late, so they have actual departure and
arrival times as well.
Actual times added to SpecificLeg.
d) The airline may add charter flights that are not regularly scheduled.
RegularFlight name changed to PlannedFlight, since there may only be one occurrence.
You might have considered subclassing this into CharterdFlight and RegularFlight, but you
would have had to show that there are different attributes, in that case. An attribute of
CharteredFlight might be charteringOrganization.
e) The airline publishes prices that apply between any pair of cities to which it flies. Business class, regular
and seat-sale fares are available.
Added a Fare class to capture this information. Note that the fare type is typically called class in the
airline industry.
You do not need a separate classes called BusinessClass, Regular or SeatSale. These are just
values of the class attribute of Fare.
Alternatives
The attributes in Fare could be businessClassFare, economyClassFare.
You could associate Fare with individual specific flights (there are various advantages and
disadvantages to this). You could also have a start and end date for each fare.
f) Passengers buy tickets and are charged the prices in effect when their tickets were booked. Each ticket
involves a complete itinerary, composed of a sequence of one or more legs. The fare type is not necessarily
the same for each leg of the flight.
Added a Ticket class. A ticket is for zero or more bookings. Zero bookings is possible in the case of
an open return, or if a ticket is issued from one city to another that is valid at any time. A Booking may
not yet have a Ticket issued for it. A ticket has a specific set of Fares.
A ticket has to be linked to both Booking and to PassengerRole. It has to be linked to Booking
since it must list all the legs (if any) that are booked.
g) Passengers are automatically part of a frequent-flier plan. They accumulate points based on the distance
they flew and their class (business class or not).
Added a points attribute to the PassengerRole class. Distance information is recorded in the
Fare class.
The following is an alternative answer. Instead of using legs (the edges of the graph designating a flights
route) it uses instances of AirportVisit (the vertices of the graph). The drawback to this is that the
starting point of a flight would only use the depTime while the ending point of a flight would only use the
arrTime.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
PersonRole 0..2
Person
Airline
name
idNumber
AirportVisit
EmployeeRole
PassengerRole
plannedArrTime
plannedDepTime
*
2..*
1..*
PlannedFlight
supervisor
jobFunction
points
A54
origin
time
flightNumber
destination
AirportTerminal *
*
Booking
seatNumber
from
to
name
SpecificAirportVisit
from
Fare
2..**
0..1
Ticket
to
**
actualArrTime
actualDepTime
*
*0..1
City
name
price
class
distance
number
SpecificFlight
date
E5.27 p. 195 Adding responsibilities and operations for new features of the airline system.
To be provided
P5.1
Hotel
name
addQualityLevel
getQualityLevel
getQualityLevels
getGuestList
getRoom
addGuest
removeGuest
searchForGuest
saveGuestData
readDescriptionFile
name
level
characteristics
maximumPrice
pricePerExtraPerson
numberOfCategories
getNumberOfRooms
getPrice
getRooms
addCharacteristic
removeCharacteristic
getNumberOfAvailableRooms
getNonAssignedRooms
addRoo
removeRoo
getCategoryDescription
name
roomNumbe
numberOfBeds
typeOfBeds
smoking
category
Guest
name
address
phoneNumbe
createReservation
cancelReservation
getListOfStays
*
*
Stay
id
arrivalDate
numberOfNights
roomChargePerNigh
numberOfPersons
categoryNumber
Room
adjoin
0..2
0..2
getQualityLevel
getAssignedStays
getDescription
adjoinRoo
unadjoinRoo
getDepartureDate
assignRoom
getRoomCategory
getRooms
inConflict
inConflict
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A55
ANSWERS TO EXERCISES
* PeriodicalIssue
volumeNumber
issueNumber
publicationDate
numPages
b) The following assumes what is being developed is a library system. In this library each copy is stamped
with a different bar code number (distinct from the bar code number printed by the publisher which would
be the same for all copies).
PeriodicalIssue
* CopyOfPeriodicalIssue
volumeNumber
issueNumber
publicationDate
numPages
barCodeNumber
If, instead, the system being developed was a publishers distribution system, the diagram might look like
this:
PeriodicalIssue
* CopyOfPeriodicalIssue
volumeNumber
issueNumber
publicationDate
numPages
subscriberName
subscriberAddress
c)
TelevisionEpisode
name
producer
director
summary
runningTime
contentRating
E6.2
startTime
televisionStation
* VehiclePart
*
VehicleCompositePart
E6.3
* ShowingOfTVEpisode
VehicleAtomicPart
p. 208 Ensuring that the General Hierarchy pattern is applied in E5.9 (p. 168).
There are several ways of naming the non-superior and superior nodes in this exercise. Below is one way. As
an extension, the class Country could be made a subclass of SubdividedTerritory. As shown, the
class diagram would allow gteneration of an instance hierarchy, part of which might include, for example:
that, for example, European Union -> United Kingdom -> (England, Scotland, Wales and Northern Ireland),
and within each of those, various levels of counties and municipalities. The lowest level municipalities would
be the only instances of class UnsubdividedTerritory.
The question required the use of the general hierarchy pattern. However, in a real system it might be better
to remove the SubdividedTerritory and UnsubdividedTerritory classes and represent the partof relation as a reflexive association of Territory. This might be a bit more flexible.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A56
PoliticalEntity
name
borders
*
Territory
isMemberOf *
InterGovernmentalOrganization
SubdividedTerritory
UnsubdividedTerritory
E6.4
p. 215 Finding applications for the delegation pattern in the genealogical example.
While there are many situations in Figure 5.23 (c) where a method would call a method in a neighbouring
class, there are actually relatively few opportunities where the calling method only call a neighbouring method
(and do nothing else). Two notable exceptions are listed below. The reason for the shortness of this list is that
there is only one association with a 1 or 0..1 end; it is such associations that tend to give rise to
opportunities for pure delegation.
It would be reasonable to have a method getMother in class Person. This would delegate through the
child-parents association to a method of Union called getFemalePartner.
There would presumably be a similar method getFather that would delegate to a method of Union
called getMalePartner.
E6.5
p. 221-222 Determining the pattern(s) that would apply in specific design circumstances.
a)*Adapter (in your inheritance hierarchy create an adapter class that whose methods delegate to those in the
class you want to reuse)
b) Immutable (RegularPolygons distortion operations return new instances of some other class that is
probably not a RegularPolygon)
c) Proxy (Most of the time a ProxyImage exists in memory; methods in this class cause the
HeavyWeightImage to be loaded when required)
d) Faade (Create a Faade class in the subsystem that has a public interface with only the 5 key methods;
these will delegate to the other methods inside the subsystem, which would not be public)
e) Observer (The StockQuoter is the Observable; the other classes observe it)
Note, parts a, c and d also use delegation, but this is not the dominant pattern here.
E6.6
p. 222 Writing a description of the Iterator pattern that is already implemented in Java.
The Iterator pattern
Context: Collections (lists, arrays, sets etc.) are very common data structures. It is also common when
designing algorithms to want to visit every element of a collection (or to visit every element up to a certain
point, at which time you decide to stop); this might be for the purposes of searching for a particular element,
extracting information from each element, or performing some computation such as summing the elements.
Problem: How do you best allow for an operation to be performed on every element of a collection?
Forces: You want the code to be simple; you want to protect the internals of the collection classes, and permit
the internals to be changed without affecting the code that accesses each element; you want to reduce the
chances of errors among those who use the mechanism. Extreme efficiency is not a concern.
Solution: Create an interface called Iterator with next as its main operation. Then, in every collection
class, create an inner class that implements the Iterator interface, as well as a method iterator that
returns an instance of this inner class. When an algorithm needs to process the elements of a collection, it
simply calls the iterator method, and then repeatedly calls next on the result. To allow for efficient
detection of the end of the collection, provide a hasNext operation in the Iterator interface that will
return true only when next has not reached the end of the collection and will hence return a result.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A57
ANSWERS TO EXERCISES
interface
Collection
interface
Iterator
iterator
next
hasNext
ConcreteCollection
ConcreteIterator
*
iterator
next
hasNext
Antipattern: Loop through the elements using a while or for loop. This has several disadvantages: It is
bug prone (the starting or terminating condition may be coded incorrectly); the code is less abstract; it requires
knowledge of the internal structure of the collection class; there will have to be a separate loop for every
algorithm that needs to visit the elements (multiplying the chance of bugs and multiplying the exposure to the
internals of the collection), and the loops may have to be changed if the data structure is changed.
References: This pattern was derived from the code implementing the Java Iterator interface.
E6.7
Cache
request
Server
request
There must also be a mechanism to limit the size of the cache. This can be done by defining recent in
terms of a limited period of time, a specific number of requests, and/or the frequency with which a particular
request is made.
There will often also be a need for a way to invalidate a cached result in circumstances when the request
to the server would return a different result from what was previously returned (and is in the cache).
Antipattern: Sometimes the time taken to search the cache can exceed the time taken to service the request;
hence the cache must be significantly more efficient than the request server, and/or must be kept at a
reasonable size.
Related pattern: The Proxy pattern is similar in the sense that access is made to the cache (proxy) by default,
and only to the server (heavyweight) when needed.
b) This is a practical exercise only.
E6.8
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A58
Delegation does not only occur from adapter to adaptee, but in the other direction as well: The three
methods connectionEstablished, connnectionClosed and handleMessageFromServer
call the corresponding methods in ObservableClient.
Some key methods that are being delegated to AdaptableClient (openConnection,
closeConnection, etc.) are not polymorphic in the hierarchy of Observable.
A classic adapter is often written to access code written by a third party (e.g. the Torus class accessing
TimsTorus in Figure 6.10). In the case of ObservableClient, all the classes have been written by
the same developers.
E6.9
p. 225 Summarizing the advantages and disadvantages of the Observable layer of OCSF.
The main trade-off is increasing flexibility at the cost of efficiency and complexity.
Advantages:
Users of the ObservableClient and ObservableServer can create many different observer
classes in their system that independently react to different messages. Adding new observers is very easy
and does not require changing any of the code related to other observers. Without the observable layer, it
would
be
necessary
to
edit
handleMessageFromServer
(and
perhaps
also
connectionEstablished and connectionClosed) whenever new functionality is to be added.
Disadvantages:
The OCSF framework is more complex. Originally there were just three classes; now there are eight.
The Observable pattern is not particularly efficient when there are many observers interested in different
messages. This is because the notifyObservers message causes all the observers to receive a message
they ignore messages they are not interested in.
P6.1
P6.2
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A59
ANSWERS TO EXERCISES
E7.2
E7.3
System responses
2. Prompt for PIN.
4a. Display list of possible transactions.
4b. Prompt for desired transaction.
6. Prompt for details of bill.
8. Prompt to deposit bill using an envelope.
10a. Accept deposit.
10b. Debit account.
10c. Print receipt.
10d. Prompt to see if there is another transaction.
12. Eject card.
14. Display welcome message.
Postconditions: The system has stored the bill physically, and has a record of the transaction. The actor
has a receipt for the transaction.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A60
b) The following has been based on Microsoft Word (although is as user-interface independent as possible).
The sequence could differ in other word processors.
Use case: Create a table in a word processor.
Actors: Any member of the general public with a basic knowledge of how to operate a word prcessor.
Goals: To create a table as quickly as possible
Preconditions: The actor must be running the word processor and have in mind the information to be
placed in the table. The actor must have positioned the cursor at the spot where the table is to be
inserted.
Steps:
Actor actions
1. Select the insert table command.
3a. Specify the requested information.
3b. Indicate that the information is correct.
System responses
2. Prompt for the number of rows and columns, as well as
the format.
4. Insert a table.
Postconditions: The table appears in the document as specified. The cursor is positioned in the first
cell of the table.
c) We have tried to be as user-interface independent as possible, but there are a number of different sequences
in which the following actions could be taken.
Use case: Program a microwave oven to turn on at a future time
Actors: Any member of the general oven preparing a meal in advance; minimum likely age is 12.
Goals: To set up the microwave as easily and quickly as possible to start cooking at a future time.
Preconditions: The food must be in the oven. The oven is idle.
Steps:
Actor actions
1. Press the delayed cooking button.
3. Enter the start time.
5. Specify the cooking duration.
7. Enter start.
System responses
2. Prompt for the start time.
4. Prompt for the cooking duration.
6. Prompt to enter start.
8. Display indication that it is waiting to start cooking.
Postconditions: The oven starts cooking at the specified start time, and cooks for the specified
duration.
d) There are several sequences in which voice mail systems system can be used. Some systems will not delete
messages as the default. Others will play all messages, not just new ones.
Use case: Listen to voice mail messages.
Actors: Any member of the general public, including children as young as about 5.
Goals: To listen to all messages waiting.
Preconditions: The system has been set up to take messages.
Steps:
Actor actions
1. Initiate the play new messages operation.
3. Indicate that he or she wants to listen to the next
message.
5. Indicate that he or she wants to delete the
message and proceed.
System responses
2a. Indicate number of new messages.
2b. Prompt the user to proceed.
4a. Play the next message (if any).
4b. Prompt the user to delete and proceed.
6a. If there are more messages repeat at step 4).
6b. If there are no more new messages, notify the user.
Postconditions: The user has listened to all the new messages. The new messages have been deleted.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A61
E7.4
ANSWERS TO EXERCISES
Search for
items by
author
Borrower
Search for
items by
subject
Add a
new item
Delete
an item
Place a
book on
hold
Change
an item's
information
Librarian
Check
personal
information
Check out
an item
Checkout Clerk
Check in
an item
Renew
an item
Update a
borrower's
information
Record
fine
payment
Obtain
overdue fine
amount
Add a
borrower
Accounting System
The second version of the answer uses generalization, showing how the diagram can be simplified (fewer
lines)
Place a
book on
hold
Search for
items by
title
Check
personal
information
Borrower
Check out
an item
Search for
items by
subject
Accounting System
Update a
borrower's
information
Check in
an item
Renew
an item
Search for
items by
author
Checkout Clerk
Add a
new item
Add a
borrower
Obtain
overdue fine
amount
Record
fine
payment
Change
an item's
information
Delete
an item
Librarian
b) Mail order system (based on exercises E4.12 and E4.13, page 126). As with part a, above, we have also
used generalization here to reduce the complexity. However, students who did not read ahead would not be
expected to do so.
Note that use case diagrams can be clumsy; the answer to E4.13 seems a clearer expression of this
information. The only information that is expressed more clearly is the generalizations among different
actors.
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A62
Change
password
Sign in
Sign out
Inventory
system user
Display next
order
Confirm
shipment
completed
Enter
received
shipment
Shipper
Display
location of
item
E7.5
Receiver
Inventory
Taker
Display
inventory
statistics
Assign
delivery to
receiver
Display
performance
statistics
Assign
shipment to
shipper
Enter item
count
Warehouse
Supervisor
Add
personnel
member
Answer
call
Display
customer
info
Add item
to sale
Complete
sale
Display
operator
statistics
Telephone
Operator
Telephone
Operator
Supervisor
Search
catalogue
Display item
technical
info
Display item
avail & price
info
Override
price
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A63
ANSWERS TO EXERCISES
The above does not deal with the situation where the driver runs out of money and has to cancel the
operation. That would be a separate use case.
c) This is mostly the same as Example 7.2, with a few minor generalizations.
Use case: Exit car park.
Actors: Car drivers.
Goals: To leave the car park after having paid the amount due.
Preconditions: The driver must have entered the car park with his or her car and must have picked up a
ticket upon entry.
Summary: When a driver wishes to exit the car park, he or she must bring his or her car to the exit
barrier and interact with the machine to pay the amount due.
Related use cases:
Generalization of: Exit car park, paying cash and Exit car park by paying using debit card.
Steps:
Actor actions
1. Drive to exit barrier, triggering a sensor.
System responses
2a. Detect presence of a car.
2b. Prompt driver to insert his or her card.
4. Display amount due.
6a. Acknowledge payment.
6b. Raise barrier.
8. Lower barrier.
3. Insert ticket.
5. Make payment.
7. Drive through barrier, triggering a sensor.
Driver
Exit car park,
paying cash
extend
E7.7
b)
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A64
Set destination
Start navigating
Change scale
Scroll map
Display current location
Display destination location
Navigate to destination
Change to setup mode
Obtain constant spoken directions
Obtain a single spoken direction
c) A video-cassette recorder.
Play tape
Stop playing
Start recording
Stop recording
Rewind
Eject tape
Fast forward
E7.8
E7.9
A65
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A66
:Library
foundBook :=
search(title)
:Loan
borrow
[available] create
b) Genealogy example (based on Figure 5.23(c). This problem is surprisingly time-consuming, and would be
complex if drawn as one large diagram. Rather than doing that we developed three simpler ones. The first
makes use of getSiblings, and getChildren, which are described in the second and third diagrams
respectively. Note that a good answer to this problem should reduce the necessity for an object to access
non-neighbours, and should instead make as much use of delegation as possible. For example,
getCousins does not directly compute the cousins; instead, it asks the parents to compute their nephews
and nieces.
:Person
getCousins
parentUnion:
Union
parents:
Person
parents.siblings:
Person
parentUnion :=
getParentUnion
parents :=
getParents
* [for all parents]
nephnieces
siblings :=
getSiblings
* [for all siblings]
getChildren
:Person
getSiblings
parentUnion:
Union
parents:
Person
parentUnion :=
getParentUnion
parents :=
getParents
* [for all parents]
getChildren
:Person
getChildren
unions:
Union
unions :=
getUnions
* [for all unions]
getOffspring
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A67
ANSWERS TO EXERCISES
c) Banking example
:Bank
client: Client
client :=
find(name)
createAccount
create
deposit(amount)
E8.2
2:getUnitPrice
:Bill
:Purchase
:Item
3:computeTotal
E8.3
1:foundBook :=
search(title)
:Library
2:borrow
3:[available] create
foundBook:
CopyOfBook
:Loan
GUI
1:getCousins
:Person
3:parents :=
getParents
parentUnion:
Union
parents:
Person
parents.siblings:
Person
5:siblings :=
getSiblings
2:parentUnion :=
getParentUnion
1:getSiblings
:Person
3:parents :=
getParents
parents:
Person
parentUnion:
Union
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A68
2:unions :=
getUnions
1:getChildren
:Person
unions:
Union
c) Banking example
1:find(name)
GUI
:Bank
3:createAccount
5:deposit(amount)
client: Client
:BankAccount
E8.4
4:create
XTurn
[not
3 X in sequence]
[not
3 O in sequence]
[impossible to get 3 in
sequence]
[impossible
to get 3 in sequence]
OTurn
E8.5
XWin
Tie
OWin
[3 O in sequence]
p. 279 Determining the state the system would be in after a sequence of events.
a)*It would be in state Cancelled.
Rationale:
Initial = Planned;
openRegistration -> OpenNotEnoughStudents (classSize=0);
requestToRegister -> OpenNotEnoughStudents (classSize=1);
requestToRegister -> OpenNotEnoughStudents (classSize=2);
cancel->Cancelled
b) It would be in state Closed
Rationale:
Initial = Planned;
openRegistration -> OpenNotEnoughStudents (classSize=0);
requestToRegister(twice) -> OpenNotEnoughStudents (classSize=2);
requestToRegister -> OpenEnoughStudents (classSize=3);
requestToRegister -> OpenEnoughStudents (classSize=4);
requestToRegister -> Closed (classSize=5)
requestToRegister (3 more times ignored since no outgoing transition)
closeRegistration (ignored since no outgoing transition)
E8.6
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A69
ANSWERS TO EXERCISES
Planned
cancel
openRegistration
closeRegistration
OpenNotEnoughStudents
Cancelled
cancel
[not taught]
cancel
[not taught]
cancel
closeRegistration
Closed
classSize >= maximum
[isRegistered(aStudent)]
requestToDrop(aStudent)
/deleteRegistration
requestToRegister(aStudent)
/createRegistration
classSize <
minimum
[notTaught and
isRegistered(aStudent)]
requestToDrop(aStudent)
/deleteRegistration
E8.7
RedLightNoTrigger
YellowLight
vehicleWaitingToTurn
RedLightChangeTriggered
after(30s since exit from
state GreenLight)
after(25s)
GreenLight
The second approach is to label the states according to what both lights are doing at any given point in time. In
that case, there will be one extra state. This is actually a nicer answer, and is also the style requested for E8.8
below.
after(5s)
1Red2Green
vehicleWaitingToTurn
1Yellow2Red
1Red2GreenChangeTriggered
after(25s since exit from
state 1Green2Red)
1Red2Yellow
after(25s)
after(5s)
1Green2Red
Note that the state 1Red2Yellow might be better called 1Changing2Yellow, since in some countries
(e.g. the UK), when a traffic light is about to go green, it displays red and yellow at the same time.
E8.8
after(5s)
after(25s)
NSChanging-EWYellow
NSYellow-EWChanging
after(25s)
after(5s)
NSGreen-EWRed
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
E8.9
A70
after(5s)
NSYellow-EWChanging
after(25s)
NSRed-EWYellow
after(25s)
[not vehicleWaitingToTurn]
after(5s)
[vehicleWaitingToTurn]
after(5s)
NSGreen-EWRed
after(2s)
after(12s)
NSTurningEWRed
NSRedEWRed
Waiting
returningComplete
noChangeRequired
and deliveryComplete
ReceivingMoney
enterCoin
/displayTotal
enoughMoney and
pressSelection
pressReturn
ReturningMoney
changeRequired and
deliveryComplete
DeliveringItem
Waiting
returningComplete
[not
changeRequired]
deliveryComplete
ReceivingMoney
enterCoin
/displayTotal
[enoughMoney]pressSelection
pressReturn
ReturningMoney
[changeRequired]
deliveryComplete
DeliveringItem
E8.11 p. 283 Finding a missing transition in the automatic transmission state diagram.
The missing transition is selectDrive from the unnamed drive state to itself. This enables the driver to
shift the control from First or Second to Drive. This change is reflected in the answer to E8.12, below.
E8.12 p. 283 Adding the Park control to an automatic transmission state diagram.
This is actually a very simple change. As with Reverse, we assume that you cannot suddenly jump to or
from Park, but must shift through Neutral.
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A71
ANSWERS TO EXERCISES
Park
selectNeutral
selectPark
selectReverse
Neutral
Reverse
selectNeutral
selectFirst
selectDrive
selectSecond
reachSecondSpeed
[driveSelected]
selectNeutral
reachThirdSpeed
[driveSelected]
First
Second
dropBelowSecondSpeed
[driveSelected]
selectFirst
selectDrive
Third
dropBelowThirdSpeed
selectSecond
ProposeSelection
AcceptingMoney
pressReturnMoney
/returnMoney
enterCoin
/displayTotal
[enoughMoney]pressSelection
/returnChangeIfNecessary
MusicPlaying
do:
play chosen
selection
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A72
b) Microwave oven. (based on Example 4.6, page 112-114). Note that this answer corresponds to the
specifications as given; students may have a different answer of they made improvements following the
review conducted in E4.18. Note that the low-pitched tone following input of an invalid key has not been
modelled here.
pressCancel
AcceptingInput
[validTime]pressTimeOfDay
pressTimeOfDay
[<4 digits]
pressDigit
AccumulatingTimeOfDayDigits
Idle
pressDigit
do:
display
timeOfDay
[<4 digits]
pressDigit
[4 digits] pressDigit
AccumulatingCookingTimeDigits
pressPowerLevel
CookTimeSpecificationComplete
pressAutoDefrost
AccumulatingCookingWeightDigits
[<1 digit]
pressDigit
[1 digit] pressDigit
CookWeightSpecificationComplete
pressAutoReheat
AwaitingTemperatureButton
pressATemperatureButton
CookReheatSpecificationComplete
[doorClosed] pressStart
sufficientSteam
/soundThreeBeeps
[doorClosed] pressStart
Cooking
AutoReheatCooking
cookingTimeLimitReached
/soundThreeBeeps
TimeBasedCooking
H
do: cookFood
openDoor
Suspended
[doorClosed] pressStart
c) VCR. There are many possible answers to this, depending on the VCR; the one shown below is a good
solution
endOfTape
powerUp
StandbyForAutomatic
Recording
Off
on
On
AutomaticRecording
programEnd
[noProgramScheduledNow]
standby
on
[programScheduledNow]
standby
ShowingTVChannel
ManualRecording
[tapeInserted]record
stop
[tapeInserted]rewind
Rewinding
Idle
endOfTape
[tapeInserted]fastForward
FastForwarding
[tapeInserted]play
PlayingTape
fastForward FastFwdingSlowly
PlayingTapeNormally
WhilePlaying
play
rewind
play
RewindingSlowly
WhilePlaying
rewind
fastForward
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A73
ANSWERS TO EXERCISES
SelectRecordingDataLine
leftArrow
rightArrow
upArrow
/incrementCurrentDigit
EnterRepeatFrequency
leftArrow
rightArrow
downArrow
/decrementCurrentDigit
EnterChannel
leftArrow
digit
/editCurrentValue
rightArrow
EnterStartTime
leftArrow
rightArrow
EnterEndTime
leftArrow
rightArrow
EnterRecordingSpeed
upArrow
/toggleRecordingSpeed
downArrow
/toggleRecordingSpeed
cancel
rightArrow
Cancelled
do:
unregister
students
openRegistration
closeRegistration
Open
cancel
NotEnoughStudents
closeRegistration
classSize >= minimum
classSize >= maximum
Closed
EnoughStudents
closeRegistration
requestToRegister(aStudent)
/createRegistration
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
P8.2
A74
message/
receiveMessageFromClient
Initializing
AcceptingMessages
IOException
sendToClient/
send
exception/
clientException
Terminating
ReadyToTransmit
close/
clientDisconnected
loginReceived
InitializingConnection
AwaitingPassword
TryingToConnect
connectionAttempt
Failed
connect
Idle
LoggedIn
NotForwarding
logout
cancelForward
networkDisconnection
P8.3
passwordReceived
forward
Forwarding
p. 291 Interaction diagrams and other work for the Small Hotel System
a) Responsibilities. To be provided in a later release.
b) Interaction diagrams
GUI
:Hotel
:Guest
s:Stay
:QualityLevel
r:Room
:Stay
searchForGuests(string)
getListOfStays
getQualityLevel
getNonAssignedRooms(s)
getRoomCatgory()
getRooms(category)
*[for all rooms] getAssignedStays()
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A75
ANSWERS TO EXERCISES
GUI
:Guest
s:Stay
:QualityLevel
:Stay
:Room
getNumberOfAvailableRooms
(nights,arrival,category)
getRooms()
createReservation
(qualityLevel,category)
create
addStay(s)
addStay(s)
c) State diagrams. We have not found the need to create any so far for this system. We may add some in a
future version of this document
d) This is a practical exericise requireing students to improve their previous work
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A76
E9.2
p. 304 Categorizing designs according to the types of cohesion they should exhibit.
a) Booking class: Communicational cohesion
b) bmptojpg executable program: Functional cohesion (assuming it doesnt actually modify the bitmap, but
produces an entirely new output). You could also argue that there might only be communicational
cohesion here, or perhaps even only sequential cohesion for the different steps of the process.
c) GenerateStatistics executable program: Temporal cohesion. However, although it would be a
stretch, one can also imagine this being implemented as a functionally cohesive module that would output
a structure with the results, that could be printed or displayed by another module.
d) AnalyseData: Sequential cohesion (procedural would be OK too)
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A77
ANSWERS TO EXERCISES
E9.3
E9.4
E9.5
E9.6
E9.7
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A78
E9.8
E9.9
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A79
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A80
12 A character string with characters other than digits, letters or :, + and - in the appropriate spots.
d) The speed of a vehicle optionally followed by units.
Equivalence classes of valid data:
1 A sequence of digits of length 1 to 3 (the problem said 3-digit; we assume this included 1 and 2 digit
integers)
2 A sequence of digits of length 1 to 3 followed by one of the strings km/h, m/s or mph.
Equivalence classes of invalid data:
1 The empty string (assuming input is required)
2 A sequence of digits of length greater than 3
3 A string with characters other than digits and the sequences km/h, m/s and mph
e) A credit card number. The major credit cards have standard formats, however these are subject to
change. Also, additional credit cards might be introduced. Most systems should therefore not place undue
restrictions on the input format. In the following, we assume, however, that no credit card number could be
less than 7 digits.
Equivalence classes of valid data:
1 A string of 7 or more digits with optional single spaces separating groups of digits.
Equivalence classes of invalid data:
2 The empty string (assuming the information is required)
3 Strings with characters other than digits and spaces.
4 Strings shorter than 7 digits.
f) An FM broadcast radio frequency: Such frequencies can vary from 87.5 to 108 MHz. In some countries
(e.g. North America), the spacing between frequencies is 0.4 MHz. In other countries, the spacing is
different. If the computer system was unquestionably country-specific, then it could use knowledge about
frequency spacing to be very specific about what frequencies are allowed as input. In the following, we
assume that the system must allow frequencies as used in any country.
Equivalence classes of valid data:
1 Any value from 87.5 to 108, with up to two decimal place specified, but where the second decimal
place can only be 0 or 5. Note that for proper international input, the decimal point might be
specified as a . or a , or several other possibilities.
Equivalence classes of invalid data:
2 A value less than 87.5
3 A value greater than 108
4 A value with more than two decimal places specified
5 A value with a second decimal place that is other than 0, 5.
6 The empty string (assuming the input is required)
7 A string containing non-numeric values.
g) A URL: This is actually quite a tricky question, since the space of possible URL formats is unlimited,
given that new protocols can be created. However, a program that accesses a URL would only be expected
to be able to access URLs with protocols that are known at that time. In this answer, we therefore assume
that the program can only access http, https, file and ftp URLs.
Equivalence classes of valid data:
1 A string having the format: http://{domain}, including domains in non-western character sets.
1a Class 1 followed by /
1b Class 1 followed by arbitrary text of indefinite length
2 As with class 1, except https
3 As with class 1, except ftp
4 As with class 1, except file
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A81
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A82
Form
B
A
C
B
A
Form D
Y
N
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A83
ANSWERS TO EXERCISES
Social Assistance?
?
N
?
Y
High Income?
?
?
Y
N
Form E
N
Y
N
N
Form F
N
N
Y
N
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A84
b) A flight simulator
Running on a CPU with minimal speed and memory
Running on a variety of different operating systems and graphics cards
Running for a very long period of time (to check for memory leaks)
Running on a display screen with a particularly large number of pixels (or, as allowed in some
operating systems) several screens put together to create one large virtual screen.
Running on a very small display screen
(for flight simulators that can operate with several users each flying their own plane) Running with a
large number of planes.
c) The SimpleChat system
Having an extremely large number of clients connect to a given server.
Having a driver push an extremely large number of messages through the system at one time.
Running on as many different operating systems as possible.
d) The GANA navigation system
Dealing with errors in the mapping information.
Navigating while moving rapidly through very complex and dense cities
Dealing with intermittent internet connection for map loading
Dealing with intermittent GPS input due to tall buildings and tunnels
Navigating over a very large distance through a very complex route
E10.12 p. 376 Writing test cases.
a)*Message forwarding
To be provided.
b) Forms to be completed by different classes of people
To be provided.
c) Navigation system that gives warnings about required turns
To be provided.
d) Determining when the burglar alarm should sound
To be provided.
E10.13 p. 376 Creating a complete test plan from information in a table.
To be provided.
E10.14 p. 383 Planning for integration testing, including determining needed stubs and drivers.
To be provided.
E10.15 p. 387 Conducting code inspections.
This is a purely practical exercise
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.
A85
ANSWERS TO EXERCISES
ANSWERS TO EXERCISES (Those marked * are to be publicly available on the books web site)
A86
THIS DOCUMENT IS FOR INSTRUCTORS USING OBJECT ORIENTED SOFTWARE ENGINEERING: DO NOT GIVE TO OTHERS.