csc-3325: chapter 7

22
Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Somme rville 1 CSC-3325: Chapter 7 Title : Object Oriented Analysis and Design Reading: I. Sommerville, Chap. 12 + extra support

Upload: tilly

Post on 12-Jan-2016

40 views

Category:

Documents


0 download

DESCRIPTION

CSC-3325: Chapter 7. Title : Object Oriented Analysis and Design Reading: I. Sommerville , Chap . 12 + extra support. Object Oriented analysis. Objects are abstractions of real-world or system entities … Objects are independent and encapsulate state … - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSC-3325:  Chapter  7

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

Page 2: CSC-3325:  Chapter  7

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…

Page 3: CSC-3325:  Chapter  7

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.

Page 4: CSC-3325:  Chapter  7

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

Page 5: CSC-3325:  Chapter  7

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

Page 6: CSC-3325:  Chapter  7

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

Page 7: CSC-3325:  Chapter  7

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

Page 8: CSC-3325:  Chapter  7

Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 8

Object class notation

< attributes >

< services >

< class name >

Page 9: CSC-3325:  Chapter  7

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

Page 10: CSC-3325:  Chapter  7

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

Page 11: CSC-3325:  Chapter  7

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.

Page 12: CSC-3325:  Chapter  7

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

Page 13: CSC-3325:  Chapter  7

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

Page 14: CSC-3325:  Chapter  7

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

Page 15: CSC-3325:  Chapter  7

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

Page 16: CSC-3325:  Chapter  7

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

Page 17: CSC-3325:  Chapter  7

Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 17

Multiple inheritance

# Tapes

Talking book

AuthorEditionPublication dateISBN

Book

SpeakerDurationRecording date

Voice recording

Page 18: CSC-3325:  Chapter  7

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

Page 19: CSC-3325:  Chapter  7

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

Page 20: CSC-3325:  Chapter  7

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

Page 21: CSC-3325:  Chapter  7

Soft. Eng. II, Spr. 2002 Dr Driss Kettani, from I. Sommerville 21

Service usage

IssueReturn

Libraryuser

Libraryitem

AcquireCatalogueDispose

Librarystaff

RegisterDe-register

Page 22: CSC-3325:  Chapter  7

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