cse3308 - software engineering: analysis and design, 2005lecture 4a.1 software engineering: analysis...

32
CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1 CSE3308/DMS/2005/10 Monash University - School of Computer Science and Software Engineering

Post on 20-Dec-2015

239 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.1

Software Engineering: Analysis and Design - CSE3308

Structured Analysis - Part 1

CSE3308/DMS/2005/10

Monash University - School of Computer Science and Software Engineering

Page 2: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.2

Lecture Outline

History of Structured Analysis Context Diagrams Event Lists Data Flow Diagrams Control Flows and Processes Levelled Data Flow Diagrams

Page 3: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.3

History of Structured Analysis (SA)

First texts appeared in 1977 Tom de Marco - Structured Analysis and System Specification Gane and Sarson - Structured Systems Analysis

1984 - SA is extended McMenamin and Palmer - Essential Structured Analysis

1989 - SA reaches its peak Yourdon publishes Modern Structured Analysis Integrates Chen’s Entity-Relationship Models

1991 Yourdon moves to Object-Oriented Analysis 1995 38% of organisations used SA

Since much — if not most — expenditure of software organizations is on maintenance, there is still a lot of work being done on systems produced using SA, and coded in languages such as Fortran, COBOL and C

Page 4: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.4

Context Diagrams

Indicate the people, organisations and systems which communicate with our system

Show the data which our system receives from the outside world

Show the data produced by the system and sent to the outside world

Show the data which is shared by the system with the outside world

Show the boundary between the system and the rest of the world

Page 5: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.5

( or )

Constructing a Context Diagram Four components

The System

Terminators

» also know as external entities

Data Flows

Data Stores Students

S tu d en tE n r o lm en t

S y s tem

S tu d en t

s tu d en t- id

S tu d en ts

Page 6: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.6

CD for Student Enrolment System

Stude nt

Staff M e m be r

pe r s o nal -de tai l s ,c o ur s e -c o de

s tude nt- i ds ubje c t -c o de

pas s w o r d,s ubje c t -c o de

s tude nt- l i s t

s tude nt- i d ,m ar k

pas s w o r d,s ubje c t -c o des ubje c t -nam e ,ye ar ,

c o r e - fl ag ,pr e r e qui s i te s

s tude nt- i d

s taff- i d

Adm i ni s tr ato r

Subje c ts InC o ur s e s

Subje c tD ataF o r Stude nt

Stude nts

Stude nts InC o ur s e s

P r e r e qui s i te s

Subje c ts

F i nanc e Sys te m

s tude nt- i d

fe e s -pai d

S tu d en t E n ro lm en tS ystem

Page 7: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.7

Guidelines for Context Diagrams

Use appropriate names

Don’t be too specific with names

StudentFred

Flintstone

Yes No

Student

StudentEnrolment

System

Ready to send input

Okay, send input

Here’s the input

Great, I got the input

Page 8: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.8

Guidelines (2)

Can have Dialogue Flows representing two-way data flow

StudentEnrolment

System

FinanceSystem

Check fees paid

fees checkresponse

Duplicate terminators if necessary to simplify the diagram

Page 9: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.9

Event Lists

List of the external events that occur in the outside world which affect the system, i.e. events generated by terminators

Events can be Flow - some data flows between the external world and

the system Temporal - an event occurs as a result of some timing Control - special case of a temporal event, an external

stimulus that occurs at some unpredictable point in time

Events are always viewed from the terminator’s point of view

Page 10: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.10

Event examples

Student enrolls in subject (Flow) Administrator creates subject (Flow) Administrator receives student transcript

(Flow) Subject creation is disabled because

semester starts in one month (Temporal)

There is no control event in this list since they are unusual in business systems. They are, however, common in real-time systems (see slide 4A.23)

Page 11: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.11

Constructing the Event List

Examine each terminator, and ask what effects the terminator’s actions can have on the system

Take care to distinguish between separate events coincidently “packaged” together in the requirements specification

Event “Customer places order” might in fact be both “Customer places order” and “Salesperson places customer order”

» Clue could be different data present in the two cases

Need to allow for failure conditions on the part of the terminator, but no need to allow for system failures

Page 12: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.12

Events

Look at a system which controls the sales of goods at a supermarket

Entities to think about Cash register Checkout Operator Customer Scanner Receipt printer

What events can you identify?

Page 13: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.13

Your answer?

Page 14: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.14

Data Flow Diagrams

Extends the Context Diagram by defining the processes which make up a system

4 components Processes

» A process is a part of the system that transforms inputs to outputs. It has:

Number - identifies process and indicates place in DFD level hierarchy

Name - what the process does

Data Flows Data Stores Terminators

as in Context Diagram}

Page 15: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.15

Indicate movement of packets of information from one part of the system to another part

Flows are named

Input flow

Output flow

Diverging flows - see next slide

Data Flows

ValidatePhone

No.

Phone No.

GenerateFlight

Schedule

Flight Schedule Information

Page 16: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.16

Diverging Data Flows

Validatepostcode

Validatephone

no.

Validatestreet

address

personal-details

postcode

phone no.

streetaddress

Produce ValidOrder

GenerateInvoice

UpdateInventory

Generate Shipping

Docs

Order

Invalidorders

Order details

Page 17: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.17

Typical Figure 0 DFDNote:some analysts do notshow terminators on theFigure 0 DFD

Stude nt

Staff M e m be r

6 . As s i g ns taff

m e m be r tos ubje c t

2 . E nr o ls tude nt i n

s ubje c t

1 . E nr o ls tude nt atU ni ve r s i ty

4 . C r e atene w

s ubje c t

3 . R e c o r dm ar k fo rs tude nt

5 . P r i nts tude nt

