Professional Documents
Culture Documents
Object-Oriented Design
(cont’d)
Ma nager Programmer
budgetsControlled project
progLanguage
dateAppointed
(cont’d)
(cont’d)
Employee
is-member-of Department
is-managed-by
annotations
manages
Manager
Position currentPosition ;
Coords c1, c2 ;
Java-based interface
Satellite sat1, sat2 ;
Navigator theNavigator ; description
public Position givePosition ()
{ ON DEMAND
return currentPosition ;
}
} //Transponder
©Ian Sommerville 2000 Software Engineering. Chapter 14 Slide 37
Active object implementation: Java
threads, Ada tasks, etc.
● Threads in Java are a simple construct
for implementing concurrent objects.
● Threads must include a method called
run() and this is started up by the Java
run-time system.
● Active objects typically include an infinite
loop so that they are always carrying out
the computation.
Weather Ma p
Balloon Ma p printer
station
«subsystem» «subsystem»
Da ta processing Da ta archiving
Da ta
Da ta Da ta storage
checking integration
Ma p store Da ta store
Shutdown
Ca librate
Test
Manages all
«subsystem» external
Interface communications
Collects and
«subsystem» summarises
Da ta collection weather data
Package of
«subsystem» instruments for raw
Instruments data collections
UML annotations
UML “nested packages”
©Ian Sommerville 2000 Software Engineering. Chapter 14 Slide 51
3. Identify principal system
objects
● Identifying objects (or object classes) is
the most difficult part of OO design.
● There is no “magic formula” – it relies on
the skill, experience, and domain
knowledge of system designers
● An iterative process – you are unlikely to
get it right the first time.
identifier airTemperatures
groundTemperatures
reportWeather () win dSpeeds
calibrate (instruments) win dDirections
test () pressures
startup (instruments) rainfall
shutdown (instruments)
collect ()
summarise ()
(cont’d)
Active object
Co mmsCo ntroller WeatherData
Instrument
WeatherStation Status
Annotations
go here
«subsystem»
Instruments
Air
thermometer Ra inGauge Anemometer
Ground
thermometer Barometer Wind Vane
request (report)
acknowledge ()
report ()
summarise ()
Return of
No reply expected
control
send (report)
reply (report)
acknowledge ()
calibration OK
startup () Waiting test () Testing
Shutdown
Transmitting
clock collection
done reportWeather ()
weather summary
Summarising complete
Collecting
} //WeatherStation
NO meter SmokeMeter
BenzeneMeter
Object-Oriented Design