Computing and SE II Chapter 5: Requirements Analysis

86
Computing and SE II Chapter 5: Requirements Analysis Er-Yu Ding Software Institute, NJU

description

Computing and SE II Chapter 5: Requirements Analysis. Er-Yu Ding Software Institute, NJU. Main Contents. Models of Requirement Analysis Structural Analysis: Entity-Relationship Diagram Structural Analysis: Data Flow Diagram Structural Analysis: State Transition Diagram - PowerPoint PPT Presentation

Transcript of Computing and SE II Chapter 5: Requirements Analysis

Page 1: Computing and SE II  Chapter 5: Requirements Analysis

Computing and SE II

Chapter 5: Requirements Analysis

Er-Yu DingSoftware Institute, NJU

Page 2: Computing and SE II  Chapter 5: Requirements Analysis

Main Contents

1. Models of Requirement Analysis2. Structural Analysis: Entity-Relationship Diagram3. Structural Analysis: Data Flow Diagram4. Structural Analysis: State Transition Diagram5. Object-Oriented Analysis: Use Case Diagram6. Object-Oriented Analysis: Class Diagram7. Object-Oriented Analysis: Behavioral Diagram 8. Object-Oriented Analysis: CRC Card9. Writing the Software Specification

Page 3: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis ——Requirements analysis

计算世界现实世界

分析模型

用户模型

计算模型

Analysis

Outcome of Analysis

Page 4: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— The Analysis Model

The analysis model consists of a wide variety of diagrammatic forms used to bridge an important gap.

• Describe what the customer wants built• Establish the foundation for the software design• Provide a set of validation requirements

SystemDescription

DesignModel

AnalysisModel

Purpose:

System information System function System behaviors

Page 5: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis

—— Model• What is a model?– a model is a simplification of reality

• Why do we model?– we build models so that we can better understand the system we

are developing– we build models of complex systems because we cannot

comprehend such a system in its entirety– four aims to achieve

• help us to visualize a system• permit us to specify the structure/behavior of a system• give us a template that guides us in constructing systems• document the decisions we have made

Page 6: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Software Model

• A model is an abstract representation of a system that enables us to answer questions about the system.– When we represent it with real world language,

it’s user model– When we represent it with computing world

language, it’s design model– When we represent it with codes, it’s program

model– When we represent it with a neutral, formal

language, it’s analysis model– …

Page 7: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— How to represent software

model?• Describes necessary and complete knowledge– Stakeholders can get what they want

• Decision makers• Users ,clients…• Developers

– Analyst– Designer– Programmer– Integrator

– Developers can develop software according to software model

• Data, behavior, business rules…

Page 8: Computing and SE II  Chapter 5: Requirements Analysis

cont

ent

cont

ent

ViewpointPerspective

ViewpointPerspective

……

View

...

...

Software Model

Page 9: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Model and View

• Model, views, viewpoints, and stakeholders– A model is a simplification of reality, created in

order to better understand the system being created; a semantically closed abstraction of a system

– A stakeholder is an individual, team, or organization (or classes thereof) with interests in, or viewpoints relative to, a system

– A content type is an kind of information needed for software development

Page 10: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Viewpoints, perspectives

and views• Viewpoint is defined as a standing position used by an individual when examining a universe of discourse (Stakeholders Roles)

• A perspective is defined as a set of facts observed and modelled according to a particular aspect of reality (Certain type content observed from some viewpoint)

• A view is defined as an integration of related perspectives, usually using two kinds of methods– According to viewpoint (all perspectives observed by some

stakeholders role on different content types)– According to content type (all perspectives observed by

different stakeholders on some content types)

Page 11: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Describing Perspectives

• A perspective language is used to represent the observed information of the perspectives– Text, Diagram (semi-formal language), Formal

Language…

• The language defines the set of units and their associations that can be used to describe perspectives

• Languages N:M perspectives• There is no semi-formal or formal language

can describe all kinds of perspectives

Page 12: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Common Perspectives Languages

• UML– Object diagram

• Classification model – Behavioral diagram– OCL– Use case diagram

• Entity-Relationship Diagram– Composition( semantic data)

model• Process Model (DFD)

– Data processing model• State Machine Model

– Stimulus/response model

Fact Model Entity-event model Object Role Model Organization model Petri Nets ……

Page 13: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— Analysis Model – Structural

Data dictionary

ERD DFD

