59
1 COSC 4406 COSC 4406 Software Engineering Software Engineering Haibin Zhu, Ph.D. Haibin Zhu, Ph.D. Dept. of Computer Science and mathematics, Dept. of Computer Science and mathematics, Nipissing University, 100 College Dr., North Bay, Nipissing University, 100 College Dr., North Bay, ON P1B 8L7, Canada, ON P1B 8L7, Canada, [email protected] , , http://www.nipissingu.ca/faculty/haibinz http://www.nipissingu.ca/faculty/haibinz

COSC 4406 Software Engineering

Embed Size (px)

DESCRIPTION

COSC 4406 Software Engineering. Haibin Zhu, Ph.D. Dept. of Computer Science and mathematics, Nipissing University, 100 College Dr., North Bay, ON P1B 8L7, Canada, [email protected] , http://www.nipissingu.ca/faculty/haibinz. - PowerPoint PPT Presentation

Citation preview

Page 1: COSC 4406 Software Engineering

1

COSC 4406COSC 4406

Software Software EngineeringEngineering

Haibin Zhu, Ph.D.Haibin Zhu, Ph.D.Dept. of Computer Science and mathematics, Nipissing University, Dept. of Computer Science and mathematics, Nipissing University,

100 College Dr., North Bay, ON P1B 8L7, Canada, 100 College Dr., North Bay, ON P1B 8L7, Canada, [email protected], http://www.nipissingu.ca/faculty/haibinz, http://www.nipissingu.ca/faculty/haibinz

Page 2: COSC 4406 Software Engineering

2

Lecture 6Lecture 6Analysis Modeling Analysis Modeling

Ref. Chap. 8Ref. Chap. 8(8.1, 8.3, 8.4, 8.6, 8.7)(8.1, 8.3, 8.4, 8.6, 8.7)

Page 3: COSC 4406 Software Engineering

3

Requirements AnalysisRequirements Analysis

Requirements analysis Requirements analysis specifies software’s operational characteristicsspecifies software’s operational characteristics indicates software's interface with other system elements indicates software's interface with other system elements establishes constraints that software must meetestablishes constraints that software must meet

Requirements analysis allows the software engineer Requirements analysis allows the software engineer (called an (called an analystanalyst or or modelermodeler in this role) to: in this role) to: elaborate on basic requirements established during earlier elaborate on basic requirements established during earlier

requirement engineering tasksrequirement engineering tasks build models that depict user scenarios, functional activities, build models that depict user scenarios, functional activities,

problem classes and their relationships, system and class problem classes and their relationships, system and class behavior, and the flow of data as it is transformed. behavior, and the flow of data as it is transformed.

Page 4: COSC 4406 Software Engineering

4

A BridgeA Bridge

system description

analysis model

design model

Page 5: COSC 4406 Software Engineering

5

Rules of ThumbRules of Thumb The model should focus on requirements that are visible The model should focus on requirements that are visible

within the problem or business domain. The level of within the problem or business domain. The level of abstraction should be relatively high. abstraction should be relatively high.

Each element of the analysis model should add to an Each element of the analysis model should add to an overall understanding of software requirements and overall understanding of software requirements and provide insight into the information domain, function and provide insight into the information domain, function and behavior of the system.behavior of the system.

Delay consideration of infrastructure and other non-Delay consideration of infrastructure and other non-functional models until design. functional models until design.

Minimize coupling throughout the system. Minimize coupling throughout the system. Be certain that the analysis model provides value to all Be certain that the analysis model provides value to all

stakeholders. stakeholders. Keep the model as simple as it can be. Keep the model as simple as it can be.

Page 6: COSC 4406 Software Engineering

6

Data ModelingData Modeling

examines data objects examines data objects independently of processingindependently of processing

focuses attention on the data focuses attention on the data domaindomain

creates a model at the customer’s creates a model at the customer’s level of abstractionlevel of abstraction

indicates how data objects relate to indicates how data objects relate to one anotherone another

Page 7: COSC 4406 Software Engineering

7

What is a Data Object?What is a Data Object?

ObjectObject——something that is described by a setsomething that is described by a setof attributes (data items) and that will be of attributes (data items) and that will be manipulated within the software (system)manipulated within the software (system)

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

each plays a necessary role in the systemeach plays a necessary role in the systemi.e., the system could not function without i.e., the system could not function without access to instances of the objectaccess to instances of the objecteach is described by attributes that are each is described by attributes that are

themselves data itemsthemselves data items

Page 8: COSC 4406 Software Engineering

