Top Banner
Lecturer: Dr. AJ Bieszczad Chapter 6 6-1 Object-Oriented analysis and design • Special nature of OO development • Use cases • Design with UML • OO system design • OO program design • OO measurements
51

Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-1

Object-Oriented analysis and design

• Special nature of OO development

• Use cases

• Design with UML

• OO system design

• OO program design

• OO measurements

Page 2: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-2

Object orientation

• identity

• abstraction

• classification

• encapsulation

• inheritance

• polymorphism

• persistence

Page 3: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-3

Objects and classes

• Every object has a name (also called a reference or handle).

• Objects can have attributes (such as color, size, location).

• Objects can have operations or behaviors (such as takeoff, land, repair).

• Each object is an instance of a class.• A specific implementation of an operation for a

certain class is called a method.

Page 4: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-4

Classification

Page 5: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-5

Forming a hierarchy

Page 6: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-6

Table 6.1: Tendency for change when using OO paradigm (Jacobson et al. 1995)

Characteristic of software product/project Probability for change

Objects derived from the application lowLong-lived information structures lowPassive object’s attribute mediumSequences of behavior mediumInterface with the outside world highFunctionality high

Page 7: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-7

OO design• Usually uses an OO requirements representation• System design identifies and represents objects and classes,

plus details of each objects attributes and behaviors.• System design also identifies interactions and relationships.• Program design inserts computational features in the

models.• Program design inserts class library details.• Program design considers nonfunctional requirements to

enhance design.

Page 8: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-8

OO and testing

Page 9: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-9

Use cases

• Diagrams have four elements:– actors– cases– extensions– uses

Page 10: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-10

Identifying participants• What users or groups use the system to perform a task?• What users or groups are needed so that the system can

perform its functions?• What external systems use the system to perform a task?• What external systems, users or groups send

information to the system?• What external systems, users or groups receive

information from the system?

Page 11: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-11

Example: Service station

Page 12: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-12

Service station use case diagram 1

Page 13: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-13

Service station use case diagram 2

Page 14: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-14

Service station use case diagram 3

Page 15: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-15

UML and the OO process

• Workflow diagrams

• Object model

• Sequence diagrams

• Collaboration diagrams

• Package diagrams

• Component diagrams

• Deployment diagrams

Page 16: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-16

UML support for development process

Page 17: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-17

First cut at object classes

• Structures• External systems• Devices• Roles• Operating procedures• Places• Organizations• Things that are manipulated by the system to be built

Page 18: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-18

Class box example

Page 19: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-19

Inheritance relationship

Page 20: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-20

Association relationship

Page 21: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-21

Types of class relationships

Page 22: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-22

UML notes and qualifies

Page 23: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-23

Service Station – first take

Page 24: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-24

Service Station – second take

Page 25: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-25

Service Station – final cut

Page 26: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-26

Class name: refuelCategory: serviceExternal documents:Export control: PublicCardinality: nHierarchy:

Superclasses: servicesAssociations:

fuel in association <name>Operation name: price

Public member of: refuelDocumentation:

// Calculates fuel final pricePreconditions:

gallons > 0Object diagram: (unspecified)

Semantics:final_price = gallons * priceObject diagram: (unspecified)

Concurrency: sequential

Public interface:Operations:

pricePrivate interface:

Attributes:gallonsprice

Implementation:Attributes:

gallonsprice

State machine: noConcurrency: sequentialPersistence: transient

Page 27: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-27

Service Station – package diagram

Page 28: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-28

Sequence Station – sequence diagram for the refuel use case

Page 29: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-29

Service Station – collaboration diagram for the perking use case

Page 30: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-30

State diagram example

Page 31: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-31

State diagram for Fuel class

Page 32: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-32

State diagram for Part class

Page 33: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-33

State diagram for Inventory class

Page 34: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-34

Activity diagram

Page 35: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-35

Activity diagram for Inventory class

Page 36: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-36

Guidelines for building classes

• What needs to be “processed” in some way?

• What items have multiple attributes?

• When do you have more than one object in a class?

• What is based on the requirements themselves, not derived from your understanding of the requirements?

• What attributes and operations are always applicable to a class or object?

Page 37: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-37

Guidelines for identifying behaviors

• Imperative verbs

• Passive verbs

• Actions

• Things or reminded events

• Roles

• Operating procedures

• Services provided by an organization

Page 38: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-38

Program design considerations

• Nonfunctional requirements

• Reused components

• Reusable components

• User interface requirements

• Data structure and management details

Page 39: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-39

Transition from paper to screen

Page 40: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-40

Possible design for new billing screen

Page 41: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-41

Implementing classes using relational database

Page 42: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-42

Observer pattern - relationships

Page 43: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-43

Observer pattern – sequence diagram

Page 44: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-44

Table 6.5: Lorenz and Kidd metrics collection in different phases of development.

Phase

Metric

RequirementsDescription

System Design Program Design Coding Testing

Number of scenarioscripts

X

Number of key classes X XNumber of support classes XAverage number ofsupport classes per keyclass

X

Number of subsystems X XClass size X X XNumber of operationsoverridden by a subclass

X X X X

Number of operationsadded by a subclass

X X X

Specialization index X X X X

Page 45: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-45

Table 6.7: Where to capture OO metrics.

Phase

Metric

Use cases Classdiagrams

Inter-actiondiagrams

Class descrip-tions

Statediagrams

Packagediagrams

Number of scenario scripts XNumber of key classes XNumber of support classes XAverage number ofsupport classes per keyclass

X

Number of subsystems XClass size X XNumber of operationsoverridden by a subclass

X

Number of operationsadded by a subclass

X

Specialization index XWeighted methods in class XDepth of inheritance XNumber of children XCoupling between objects XResponse for a class XLack of cohesion inmethods

X

Average operation size XAverage number ofparameters per operation

X

Operation complexity XPercent public andprotected

X

Public access to datamembers

X

Number of root classes XFan-in/fan-out X

Page 46: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-46

Object-oriented view of the Service Station

Page 47: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-47

Class hierarchy for the Service Station

Page 48: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-48

Table 6.6: Chidamber and Kemerer metrics collection in different phases of development.

Phase

Metric

System Design Program Design Coding Testing

Weighted methods perclass

X X X

Depth of inheritance X X XNumber of children X X XCoupling between objects X XResponse for a class X XLack of cohesion ofmethods

X X X

Page 49: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-49

Measuring Service Station system design

Page 50: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-50

Measuring Service Station program design

Page 51: Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.

Lecturer: Dr. AJ Bieszczad

Chapter 6 6-51

Measuring from a sequence diagram