STD

Control Specification (CSPEC)

Data Objectdescription

Process specification(PSPEC)

Data

Behavior

Function

Page 14: Computing and SE II  Chapter 5: Requirements Analysis

1. Models of Requirement Analysis —— OO Analysis Model - UML

Data

Behavior

Function

Object

State-chart diagramInteraction diagram

Class diagramObject diagram

Use case diagramActivity diagram

Page 15: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

——Data Modeling Examines data objects independently of processing Focuses attention on the data domain Creates a model at the customer’s level of abstraction Indicates how data objects relate to one another

Automobile Person

MakeModel

Body typePriceColor

BirthdayHeightWeight

Expertise

Page 16: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— What is a Data Object?Object—something that is described by a set

of attributes (data items) and that will be manipulated within the software (system)

each instanceof an object (e.g., a book) can be identified uniquely (e.g., ISBN #)

each plays a necessary role in the systemi.e., the system could not function without access to instances of the object

each is described by attributes that are themselves data items

Page 17: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— Typical Objectsexternal entities (printer, user, sensor)

things (e.g, reports, displays, signals) occurrences or events (e.g., interrupt, alarm)

roles (e.g., manager, engineer, salesperson)organizational units (e.g., division, team)

places (e.g., manufacturing floor)

structures (e.g., employee record)

Automobile Person

Page 18: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— Data Objects and AttributesA data object contains a set of attributes that act as an aspect, quality, characteristic, or descriptor of the object

Automobile Person

MakeModel

Body typePriceColor

BirthdayHeightWeight

Expertise

Page 19: Computing and SE II  Chapter 5: Requirements Analysis

own

Connectedness A fact that must be remembered by the system and cannot or is not

computed or derived Several instance of a relationship can exist Entity can be related in many ways

2. Structural Analysis: Entity-Relationship Diagram

——Relationship

Page 20: Computing and SE II  Chapter 5: Requirements Analysis

Automobile Person

MakeModel

Body typePriceColor

BirthdayHeightWeight

Expertise

own

ownown

2. Structural Analysis: Entity-Relationship Diagram

——Cardinality and Multiplicity

Page 21: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— ERD Notation

(0, m) (1, 1)

objectobject objectobjectrelationshiprelationship11 22

One common form:One common form:

(0, m)(0, m)

(1, 1)(1, 1)

objectobject11 objectobject22relationshiprelationship

Another common form:Another common form:attributeattribute

attributeattribute

Page 22: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— The ERD: An Example(1,1)(1,1) (1,m)(1,m)

placesplacesCustomerCustomerrequestrequestfor servicefor service

generatesgenerates (1,n)(1,n)

(1,1)(1,1)

workworkorderorder

workworktaskstasks

materialsmaterials

consistsconsistsofof

listslists

(1,1)(1,1)(1,w)(1,w)

(1,1)

(1,i)(1,i)

selectedselectedfromfrom

standardstandardtask tabletask table

(1,w)(1,w)

(1,1)(1,1)

Page 23: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram

—— Building an ERD

• Level 1—model all data objects (entities) and their “connections” to one another

• Level 2—model all entities and relationships

• Level 3—model all entities, relationships, and the attributes that provide further depth

Page 24: Computing and SE II  Chapter 5: Requirements Analysis

2. Structural Analysis: Entity-Relationship Diagram——ERD- Let’s try it

• 为选课系统建立 ERD描述

Page 25: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

——Flow Oriented Model• Represents how data objects are transformed at they move through the system

• A data flow diagram (DFD) is the diagrammatic form that is used

• Considered by many to be an ‘old school’ approach, flow-oriented modeling continues to provide a view of the system that is unique—it should be used to supplement other analysis model elements

Page 26: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— The Flow ModelEvery computer-based system is an Every computer-based system is an information transform ....information transform ....

computercomputerbasedbased

systemsysteminputinput outputoutput

Page 27: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Flow Modeling Notationexternal entityexternal entity

processprocess

data flowdata flow

data storedata store

Page 28: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— External EntityA producer or consumer of data

Examples: a person, a device, a sensor

Another example: computer-basedsystem

Data must always originate somewhereand must always be sent to something

Page 29: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— ProcessA data transformer (changes inputA data transformer (changes inputto output)to output)

Examples: compute taxes, determine area,Examples: compute taxes, determine area,format report, display graph format report, display graph

Data must always be processed in some Data must always be processed in some way to achieve system functionway to achieve system function

Page 30: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Data FlowData flows through a system, beginningData flows through a system, beginningas input and be transformed into output.as input and be transformed into output.

computecomputetriangle triangle

areaarea

basebase

heightheight

areaarea

Page 31: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Data StoresDataData is often stored for later use.is often stored for later use.

look-uplook-upsensorsensor

datadata

sensor #sensor #

report requiredreport required

sensor #, type, sensor #, type, location, agelocation, age

sensor datasensor data

sensor numbersensor number

type, type, location, agelocation, age

Page 32: Computing and SE II  Chapter 5: Requirements Analysis

• all icons must be labeled with meaningful names• the DFD evolves through a number of levels of

detail• always begin with a context level diagram (also

called level 0)• always show external entities at level 0• always label data flow arrows• do not represent procedural logic

3. Structural Analysis: Data Flow Diagram

—— Data Flow Diagramming

Page 33: Computing and SE II  Chapter 5: Requirements Analysis

digitaldigitalvideovideo

processorprocessor

processing processing requestrequest

NTSCNTSCvideo signalvideo signal

requestedrequestedvideovideosignalsignal

useruser

videovideosourcesource

monitormonitor

3. Structural Analysis: Data Flow Diagram

——Level 0 (Context Diagram)

Page 34: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Constructing a DFD—I• review the descriptions and use a

grammatical parse to determine “operations”

• determine external entities (producers and consumers of data)

• create a level 0 DFD

Page 35: Computing and SE II  Chapter 5: Requirements Analysis

• write a narrative describing the transform

• parse to determine next level transforms

• “balance” the flow to maintain data flow continuity

• develop a level 1 DFD

3. Structural Analysis: Data Flow Diagram

—— Constructing a DFD—Refine Process

Page 36: Computing and SE II  Chapter 5: Requirements Analysis

PPaa bb

xx yy level 0level 0

p1p1

p2p2

p3p3

p4p4 55

aa

bb

cc

ddee

ff

gglevel 1level 1

3. Structural Analysis: Data Flow Diagram

—— Level 1

Page 37: Computing and SE II  Chapter 5: Requirements Analysis

• Each bubble is refined until it does just one thing• The expansion ratio decreases as the number of levels

increase• Most systems require between 3 and 7 levels for an adequate

flow model

3. Structural Analysis: Data Flow Diagram

—— Flow Modeling Notes

Page 38: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Using PSPEC

PSPECPSPEC

narrativenarrative

pseudocode (PDL)pseudocode (PDL)

equationsequations

tablestables

diagrams and/or chartsdiagrams and/or charts

bubblebubble

• Process Specification (PSPEC) can be used to specify the processing details implied by a process within a DFD

Page 39: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— Using PSPECCheck & Check & convert convert pressurepressure

PSPECPSPECIf absolute tank pressure > max pressure then set above pressure to “true”;else set above pressure to “false”; begin conversion algorithm x-01a; compute converted pressure; endend if

Page 40: Computing and SE II  Chapter 5: Requirements Analysis

Maps intoMaps intoanalysis modelanalysis model

design modeldesign model

3. Structural Analysis: Data Flow Diagram

—— Mapping to design model

Page 41: Computing and SE II  Chapter 5: Requirements Analysis

3. Structural Analysis: Data Flow Diagram

—— DFD- Let’s try it• 用 DFD描述 ATM机的功能

Page 42: Computing and SE II  Chapter 5: Requirements Analysis

4. Structural Analysis: State Transition Diagram

——Behavioral modeling • The behavioral model indicates how software will respond to external events or stimuli.

Outsideworld Application

events behavior

How do I model the software's reaction to some external event?

Page 43: Computing and SE II  Chapter 5: Requirements Analysis

• State: – a set of observable circum-stances that characterizes

the behavior of a system at a given time

• State transition: – the movement from one state to another

• Event: – an occurrence that causes the system to exhibit

some predictable form of behavior

• Action: – process that occurs as a consequence of making a

transition

4. Structural Analysis: State Transition Diagram

—— Basic concept

Page 44: Computing and SE II  Chapter 5: Requirements Analysis

1. Make a list of the different states of a system (How does the system behave?)

2. Indicate how the system makes a transition from one state to another (How does the system change state?)1. indicate event2. indicate action

3. Draw a state transition diagram

4. Structural Analysis: State Transition Diagram

—— State Modeling

Page 45: Computing and SE II  Chapter 5: Requirements Analysis

button1&2Pressed

button1&2Pressed

button1Pressed

button2Pressed

button2Pressed

button2Pressed

button1Pressed

button1&2Pressed IncrementMinutes

IncrementHours

BlinkHours

BlinkSeconds

BlinkMinutes

IncrementSeconds

StopBlinking

StateInitial state

Final state

Transition

Event

4. Structural Analysis: State Transition Diagram

——Notation and Example

Page 46: Computing and SE II  Chapter 5: Requirements Analysis

4. Structural Analysis: State Transition Diagram

—— State Diagram - Lets Try It!You are designing a traffic light system for this intersection.

Draw a state diagram showing the different states and how they transition.

North

South

East

West

Page 47: Computing and SE II  Chapter 5: Requirements Analysis

5. Object-Oriented Analysis: Use Case Diagram

—— Use-Cases

• A scenario that describes a thread of usage for achieving a functional requirement

• Actors represent roles people, devices, or external systems play

• System internals are ignored

“[Use-cases] are simply an aid to defining what exists outside the system (actors) and what should be performed by the system (use-cases).”

–Ivar JacobsonKey Points:

Example:

See Pressman Chapter 8, Section 8.5.1

Page 48: Computing and SE II  Chapter 5: Requirements Analysis

5. Object-Oriented Analysis: Use Case Diagram

—— The Key Elements of a Use-Case

• A descriptive name for the scenario– e.g., “Customer Checkout”, “Browse Products”

• The primary actor in the scenario– Who is interacting with the system?

• The primary actor’s goal– What is the actor trying to accomplish?

• Scenario pre-conditions– What assumptions are being made?

• Scenario trigger– How was the scenario initiated?

• The “sunny day” scenario– In the best case, how does the user interact with the system?

• Exceptions– What might go wrong?

Remember why we’re interested in

use-cases!

Page 49: Computing and SE II  Chapter 5: Requirements Analysis

5. Object-Oriented Analysis: Use Case Diagram

—— Developing a Use-Case(1) What should we write about?(2) How much should we write about it?(3) How detailed should we make our description? (4) How should we organize the description?

• What are the main tasks or functions that are performed by the actor?

• What system information will the actor acquire, produce or change?

• Will the actor have to inform the system about changes in the external environment?

• Does the actor wish to be informed about unexpected changes?• …

Page 50: Computing and SE II  Chapter 5: Requirements Analysis

5. Object-Oriented Analysis: Use Case Diagram

——Use Case Diagram - Let’s Try It

The Online Bookstore System (OBS) will be a web-based application that allows customers to browse and purchase online product offerings. The application will support the notion of an online shopping cart, similar to other online retailers such as Amazon.com. The checkout features of the system will be integrated with our credit card transaction processor, as well as our internal billing system. The system will also provide an administrator-view that will allow authorized employees to view and administer products, customers, and orders.

The Online Bookstore

1. Based on this description, what are the key use-cases?2. Select one key use-case, describes it.

Page 51: Computing and SE II  Chapter 5: Requirements Analysis

5. Object-Oriented Analysis: Use Case Diagram

—— Use-Case DiagramsYou’ll probably have a lot of use-cases!

• Actors• Use-cases• Relationships among

them

Use case diagrams (UCD) provide a diagrammatic table of contents, and a high-level overview of the system.

Diagrams Show:

Example UCD

Online BookstoreSystem

Browse products

View shopping cart

Add products toshopping cart

Customer

Checkout

Credit cardtransaction processor

Billing system

Page 52: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

——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

• Key concepts:– Classes and objects

• Attributes and operations• Encapsulation

– Association and Link• Inheritance• Aggregation (Composition)• Polymorphism

Page 53: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Objects

• Natural ways of reflecting the real-world entities manipulated by the system

• Object class identification is recognised as a difficult process requiring a deep understanding of the application domain

• Object classes reflecting domain entities are reusable across systems

Page 54: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram——Attributes and operations

class name

attributes:

operations:

attributes:

operations

System

program() display() reset() query() modify() call()

systemID verificationPhoneNumber systemStatus delayTime telephoneNumber masterPassword temporaryPassword numberTries

Class name

attributes

operations

Page 55: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram—— Encapsulation/Hiding

The object encapsulatesboth data and the logicalprocedures required tomanipulate the data

Achieves “information hiding”

method # 1

data

method # 2

method # 4

method # 5

method # 6

method # 3

Page 56: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Associations and Dependencies

• Two analysis classes are often related to one another in some fashion– In UML these relationships are called

associations– Associations can be refined by indicating

multiplicity (the term cardinality is used in data modeling

• If there are associations between classes, then there are links between instances of the classes

Page 57: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Association

WallSegment Window Door

Wall

is used to buildis used to build

is used to build1..*

1 1 1

0..* 0..*

Page 58: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

——Inheritance• 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

Page 59: Computing and SE II  Chapter 5: Requirements Analysis

User class hierarchy

NameAddressPhoneRegistration #

Library user

Register ()De-register ()

Affiliation

Reader

Items on loanMax. loans

Borrower

DepartmentDepartment phone

Staff

Major subjectHome address

Student

Page 60: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram—— 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 61: Computing and SE II  Chapter 5: Requirements Analysis

Object Aggregation

Videotape

Tape ids.

Lecturenotes

Text

OHP slides

Slides

Assignment

Credits

Solutions

TextDiagrams

Exercises

#Problems Description

Course titleNumberYearInstructor

Study pack

Page 62: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Class-Based Modeling• Identify analysis classes by examining the problem statement

• Use a “grammatical parse” to isolate potential classes

• Identify the attributes of each class• Identify operations that manipulate the

attributes

Page 63: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram—— Identifying Analysis Classes

external entities

things

occurrences roles

organizational units

places

structures

class name

attributes:

operations:

Page 64: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Class Selection Criteria1. Retained information2. Needed services3. Multiple attributes4. Common attributes5. Common operations6. Essential

requirements

Page 65: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

——Class Selection• The SafeHome security function enables the homeowner to configure the security

system when it is installed, monitors all sensors connected to the security system, and interacts with the homeowner through the Internet, a PC, or a control panel.

• During installation, the SafeHome PC is used to program and configure the system. Each sensor is assigned a number and type, a master password is programmed for arming and disarming the system, and telephone number(s) are input for dialing when a sensor event occurs.

• When a sensor event is recognized, the software invokes an audible alarm attached to the system. After a delay time that is specified by the homeowner during system configuration activities, the software dials a telephone number of a monitoring service, provides information about the location, reporting the nature of the event that has been detected. The telephone number will be redialed every 20 seconds until a telephone connection is obtained.

• The homeowner receives security information via a control panel, the PC, or a browser, collectively called an interface. The interface displays prompting messages and system status information on the control panel, the PC, or the browser window. Homeowner interaction takes the following form…

Page 66: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Identifying ClassesPotential class Classification Accept / Reject

homeowner role; external entity reject: 1, 2 fail

sensor external entity accept

control panel external entity accept

installation occurrence reject

(security) system thing accept

number, type not objects, attributes reject: 3 fails

master password thing reject: 3 fails

telephone number thing reject: 3 fails

sensor event occurrence accept

audible alarm external entity accept: 1 fails

monitoring service organizational unit; ee reject: 1, 2 fail

Retained information

Needed services

Multiple attributes

Common attributes

Common operations

Essential requirements

Page 67: Computing and SE II  Chapter 5: Requirements Analysis

6. Object-Oriented Analysis: Class Diagram

—— Let’s Try It. Class Diagram• University Bank will be opening in Oxford, Mississippi, in January, 2000. We plan to use a full service automated teller machine (ATM) system.The ATM system will interact with the customer through a display screen, numeric and special input keys, a bankcard reader, a deposit slot, and a receipt printer.Customers may make deposits, withdrawals, and balance inquires using the ATM machine, but the update to accounts will be handled through an interface to the Accounts system.Customers will be assigned a Personal Identification Number (PIN) and clearance level by the Security system. The PIN can be verified prior to any transaction.In the future, we would also like to support routine operations such as a change of address or phone number using the ATM

Page 68: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

——Behavioral Diagram • State Chart

– State Transition Diagram

• Interaction Diagram– Sequence Diagram– Communication Diagram

• Activity Diagram

Page 69: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

——System behaviour modelling with States Chart

• The behavioral model indicates how software will respond to external events or stimuli. To create the model, the analyst must perform the following steps:– Evaluate all use-cases to fully understand the

sequence of interaction within the system.– Identify events that drive the interaction

sequence and understand how these events relate to specific objects.

– Build a state diagram for the system.– Review the behavioral model to verify accuracy

and consistency.

Page 70: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

—— Identifying Events• A use-case is examined for points of information

exchange.• The homeowner uses the keypad to key in a four-

digit password. The password is compared with the valid password stored in the system. If the password in incorrect, the control panel will beep once and reset itself for additional input. If the password is correct, the control panel awaits further action.

Page 71: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

—— State Diagram

State diagram for the ControlPanel class

Page 72: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram—— System behaviour modelling with Sequence

Diagram• A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a use-case

• Sequence diagrams (or collaboration diagrams) in the UML are used to model interaction between objects

Page 73: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

—— Sequence Diagram : Cashier

: POS System : Inventory System

makeNewSale( )

enterItem(itemID, quantity)

description, total

*[more items]

endSale( )

ready

total

makePayment( )

change duepayment information

receipt

Page 74: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

——Let’s Try It!• Give a correct version for figure 8-21.

Page 75: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram

—— System behaviour modelling with Activity DiagramSupplements the use-case Supplements the use-case

by providing a diagrammatic by providing a diagrammatic representation of procedural representation of procedural flowflow

How might we make this How might we make this better?better?

enter password and user ID

select major function

valid passwords/ ID

prompt for reentry

invalid passwords/ ID

input tries remain

no inputtries remain

select surveillance

other functions may also be

selected

thumbnail views select a specif ic camera

select camera icon

prompt for another view

select specific camera - thumbnails

exit this function see another camera

view camera output in labelled window

Page 76: Computing and SE II  Chapter 5: Requirements Analysis

7. Object-Oriented Analysis: Behavioral Diagram—— System behaviour modelling with Activity

Diagram

Allows the modeler to represent the flow of activities described by the use-case and at the same time indicate which actor (if there are multiple actors involved in a specific use-case) or analysis class has responsibility for the action described by an activity rectangle

enter password and user ID

select major function

valid passwords/ ID

prompt for reentry

invalidpasswords/ ID

input tries

remain

no input

tries remain

select surveillance

other functions may also be

selected

thumbnail views select a specif ic camera

select camera icon

generate video output

select specific camera - thumbnails

exit thisfunction

see

anothercamera

homeowner c amera int erf ac e

prompt foranother view

view camera output in labelled window

Swimlane Diagrams

Page 77: Computing and SE II  Chapter 5: Requirements Analysis

8. Object-Oriented Analysis: CRC Card——CRC Modeling

• CRC : Class-Responsibility- Collaborator• Analysis classes have “responsibilities”

– Responsibilities are the attributes and operations encapsulated by the class

• Analysis classes collaborate with one another– Collaborators are those classes that are

required to provide a class with the information needed to complete a responsibility.

– In general, a collaboration implies either a request for information or a request for some action.

Page 78: Computing and SE II  Chapter 5: Requirements Analysis

8. Object-Oriented Analysis: CRC Card

——CRC Card

(背面) (正面)

对象的描述 对象维护的状态

对象执行的行为

协作者候选对象 候选对象

Page 79: Computing and SE II  Chapter 5: Requirements Analysis

9. Writing the Software Specification

Everyone knew exactly what had to be done until someone wrote it down!

Page 80: Computing and SE II  Chapter 5: Requirements Analysis

The End

• Next Lecture– Software Design

Page 81: Computing and SE II  Chapter 5: Requirements Analysis

Reviews

• 为选课系统建立ERD描述• 用DFD描述ATM机的功能• 用STD描述十字路口红绿灯

Page 82: Computing and SE II  Chapter 5: Requirements Analysis

A First Level DFD

1.0Verify

CustomerID

2.0Initial

Transaction

3.0Process

Transaction

4.0Perform

accounting

CustomerSystemclock

Database

Printer

ATM card no

prompts

Lost-stolen_list

PINserviceRequested

transaction

Page 83: Computing and SE II  Chapter 5: Requirements Analysis

Back

Page 84: Computing and SE II  Chapter 5: Requirements Analysis

State Diagrams (Traffic light example)

Yellow

Red

Green

Traffic LightState

Transition

Event

Start

Page 85: Computing and SE II  Chapter 5: Requirements Analysis

Back

Page 86: Computing and SE II  Chapter 5: Requirements Analysis

Back