8

Typical ObjectsTypical Objects

external entitiesexternal entities (printer, user, sensor)(printer, user, sensor)thingsthings (e.g, reports, displays, signals) (e.g, reports, displays, signals)

occurrences or eventsoccurrences or events (e.g., interrupt, alarm)(e.g., interrupt, alarm)rolesroles (e.g., manager, engineer, salesperson)(e.g., manager, engineer, salesperson)

organizational unitsorganizational units (e.g., division, team)(e.g., division, team)placesplaces (e.g., manufacturing floor) (e.g., manufacturing floor)

structuresstructures (e.g., employee record)(e.g., employee record)

Page 9: COSC 4406 Software Engineering

9

Data Objects and Data Objects and AttributesAttributes

A data object contains a set of A data object contains a set of attributes that act as an aspect, attributes that act as an aspect, quality, characteristic, or descriptor of quality, characteristic, or descriptor of the objectthe objectobject: automobileobject: automobile

attributes:attributes: makemake modelmodel body typebody type priceprice options codeoptions code

Page 10: COSC 4406 Software Engineering

10

What is a Relationship?What is a Relationship?

relationshiprelationship——indicates “connectedness”; indicates “connectedness”; a "fact" that must be "remembered" a "fact" that must be "remembered" by the system and cannot or is not computed by the system and cannot or is not computed or derived mechanicallyor derived mechanically

several instances of a relationship several instances of a relationship can existcan exist

objects can be related in many objects can be related in many different waysdifferent ways

Page 11: COSC 4406 Software Engineering

11

ERD NotationERD 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

Page 12: COSC 4406 Software Engineering

12

The ERD: An ExampleThe ERD: An Example

(1,1)(1,1) (1,m)(1,m)placesplacesCustomerCustomer

requestrequestfor 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 13: COSC 4406 Software Engineering

13

Flow-Oriented Flow-Oriented ModelingModeling

Represents how data objects are transformed as Represents how data objects are transformed as they move through the systemthey move through the system

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

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

Page 14: COSC 4406 Software Engineering

14

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

computercomputerbasedbased

systemsysteminputinput outputoutput

Page 15: COSC 4406 Software Engineering

15

Flow Modeling NotationFlow Modeling Notation

external entityexternal entity

processprocess

data flowdata flow

data storedata store

Page 16: COSC 4406 Software Engineering

16

External EntityExternal Entity

A producer or consumer of dataA producer or consumer of data

Examples: a person, a device, a sensorExamples: a person, a device, a sensor

Another example: computer-basedAnother example: computer-basedsystemsystem

Data must always originate somewhereData must always originate somewhereand must always be sent to somethingand must always be sent to something

Page 17: COSC 4406 Software Engineering

17

ProcessProcess

A 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 18: COSC 4406 Software Engineering

18

Data FlowData Flow

Data 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 19: COSC 4406 Software Engineering

19

Data StoresData Stores

DataData 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 20: COSC 4406 Software Engineering

20

Data Flow Diagramming:Data Flow Diagramming:GuidelinesGuidelines

all icons must be labeled with all icons must be labeled with meaningful namesmeaningful names

the DFD evolves through a number of the DFD evolves through a number of levels of detaillevels of detail

always begin with a context level always begin with a context level diagram (also called level 0)diagram (also called level 0)

always show external entities at level always show external entities at level 00

always label data flow arrowsalways label data flow arrows do not represent procedural logicdo not represent procedural logic

Page 21: COSC 4406 Software Engineering

21

Constructing a DFD—IConstructing a DFD—I

review the data model to isolate data review the data model to isolate data objects and use a grammatical parse to objects and use a grammatical parse to determine “operations”determine “operations”

determine external entities (producers determine external entities (producers and consumers of data)and consumers of data)

create a level 0 DFDcreate a level 0 DFD

Page 22: COSC 4406 Software Engineering

22

Level 0 DFD ExampleLevel 0 DFD Example

useruserprocessing processing

requestrequest

videovideosourcesource NTSCNTSC

video signalvideo signal

digitaldigitalvideovideo

processorprocessor

requestedrequestedvideovideosignalsignal

monitormonitor

Page 23: COSC 4406 Software Engineering

23

Constructing a DFD—IIConstructing a DFD—II

write a narrative describing the write a narrative describing the transformtransform

parse to determine next level parse to determine next level transformstransforms

““balance” the flow to maintain data balance” the flow to maintain data flow continuityflow continuity