tr ans c r i pt

pe r s o nal -de tai l s ,c o ur s e -c o de

s tude nt- i d

s tude nt- i d , s ubje c t -c o des tude nt- i d ,s ubje c t -c o de

pas s w o r d,s ubje c t -c o de

s tude nt- l i s t

s tude nt- i d , m ar k

pas s w o r d, s ubje c t -c o de

s ubje c t -nam e , c o ur s e -c o de , ye ar ,c o r e - fl ag , pr e r e qui s i te s

pas s w o r d, s tude nt- i dpas s w o r d, s ubje c t -c o de

s taff- i dAdm i ni s tr ato r

Stude nts

Subje c ts InC o ur s e s

Subje c tD ataF o r Stude nt

Stude nts

Stude nts InC o ur s e s

P r e r e qui s i te s

Subje c ts

F i nanc e Sys te m

s tude nt- i dfe e s -pai d

Stude nts InC o ur s e s

s tude nt- tr ans c r i pt

Subje c ts InC o ur s e s

Note: some flows may be physical, such as the student-transcript

Page 18: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.18

An example

For the checkout operator example What are the terminators? What are the main processes? What are the main data flows?

Draw a data flow diagram to put the above elements together

Page 19: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.19

Your elements

Page 20: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.20

Your DFD

Page 21: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.21

Guidelines for constructing DFDs

Choose meaningful names Number the processes Redraw the DFD as many times as necessary

for aesthetics Avoid overly complex DFDs

Fit on one A4 page approximately 6-7 processes and related data stores and

terminators

Page 22: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.22

Guidelines (2)

Make sure the DFD is internally consistent and consistent with any associated DFDs

Avoid infinite sinks - processes with inputs but no outputs

Avoid spontaneous generation processes - processes with outputs but no inputs (possible exception is a random number generator)

Beware of unlabelled flows and processes Beware read-only/write-only stores Make sure that incoming and outgoing flows from the

DFD match those on the DFD at the level above

Page 23: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.23

Control Flows and Processes Real-time systems need a means to model

control (signals/interrupts) Shown with dashed lines and circles A control flow can be regarded as a binary

signal - does not carry value-bearing data Used to trigger/wake-up a dormant process Internal behaviour of a control process

described by a state-transition diagram Generally one control process in a DFD inputs and outputs of control process consist

only of control flows

Page 24: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.24

Example

ControlSurveillance

System

ProcessRadarData

ProcessSatellite

Data

Surveillance data

radar data

satellite data

enable satelliteprocessing

enable radarprocessing

satellite signal

radar signal

Page 25: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.25

Action Game Example

Administer Game

Play GameGame Details

ControlGame

startadministrating

start playing

enteradministrationmode

enter playmode

Page 26: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.26

Levelled DFDs

Most systems are far too complex to depict on one DFD

Page 27: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.27

Levelled DFDs (2) Break each process

down into sub-processes Numbering of processes

indicates their parents process, and thus their position in the hierarchy of levelled DFDs

T heS ys te m

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

Context Diagram

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

Figure 0 DFD

1 . W iggleW idge t

3 . D angleD o o ve r

2 . G r indG adge t

D atas to re 1

Figure 3 DFD

3 .1 C re ateD o o ve r

3 .3W angleD o o ve r

3 .2 M angleD o o ve r

Page 28: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.28

Guidelines for Levelled DFDs

How many levels? Each level should have approximately 6 processes Simple systems: 2-3 levels Medium size: 3-6 levels Large size: 5-8 levels

All parts of the system may not need the same numbers of levels

Levels must be consistent with each other Data flows coming into and going out of a process at one

level must correspond to the data flows coming into and out of the entire figure at the next lower level - this is known as balancing

Page 29: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.29

Balanced DFDs

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

B

D

Figure 0 DFD

1 . W iggleW idge t

3 . D angleD o o ve r

2 . G r indG adge t

E

F

H

A

G

C

C

D atas to re 1

D

Figure 3 DFD

F

H

G

C

3 .1 C re ateD o o ve r

3 .3W angleD o o ve r

3 .2 M angleD o o ve r

JK

I

Balanced DFDs

T heS ys te m

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

A, GB

CD

Context Diagram

Page 30: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.30

Unbalanced DFDs

Can you see the problems?

T heS ys te m

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

A, GB

CD

Context Diagram

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to re 1

B

Q

Figure 0 DFD

1 . W iggleW idge t

3 . D angleD o o ve r

2 . G r indG adge t

E

F

H

A

G

C

Z

D atas to re 1

Figure 3 DFD

F

H

G

C

3 .1 C re ateD o o ve r

3 .3W angleD o o ve r

3 .2 M angleD o o ve r

JK

I

XC

W

Page 31: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.31

Data Stores and Levelled DFDs

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to r e 1

B

D

Figure 0 DFD

1 . W iggleW idge t

3 . D angleD o o ve r

2 . G r indG adge t

E

F

H

A

G

C

C

D atas to r e 1

D

Figure 3 DFD

F

H

G

C

3 .1 C re ateD o o ve r

3 .3 W angleD o o ve r

3 .2 M angleD o o ve r

JK

I

Show datastores at every level at which they are used

T he S ys te m

Te rm inato r 1

Te rm inato r 3

Te rm inato r 2

D atas to r e 1

A, GB

CD

Context Diagram

Page 32: CSE3308 - Software Engineering: Analysis and Design, 2005Lecture 4A.1 Software Engineering: Analysis and Design - CSE3308 Structured Analysis - Part 1

CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 4A.32

References

Yourdon, E., Modern Structured Analysis, Prentice Hall, 1989.

There is now a condensed edition, called Just Enough Structured Analysis, available online via the Resources page on the unit web site.