Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Object-Oriented Design
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide1
Object-oriented Design
Designing systems using self-contained
objects and object classes
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide2
Objectives
SoftwareEngineering,6thedition.Chapter12
Slide3
Topics covered
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide4
Characteristics of OOD
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide5
Interacting objects
o1: C1
state o1
ops1()
o3:C3
state o3
ops3 ()
o4: C4
o2: C3
o6: C1
o5:C5
state o2
ops3 ()
state o6
ops1 ()
state o5
ops5 ()
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
state o4
ops4 ()
Slide6
Advantages of OOD
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide7
Object-oriented development
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide8
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide9
Objects
Anobjectisanentitywhichhasastateandadefinedsetof
operationswhichoperateonthatstate.Thestateisrepresentedasa
setofobjectattributes.Theoperationsassociatedwiththeobject
provideservicestootherobjects(clients)whichrequestthese
serviceswhensomecomputationisrequired.
Objectsarecreatedaccordingtosomeobjectclassdefinition.An
objectclassdefinitionservesasatemplateforobjects.Itincludes
declarationsofalltheattributesandserviceswhichshouldbe
associatedwithanobjectofthatclass.
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide10
Several different notations for describing objectoriented designs were proposed in the 1980s and
1990s
The Unified Modeling Language is an integration
of these notations
It describes notations for a number of different
models that may be produced during OO analysis
and design
It is now a de facto standard for OO modelling
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide11
SoftwareEngineering,6thedition.Chapter12
Slide12
Object communication
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide13
Message examples
// Call a method associated with a buffer
// object that returns the next value
// in the buffer
v = circularBuffer.Get () ;
// Call the method associated with a
// thermostat object that sets the
// temperature to be maintained
thermostat.setTemp (20) ;
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide14
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide15
A generalisation hierarchy
Employee
Ma nager
Programmer
budgetsControlled
dateAppointed
project
progLanguage
Project
Ma nag er
projects
IanSommerville2000
De pt.
Ma nager
dept
Strategic
Ma nag er
responsibilities
SoftwareEngineering,6thedition.Chapter12
Slide16
Advantages of inheritance
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide17
SoftwareEngineering,6thedition.Chapter12
Slide18
SoftwareEngineering,6thedition.Chapter12
Slide19
UML associations
SoftwareEngineering,6thedition.Chapter12
Slide20
An association model
Employee
ismemberof
Department
ismanagedby
manages
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Manager
Slide21
Concurrent objects
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide22
Servers.
Active objects
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide23
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide24
SoftwareEngineering,6thedition.Chapter12
Slide25
Java threads
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide26
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide27
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide28
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide29
Layered architecture
subsystem
Da ta display
Datadisplaylayerwhereobjectsare
concernedwithpreparingand
presentingthedatainahuman
readableform
subsystem
Da ta archiving
Dataarchivinglayerwhereobjects
areconcernedwithstoringthedata
forfutureprocessing
subsystem
Da ta processing
Dataprocessinglayerwhereobjects
areconcernedwithcheckingand
integratingthecollecteddata
subsystem
Da ta collection
Datacollectionlayerwhereobjects
areconcernedwithacquiringdata
fromremotesources
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide30
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide31
subsystem
Da ta display
Observer
Satellite
User
interface
Co mms
Weather
station
subsystem
Da ta archiving
subsystem
Da ta processing
Da ta
checking
IanSommerville2000
Ma p
printer
Ma p
Balloon
Ma p
display
Da ta
integration
Da ta
storage
Ma p store
SoftwareEngineering,6thedition.Chapter12
Da ta store
Slide32
SoftwareEngineering,6thedition.Chapter12
Slide33
Use-case description
System
Use-case
Actors
Data
Stimulus
Response
Comments
Weather station
Report
Weather data collection system, Weather station
The weather station sends a summary of the weather data that has been
collected from the instruments in the collection period to the weather data
collection system. The data sent are the maximum minimum and average
ground and air temperatures, the maximum, minimum and average air
pressures, the maximum, minimum and average wind speeds, the total rainfall
and the wind direction as sampled at 5 minute intervals.
The weather data collection system establishes a modem link with the weather
station and requests transmission of the data.
The summarised data is sent to the weather data collection system
Weather stations are usually asked to report once per hour but this frequency
may differ from one station to the other and may be modified in future.
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide34
Architectural design
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide35
Manages all
external
communications
subsystem
Da ta collection
Collects and
summarises
weather data
subsystem
Instruments
IanSommerville2000
Package of
instruments for raw
data collections
SoftwareEngineering,6thedition.Chapter12
Slide36
Object identification
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide37
Approaches to identification
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide38
Weather station
Weather data
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide39
WeatherStation
identifier
airTemperatures
groundTemperatures
win dSpeeds
win dDirections
pressures
rainfall
reportWeather ()
calibrate (instruments)
test ()
startup (instruments)
shutdown (instruments)
Ground
the rmometer
temperature
test ()
calibrate ()
IanSommerville2000
collect ()
summarise ()
Anemometer
Ba rom eter
win dSpeed
win dDirection
pressure
height
test ()
test ()
calibrate ()
SoftwareEngineering,6thedition.Chapter12
Slide40
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide41
Design models
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide42
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide43
Subsystem models
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide44
subsystem
Da ta collection
Co mmsCo ntroller
WeatherStation
WeatherData
Instrument
Status
subsystem
Instruments
IanSommerville2000
Air
thermometer
Ra inGauge
Anemometer
Ground
thermometer
Barometer
Wind Vane
SoftwareEngineering,6thedition.Chapter12
Slide45
Sequence models
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide46
:WeatherStation
:WeatherData
request (report)
acknowledge ()
report ()
summarise ()
send (report)
reply (report)
acknowledge ()
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide47
Statecharts
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide48
calibrate()
Calibrating
calibrationOK
Shutdown
startup()
test()
Waiting
Testing
transmissiondone
shutdown()
testcomplete
Transmitting
clock
collection
done
reportWeather()
Summarising
weathersummary
complete
Collecting
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide49
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide50
SoftwareEngineering,6thedition.Chapter12
Slide51
Design evolution
SoftwareEngineering,6thedition.Chapter12
Slide52
Changes required
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide53
Pollution monitoring
WeatherStation
Air quality
identifier
reportWeather ()
reportAirQuality ()
calibrate (instruments)
test ()
startup (instruments)
shutdown (instruments)
NO Data
smokeData
benzeneData
collect ()
summarise ()
SmokeMeter
BenzeneMeter
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide54
Key points
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide55
Key points
IanSommerville2000
SoftwareEngineering,6thedition.Chapter12
Slide56