develop a level 1 DFDdevelop a level 1 DFD use a 1:5 (approx.) expansion ratiouse a 1:5 (approx.) expansion ratio

Page 24: COSC 4406 Software Engineering

24

The Data Flow HierarchyThe Data Flow Hierarchy

PPaa bbxx yy

p1p1p2p2

p3p3p4p4 55

aa

bb

cc

ddee

ff

gg

level 0level 0

level 1level 1

Page 25: COSC 4406 Software Engineering

25

Flow Modeling NotesFlow Modeling Notes

each bubble is refined until it does each bubble is refined until it does just one thingjust one thing

the expansion ratio decreases as the the expansion ratio decreases as the number of levels increasenumber of levels increase

most systems require between 3 and most systems require between 3 and 7 levels for an adequate flow model7 levels for an adequate flow model

a single data flow item (arrow) may a single data flow item (arrow) may be expanded as levels increase (data be expanded as levels increase (data dictionary provides information)dictionary provides information)

Page 26: COSC 4406 Software Engineering

26

Process Specification Process Specification (PSPEC)(PSPEC)

PSPECPSPEC

narrativenarrativepseudocode (PDL)pseudocode (PDL)

equationsequationstablestables

diagrams and/or chartsdiagrams and/or charts

bubblebubble

Page 27: COSC 4406 Software Engineering

27

Maps intoMaps into

DFDs: A Look AheadDFDs: A Look Ahead

analysis modelanalysis model

design modeldesign model

Page 28: COSC 4406 Software Engineering

28

Control Flow DiagramsControl Flow Diagrams

Represents “Represents “eventsevents” and the processes that ” and the processes that manage eventsmanage events

An “event” is a Boolean condition that can be An “event” is a Boolean condition that can be ascertained by:ascertained by:

listing all sensors that are "read" by the software.listing all sensors that are "read" by the software. listing all interrupt conditions.listing all interrupt conditions. listing all "switches" that are actuated by an operator.listing all "switches" that are actuated by an operator. listing all data conditions.listing all data conditions. recalling the noun/verb parse that was applied to the recalling the noun/verb parse that was applied to the

processing narrative, review all "control items" as possible processing narrative, review all "control items" as possible CSPEC inputs/outputs.CSPEC inputs/outputs.

Page 29: COSC 4406 Software Engineering

29

The Control The Control ModelModelthe control flow diagram is "superimposed" on the DFD the control flow diagram is "superimposed" on the DFD

and shows events that control the processes noted in and shows events that control the processes noted in the DFDthe DFD

control flows—events and control items—are noted by control flows—events and control items—are noted by dashed arrowsdashed arrows

a vertical bar implies an input to or output from a control a vertical bar implies an input to or output from a control spec (CSPEC) — a separate specification that spec (CSPEC) — a separate specification that describes how control is handleddescribes how control is handled

a dashed arrow entering a vertical bar is an input to the a dashed arrow entering a vertical bar is an input to the CSPECCSPEC

a dashed arrow leaving a process implies a data a dashed arrow leaving a process implies a data conditioncondition

a dashed arrow entering a process implies a control a dashed arrow entering a process implies a control input read directly by the processinput read directly by the process

control flows do not physically activate/deactivate the control flows do not physically activate/deactivate the processes—this is done via the CSPECprocesses—this is done via the CSPEC

Page 30: COSC 4406 Software Engineering

30

Control Flow Control Flow DiagramDiagram

readoperator

input

createuser

displaysperformproblem diagnosis

reloadprocess

managecopying

beeper on/off

start

copies done

display panel enabled

full

problem light

empty

jammed

Page 31: COSC 4406 Software Engineering

31

Control Specification Control Specification (CSPEC)(CSPEC)

The CSPEC can be:The CSPEC can be:

state diagram state diagram (sequential spec)(sequential spec)

state transition tablestate transition table

decision tables decision tables

activation tablesactivation tables

combinatorial speccombinatorial spec

Page 32: COSC 4406 Software Engineering

32

OOA (Object-Oriented OOA (Object-Oriented Analysis)Analysis)

Key concepts:Key concepts: Classes and objectsClasses and objects Attributes and operationsAttributes and operations Encapsulation and instantiationEncapsulation and instantiation InheritanceInheritance

Page 33: COSC 4406 Software Engineering

33

Figure 20-5Figure 20-5UML class and object diagramsUML class and object diagrams

(a) Class diagram showing two classes(a) Class diagram showing two classes(b) Object diagram with two instances(b) Object diagram with two instances

