Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Software Design
Introduction
Structured Analysis and Design
Data Flow Diagrams
Data Dictionary
Decomposition
Structure Chart
Introduction
search-
book
Data Flow Symbol
A directed arc or line.
◦ Represents data flow in the
direction of the arrow.
◦ Data flow symbols are
annotated with names of
data they carry.
book-name
Data Store Symbol
Represents a logical file:
◦ A logical file can be:
a data structure
a physical file on disk.
◦ Each data store is connected
to a process:
By means of a data flow
symbol.
book -
details
Direction of data flow arrow:
◦ Shows whether data is being read
from or written into it.
An arrow into or out of a data
store:
◦ Implicitly represents the entire
data of the data store
◦ Arrows connecting to a data store
need not be annotated with any
data name.
find - book
Books
Output Symbol
Specifiedwhen hard copies are
produced
Example – Report of all the library
books that are issued
book_list
Synchronous Operation
If two bubbles are directly
connected by a data flow
arrow:
◦ They are synchronous
number Validate -
Read - numbers
numbers 0.2 Valid
Data - items 0.1 number
Asynchronous Operation
Iftwo bubbles are
connected via a data
store:
◦ They are not synchronous.
Validate -
Read - numbers
numbers 0.2
0.1 Valid
numbers number
Data -
items
How is structured analysis
performed
Initially represent the
software at the most abstract
level:
◦ Called the context diagram.
◦ The entire system is represented
as a single bubble,
◦ This bubble is labelled according to
the main function of the system.
Context Diagram
A context diagram shows:
◦ Data input to the system,
◦ Output data generated by the system,
◦ External entities.
◦
Context diagram captures:
◦ Various entities external to the system
and interacting with it.
◦ Data flow occurring between the
system and the external entities.
◦
Level 1 Data Flow Diagram
Examine the SRS
document:
◦ Represent each high-level
function as a bubble.
◦ Represent data input to
every high-level function.
◦ Represent data output from
every high-level function.
High Level Data Flow
Diagram
Each high-level function is
separately decomposed into
sub functions:
◦ Identify the sub functions of the
function
◦ Identify the data input to each sub
function
◦ Identify the data output from each
sub function
◦
These are represented as DFDs.
Decomposition
Decomposition of a bubble:
◦ Also called factoring or exploding.
◦
Each bubble is decomposed to
between 3 to 7 bubbles.
Decomposition of a bubble should
be carried on until:
◦ A level at which the function of the
bubble can be described using a
Example : RMS Calculating Software
Consider a software called RMS
calculating software:
Data - Compute -
items RMS
0
User
resul
t
Contd..
From a cursory analysis of the
problem description, we can see
that the system needs to perform
several things.
Data - Valid
items -numbers
error
Display Compute -
0.4 rms
0.3
result
RMS
Example : Level 2 -RMS
Squared -
Calculate - sum
squared - Calculate -
sum mean
0.3.1 0.3.2
Valid
-numbers
Mean -
square
Calculate -
root
0.3.3
RMS
Example : Level 3 - RMS
c
b
a c
Square Square
Square
0.3.1.1 0.3.1.2
0.3.1.3
bsq
asq csq
Sum
0.3.1.4
Squared - sum
Data Dictionary
A DFD is always accompanied by a data
dictionary.
A data dictionary lists all data items
appearing in a DFD:
◦ Definition of all composite data items in
terms of their component data items.
◦ All data names along with the purpose of
the data items.
◦
For example, a data dictionary entry
may be:
Data Definition
Composite data are defined in terms of
primitive data items using following
operators:
+: denotes composition of data items, e.g
◦ a+b represents data a and b.
◦
[,,,]: represents selection,
◦ i.e. any one of the data items listed inside the
square bracket can occur.
◦ For example, [a,b] represents either a occurs or b
occurs.
Contd..
{}: represents iterative data definition,
◦ e.g. {name}5 represents five name data.
◦ {name}* represents zero or more instances of
name data.
◦
= represents equivalence,
◦ e.g. a=b+cmeans that a represents b and c.
◦
* *: Anything appearing within * * is
considered as comment.
Data Dictionary for RMS
numbers= valid-numbers =a+b+c
a:integer * input number *
b:integer * input number *
c:integer * input number *
asq:integer
bsq:integer
csq:integer
squared-sum: integer
mean-square: float
Result=[RMS,error]
Balancing a DFD
Data flowing into or out of a bubble must
match the data flows at the next level of
DFD
c
b 2 c
3.1
c1
1 3 d1
a d 3.2 3.3
e
Level d e1
1 e
Level
Numbering of bubbles
Number the bubbles in a DFD:
◦ Numbers help in uniquely identifying any
bubble from its bubble number.
◦
The bubble at context level:
◦ Assigned number 0.
◦
Bubbles at level 1:
◦ Numbered 0.1, 0.2, 0.3, etc
◦
When a bubble numbered x is
decomposed,
◦ Its children bubble are numbered x.1,
Case Study : Sales Offer
Software
XYZ Bazaar wants to start a scheme where the regular
customer will be given surprise gifts and gold coins
at the end of each year. Every customer must
register giving the name , address and the phone
number. He will be issued a card with an unique
customer number. Every time he makes a purchase
he will have to show the card to the sales personnel.
The sale personnel will take the customer number
and register the sale amount against the customer
number. At the end of the year, the total sales for
each customer will be calculated to find the prize
winners. The top 10 customer with the highest total
purchase will be awarded with surprise gifts. All
customer who have shopped for more than Rs.
50000 that year will be awarded a gold coin each.
The sales information will be reset after the prizes
are announced. The generation of the prize winners
and the reset will be done by the Store Manager.
Case Study : Sales Offer
Software
XYZ Bazaar wants to start a scheme where the regular
customer will be given surprise gifts and gold coins
at the end of each year. Every customer must
register giving the name , address and the
phone number. He will be issued a card with an
unique customer number. Every time he makes a
purchase he will have to show the card to the sales
personnel. The sale personnel will take the
customer number and register the sale
amount against the customer number.
At the end of the year, the total sales for each
customer will be calculated to generate the prize
winners. The top 10 customer with the highest total
purchase will be awarded with surprise gifts. All
customer who have shopped for more than Rs. 50000
that year will be awarded a gold coin each. The sales
information will be reset after the prizes are
announced. The generation of the prize winners and
the reset will be done by the Store Manager.
Sales Offer Software
The high level requirement from
the specs can be the following
1.Register the customer
2.Register the sale for each
customer
3.Generate the prize winners
a.Calculate the total sales
b.Generate the surprise gift winners
c.Generate gold coin gift winners
d.Reset the sales information
Context diagram
Customer_details
S a le s C le rk
C u sto m e r
S a le s O ffe r
S o ftw a re
Sale_detail
0
Customer_No
Winner_List
Generate_winner_req
M anager
Level 1 DFD
Sale_detail
Customer_details
Customer_No
Register_ Register_
Customer Sales
0.1 0.2
Customer_data Sales_info
Generate_
Winner_List
0.3
Winner_List
Generate_winner_req
Level 2 DFD Surprise_gift_winner_list
Generate_winner_req
Sales_info
Find_total_ Gen_surprise
Sale _gift_winners
0.3.1 0.3.2
Sales_info Customer_details
Total_sales
Customer_details
Reset _ Gen_gold_
Sales_info Coin_gift_
0.3.4 winners
0.3.3
Gold _coin_winner_list
Data Dictionary
Get the list of all the data that is
used in all the levels of DFD
Customer_details
Customer_No
Sale_detail
Winner_List
Generate_winner_req
Customer_data
Sales_info
Surprise_gift_winner_list
Gold _coin_winner_list
Total_sales
Represent the data as per the
notations
Customer_details : name+address+phone number
Customer_No(CN): Integer
Sale_detail: {item+amount}* + CN
Winner_List: Surprise_gift_winner_list + Gold
_coin_winner_list
Generate_winner_req: Command
Customer_data: {Customer_details + CN}*
Sales_info: {Sale_detail}*
Surprise_gift_winner_list: {Customer_details + CN}10
Gold _coin_winner_list: {Customer_details + CN}*
Total_sales: {Integer + CN}*
The above represents the data dictionary of our Sales Offer
System
Common errors while constructing
DFD’s
More than one bubble in the context
diagram
External entities appear at higher
levels
Decomposition of less than 3 or
greater than 7 bubbles
Leaving the DFD’s unbalanced
Not constructing the data dictionary
for the DFD’s
Attempt to represent control
information in a DFD
Shortcomings of DFD
Model
DFD’s leave ample scope to be
precise
Control aspects are not defined
by the DFD
Level to which decomposition is
to be carried out is subjective
Many DFD diagram for a single
requirement specification
possible
Difficult to differentiate between
Structured Design
The aim of structured design
◦ Transform the results of structured
analysis (i.e., a DFD representation)
into a structure chart.
A structure chart represents the
software architecture:
◦ Various modules making up the
system,
◦ Module dependency (i.e. which
module calls which other modules),
◦ Parameters passed among different
modules.
Structure Chart
Structure chart representation
◦ Easily implementable using
programming languages.
Main focus of a structure chart:
◦ Define the module structure of a
software,
◦ Interaction among different
modules,
◦ Procedural aspects (e.g, how a
particular functionality is
achieved) are not represented.
Structure Chart – Building
Blocks
Rectangular box:
◦ A rectangular box
represents a module.
◦ Annotated with the name
of the module it
represents.
Process-order
Arrows
An arrow between two modules
implies:
◦ During execution control is passed
from one module to the other in
the direction of the arrow
◦
root
◦
order
Process-order
Library Modules
Library modules represent
frequently called modules:
◦ A rectangle with double side
edges.
◦ Simplifies drawing when a module
is called by several modules.
Quick-sort
Selection
The diamond symbol represents:
◦ One module of several modules
connected to the diamond
symbol is invoked depending on
some condition.
root
root
Valid
Data - -numbers
items error
Display Compute -
0.4 rms
0.3
result
RMS
Efferent branch Central transform
Structure chart for RMS
root
Valid - numbers
rms
Valid - numbers rms
Validate -
Get - data data
Example 2 – XYZ Bazaar
Sale_detail
Customer_details
Customer_No
Register_ Register_
Customer Sales
0.1 0.2
Customer_data Sales_info
Generate_
Winner_List
0.3
Winner_List
Generate_winner_req
XYZ Bazaar structure chart
root
CN
Cust_details CN Sale_det
Tot_sale Sale_det
Tot_sale
Gold_win_list
get_cust_detail Generate_CN
get_sales_det Record_sales
Tot_sale sur_win_list
Sale_info