Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 1
CSC-3325: Chapter 7
Title : Object Oriented Analysis and Design
Reading: I. Sommerville, Chap. 12 + extra support
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 2
Object Oriented analysis Objects are abstractions of real-world or
system entities… Objects are independent and encapsulate
state… System functionality is expressed in
terms of object services… Objects communicate by message
passing…
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 3
What is an object ?
An object is an entity which has a state and a defined set of
operations which operate on that state. The state is represented as a
set of object attributes. The operations associated with the object
provide services to other objects (clients) which request these
services when some computation is required. Objects are created
according to some object class definition. An object class definition
serves as a template for objects. It includes declarations of all the
attributes and services which should be associated with an object of
that class.
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 4
Object models
Object models describe the system in terms of
object classes
An object class is an abstraction over a set of
objects with common attributes and the services
(operations) provided by each object
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 5
OO analysis, how to proceed ?
The identification of objects, their attributes and services
The organization of objects into an aggregation hierarchy
The construction of dynamic object-use descriptions
which show how services are used
The specification of object interfaces
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 6
Object models
Various object models may be produced Objects models
Inheritance models
Aggregation models
Service models
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 7
Object models
Natural ways of reflecting the real-world entities manipulated by the system
More abstract entities are more difficult to model using this approach
Object class identification is recognized as a difficult process requiring a deep understanding of the application domain
Object classes reflecting domain entities are reusable across systems
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 8
Object class notation
< attributes >
< services >
< class name >
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 9
Object identification
Identifying objects is the most difficult part of
object oriented design.
There is no 'magic formula' for object
identification. It relies on the skill, experience
and domain knowledge of system designers.
Object identification is an iterative process.
You are unlikely to get it right first time
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 10
Approaches to identification
Use a grammatical approach based on a natural language description of the system (used in Hood method)
Base the identification on tangible things in the application domain
Use a behavioural approach and identify objects based on what participates in what behaviour
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 11
An office information system
The Office Information Retrieval System (OIRS) isan automatic file clerk which can file documents under some name in one or more indexes, retrieve documents, display and maintain document indexes, archive documents and destroy documents.
The system is activated by a request from the user and always returns a message to the user indicating the success or failure of the request.
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 12
Inheritance models Organise the domain object classes into a
hierarchy Classes at the top of the hierarchy reflect the
common features of all classes Object classes inherit their attributes and
services from one or more super-classes. these may then be specialised as necessary
Class hierarchy design is a difficult process if duplication in different branches is to be avoided
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 13
Library class hierarchyCatalogue numberAcquisition dateCostTypeStatusNumber of copies
Library item
AcquireCatalogueDisposeIssueReturn
AuthorEditionPublication dateISBN
Book
YearIssue
Magazine
DirectorDate of releaseDistributor
Film
VersionPlatform
Computerprogram
TitlePublisher
Published item
TitleMedium
Recorded item
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 14
User class hierarchy
NameAddressPhoneRegistration #
Library user
RegisterDe-register
Affiliation
Reader
Items on loanMax. loans
Borrower
DepartmentDepartment phone
Staff
Major subjectHome address
Student
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 15
Advantages of inheritance It is an abstraction mechanism which
may be used to classify entities It is a reuse mechanism at both the
design and the programming level The inheritance graph is a source of
organisational knowledge about domains and systems
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 16
Multiple inheritance Rather than inheriting the attributes and services
from a single parent class, a system which supports multiple inheritance allows object classes to inherit from several super-classes
Can lead to semantic conflicts where attributes/services with the same name in different super-classes have different semantics
Makes class hierarchy reorganisation more complex
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 17
Multiple inheritance
# Tapes
Talking book
AuthorEditionPublication dateISBN
Book
SpeakerDurationRecording date
Voice recording
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 18
Object aggregation
Aggregation model shows how classes which are collections are composed of other classes
Similar to the part-of relationship in semantic data models
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 19
Object aggregation
Videotape
Tape ids.
Lecturenotes
Text
OHP slides
Slides
Assignment
Credits
Solutions
Text
Problems
#Problems#Text
TitleNumberYearInstructor
Course
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 20
Service-usage models These models show how services
provided by one object are used by other objects
Must be used sparingly as, obviously, some objects provide common services which are used by many other objects in the system
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 21
Service usage
IssueReturn
Libraryuser
Libraryitem
AcquireCatalogueDispose
Librarystaff
RegisterDe-register
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 22
Object interface design Concerned with specifying the detail of
the object interfaces. This means defining attribute types and the signatures and semantics of object operations
Representation information should be avoided
Precise specification is essential so a programming language description should be used