20.3320.33

Page 34: COSC 4406 Software Engineering

34

Object ModelingObject ModelingObject DiagramsObject Diagrams

Object DiagramObject Diagram A graph of instances that are compatible with a given A graph of instances that are compatible with a given

class diagram; also called an instance diagramclass diagram; also called an instance diagram Object is represented as a rectangle with two Object is represented as a rectangle with two

compartmentscompartments OperationOperation

A function or service that is provided by all the instances A function or service that is provided by all the instances of a classof a class

EncapsulationEncapsulation The technique of hiding the internal implementation The technique of hiding the internal implementation

details of an object from its external viewdetails of an object from its external view

20.3420.34

Page 35: COSC 4406 Software Engineering

35

Object ModelingObject ModelingObject DiagramsObject Diagrams

Types of OperationsTypes of Operations QueryQuery

An operation that accesses the state of an object but does not An operation that accesses the state of an object but does not alter the statealter the state

UpdateUpdate An operation that alters the state of an objectAn operation that alters the state of an object

ScopeScope An operation that applies to a class rather than an object An operation that applies to a class rather than an object

instance, (No for C++, Java)instance, (No for C++, Java) ConstructorConstructor

An operation that creates a new instance of a classAn operation that creates a new instance of a class

20.3520.35

Page 36: COSC 4406 Software Engineering

36

Class-Based ModelingClass-Based Modeling Identify analysis classes by examining the Identify analysis classes by examining the

problem statementproblem statement Use a “grammatical parse” to isolate Use a “grammatical parse” to isolate

potential classespotential classes Identify the attributes of each classIdentify the attributes of each class Identify operations that manipulate the Identify operations that manipulate the

attributesattributes

Page 37: COSC 4406 Software Engineering

37

Analysis ClassesAnalysis Classes External entitiesExternal entities (e.g., other systems, devices, people) that (e.g., other systems, devices, people) that

produce or consume information to be used by a computer-produce or consume information to be used by a computer-based system.based system.

ThingsThings (e.g, reports, displays, letters, signals) that are part of (e.g, reports, displays, letters, signals) that are part of the information domain for the problem.the information domain for the problem.

Occurrences or eventsOccurrences or events (e.g., a property transfer or the (e.g., a property transfer or the completion of a series of robot movements) that occur within completion of a series of robot movements) that occur within the context of system operation.the context of system operation.

RolesRoles (e.g., manager, engineer, salesperson) played by people (e.g., manager, engineer, salesperson) played by people who interact with the system.who interact with the system.

Organizational unitsOrganizational units (e.g., division, group, team) that are (e.g., division, group, team) that are relevant to an application.relevant to an application.

PlacesPlaces (e.g., manufacturing floor or loading dock) that (e.g., manufacturing floor or loading dock) that establish the context of the problem and the overall function establish the context of the problem and the overall function of the system.of the system.

StructuresStructures (e.g., sensors, four-wheeled vehicles, or computers) (e.g., sensors, four-wheeled vehicles, or computers) that define a class of objects or related classes of objects.that define a class of objects or related classes of objects.

Page 38: COSC 4406 Software Engineering

38

Selecting Classes—Selecting Classes—CriteriaCriteria

needed servicesneeded services

multiple attributesmultiple attributes

common attributescommon attributes

common operationscommon operations

essential requirementsessential requirements

retained informationretained information

Page 39: COSC 4406 Software Engineering

39

CRC ModelingCRC Modeling

Analysis classes have “responsibilities”Analysis classes have “responsibilities” ResponsibilitiesResponsibilities are the attributes and operations are the attributes and operations

encapsulated by the classencapsulated by the class Analysis classes collaborate with one anotherAnalysis classes collaborate with one another

CollaboratorsCollaborators are those classes that are required to are those classes that are required to provide a class with the information needed to complete provide a class with the information needed to complete a responsibility. a responsibility.

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

Page 40: COSC 4406 Software Engineering

40

CRC CRC ModelingModeling

Class:

Description:

Responsibility: Collaborator:

Class:

Description:

Responsibility: Collaborator:

Class:

Description:

Responsibility: Collaborator:

Class: FloorPlan

Description:

Responsibility: Collaborator:

incorporates walls, doors and windows

shows position of video cameras

defines floor plan name/type

manages floor plan positioning

scales floor plan for display

scales floor plan for display

Wall

Camera

Page 41: COSC 4406 Software Engineering

41

Class TypesClass Types Entity classesEntity classes, also called, also called model model or or businessbusiness classes, are classes, are

extracted directly from the statement of the problem (e.g., extracted directly from the statement of the problem (e.g., FloorPlan and Sensor). FloorPlan and Sensor).

Boundary classesBoundary classes are used to create the interface (e.g., are used to create the interface (e.g., interactive screen or printed reports) that the user sees and interactive screen or printed reports) that the user sees and interacts with as the software is used. interacts with as the software is used.

Controller classesController classes manage a “unit of work” [UML03] from manage a “unit of work” [UML03] from start to finish. That is, controller classes can be designed to start to finish. That is, controller classes can be designed to manage manage

the creation or update of entity objects; the creation or update of entity objects; the instantiation of boundary objects as they obtain information the instantiation of boundary objects as they obtain information

from entity objects; from entity objects; complex communication between sets of objects; complex communication between sets of objects; validation of data communicated between objects or between the validation of data communicated between objects or between the

user and the application. user and the application.

Page 42: COSC 4406 Software Engineering

42

ResponsibilitiesResponsibilities

System intelligence should be distributed across System intelligence should be distributed across classes to best address the needs of the problemclasses to best address the needs of the problem

Each responsibility should be stated as generally Each responsibility should be stated as generally as possibleas possible

Information and the behavior related to it should Information and the behavior related to it should reside within the same classreside within the same class

Information about one thing should be localized Information about one thing should be localized with a single class, not distributed across with a single class, not distributed across multiple classes.multiple classes.

Responsibilities should be shared among related Responsibilities should be shared among related classes, when appropriate. classes, when appropriate.

Page 43: COSC 4406 Software Engineering

43

CollaborationsCollaborations

Classes fulfill their responsibilities in one of two ways:Classes fulfill their responsibilities in one of two ways: A class can use its own operations to manipulate its own attributes, A class can use its own operations to manipulate its own attributes,

thereby fulfilling a particular responsibility, or thereby fulfilling a particular responsibility, or a class can collaborate with other classes.a class can collaborate with other classes.

Collaborations identify relationships between classesCollaborations identify relationships between classes Collaborations are identified by determining whether a class can Collaborations are identified by determining whether a class can

fulfill each responsibility itselffulfill each responsibility itself three different generic relationships between classes [WIR90]: three different generic relationships between classes [WIR90]:

the the is-part-ofis-part-of relationshiprelationship the the has-knowledge-ofhas-knowledge-of relationship relationship the the depends-upondepends-upon relationshiprelationship

Page 44: COSC 4406 Software Engineering

44

Composite Aggregate Composite Aggregate ClassClass

Player

PlayerHead PlayerArms PlayerLegsPlayerBody

Page 45: COSC 4406 Software Engineering

45

Associations and Associations and DependenciesDependencies

Two analysis classes are often related to one Two analysis classes are often related to one another in some fashionanother in some fashion In UML these relationships are called In UML these relationships are called associationsassociations Associations can be refined by indicatingAssociations can be refined by indicating multiplicitymultiplicity

(the term (the term cardinalitycardinality is used in data modelingis used in data modeling In many instances, a client-server relationship In many instances, a client-server relationship

exists between two analysis classes. exists between two analysis classes. In such cases, a client-class depends on the server-class In such cases, a client-class depends on the server-class

in some way and a in some way and a dependency relationshipdependency relationship is is establishedestablished

Page 46: COSC 4406 Software Engineering

46

MultiplicityMultiplicity

WallSegment Window Door

Wall

is used to buildis used to build

is used to build1..*

1 1 1

0..* 0..*

Page 47: COSC 4406 Software Engineering

47

DependenciesDependencies

CameraDisplayWindow

{password}

<<access>>

Page 48: COSC 4406 Software Engineering

48

Analysis PackagesAnalysis Packages

Various elements of the analysis model (e.g., use-Various elements of the analysis model (e.g., use-cases, analysis classes) are categorized in a cases, analysis classes) are categorized in a manner that packages them as a groupingmanner that packages them as a grouping

The plus sign preceding the analysis class name The plus sign preceding the analysis class name in each package indicates that the classes have in each package indicates that the classes have public visibility and are therefore accessible from public visibility and are therefore accessible from other packages.other packages.

Other symbols can precede an element within a Other symbols can precede an element within a package. A minus sign indicates that an element package. A minus sign indicates that an element is hidden from all other packages and a # symbol is hidden from all other packages and a # symbol indicates that an element is accessible only to indicates that an element is accessible only to packages contained within a given package.packages contained within a given package.

Page 49: COSC 4406 Software Engineering

49

Analysis PackagesAnalysis Packages

Environment

+Tree+Landscape+Road+Wall+Bridge+Building+VisualEffect+Scene

Characters

+Player+Protagonist+Antagonist+SupportingRole

RulesOfTheGame

+RulesOfMovement+ConstraintsOnAction

package name

Page 50: COSC 4406 Software Engineering

50

Representing AssociationsRepresenting Associations

AssociationAssociation A relationship between object classesA relationship between object classes Degree may be unary, binary, ternary or higherDegree may be unary, binary, ternary or higher Depicted as a solid line between participating classesDepicted as a solid line between participating classes

Association RoleAssociation Role The end of an association where it connects to a classThe end of an association where it connects to a class Each role has multiplicity, which indicates how many Each role has multiplicity, which indicates how many

objects participate in a given association relationshipobjects participate in a given association relationship

20.5020.50

Page 51: COSC 4406 Software Engineering

51

Page 52: COSC 4406 Software Engineering

52

Page 53: COSC 4406 Software Engineering

53

Behavioral ModelingBehavioral Modeling

The behavioral model indicates how software will respond The behavioral model indicates how software will respond to external events or stimuli. To create the model, the to external events or stimuli. To create the model, the analyst must perform the following steps:analyst must perform the following steps:

Evaluate all use-cases to fully understand the sequence of Evaluate all use-cases to fully understand the sequence of interaction within the system.interaction within the system.

Identify events that drive the interaction sequence and Identify events that drive the interaction sequence and understand how these events relate to specific objects.understand how these events relate to specific objects.

Create a sequence for each use-case.Create a sequence for each use-case. Build a state diagram for the system.Build a state diagram for the system. Review the behavioral model to verify accuracy and consistency.Review the behavioral model to verify accuracy and consistency.

Page 54: COSC 4406 Software Engineering

54

Writing the Software Writing the Software SpecificationSpecification

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

Page 55: COSC 4406 Software Engineering

Process SpecificationProcess Specification

A written document to describe all the flow A written document to describe all the flow model processes that appear at the final model processes that appear at the final refinement.refinement.

It includes:It includes: Narrative textNarrative text A program design language descriptionA program design language description Mathematical equationsMathematical equations TablesTables ChartsCharts DiagramsDiagrams

55

Page 56: COSC 4406 Software Engineering

56

Specification Specification GuidelinesGuidelinesuse a layered format that provides increasing detail

as the "layers" deepen use consistent graphical notation and apply textual terms consistently (stay away from aliases) be sure to define all acronyms be sure to include a table of contents; ideally, include an index and/or a glossary write in a simple, unambiguous style (see "editing suggestions" on the following pages) always put yourself in the reader's position, "Would I be able to understand this if I wasn't intimately familiar with the system?"

Page 57: COSC 4406 Software Engineering

57

Specification Specification GuidelinesGuidelines•Be on the lookout for persuasive connectors, ask why?

keys: •certainly, therefore, clearly, obviously, it follows that ...•

•Watch out for vague terms keys: •some, sometimes, often, usually,ordinarily, most, mostly ...•

•When lists are given, but not completed, be sure all items are understood keys: •etc., and so forth, and so on, such as

•Be sure stated ranges don't contain unstated assumptions e.g., •Valid codes range from 10 to 100.• Integer? Real? Hex?

•Beware of vague verbs such as •handled, rejected, processed, ...•

•Beware "passive voice" statements e.g., •The parameters are initialized.• By what?

•Beware "dangling" pronouns e.g., •The I/O module communicated with the data validation module and its control flag is set.• Whose control flag?

Page 58: COSC 4406 Software Engineering

58

Specification Specification GuidelinesGuidelines

•When a term is explicitly defined in one place, try substituting the definition for other occurrences of the term

•When a structure is described in words, draw a picture

•When a structure is described with a picture, try to redraw the picture to emphasize different elements of the structure

•When symbolic equations are used, try expressing their meaning in words •When a calculation is specified, work at least two examples

•Look for statements that imply certainty, then ask for proof keys; always, every, all, none, never

•Search behind certainty statements—be sure restrictions or limitations are realistic

Page 59: COSC 4406 Software Engineering

59

SummarySummary

Data ModelingData Modeling Data object and data attributesData object and data attributes RelationshipsRelationships

DFDDFD Object-Oriented / Class-based modeling (UML)Object-Oriented / Class-based modeling (UML) SpecificationSpecification