3.1overview of Sa/Sd Methodology
3.1overview of Sa/Sd Methodology
3.1overview of Sa/Sd Methodology
The roles of structured analysis (SA) and structured design (SD) have been
shown schematically in Figure 6.1. Observe the following from the figure:
During structured analysis, the SRS document is transformed into a data flow
diagram (DFD) model
During structured analysis, the SRS document is transformed into a data flow di-
agram (DFD) model
During structured design, the DFD model is transformed into a structure chart.
Figure 6.1: Structured analysis and structured design methodology.
As shown in Figure 6.1, the structured analysis activity transforms the SRS doc-
ument into a graphic model called the DFD model.
During structured analysis, functional decomposition of the system is
achieved.
Each function that the system needs to perform is analyzed and hierarchically
decomposed into more detailed functions.
During structured design, all functions identified during structured analysis are
mapped to a module structure. This module structure is also called the high-
level design or the software architecture for the given problem. This is repre-
sented using a structure chart.
The high-level design stage is normally followed by a detailed design stage. Dur-
ing the detailed design stage, the algorithms and data structures for the indi-
vidual modules are designed.
The detailed design can directly be implemented as a working system using a
conventional programming language.
Data dictionary
A data dictionary lists all data items that appear in a DFD model.
• Data dictionary is metadata that describe composite data structures defined in the
DFD.
A data dictionary lists the purpose of all data items and the definition of all composite
data items in terms of their component data items
For example, a data dictionary entry may represent that the data grossPay con-
sists of the components regularPay and overtimePay.
grossP ay = regularP ay + overtimeP ay
The dictionary plays a very important role in any software development pro-
cess, especially for the following reasons:
A data dictionary provides a standard terminology for all relevant data for
use by the developers working in a project.
The data dictionary helps the developers to determine the definition of dif-
ferent data structures in terms of their component elements while imple-
menting the design.
The data dictionary helps to perform impact analysis. That is, it is possible
to determine the effect of some data on various processing activities and
vice versa..
For large systems, the data dictionary can become extremely complex and vo-
luminous. Computer-aided software engineering (CASE) tools come handy to
overcome this problem.
Most CASE tools usually capture the data items appearing in a DFD as the DFD
is drawn, and automatically generate the data dictionary.
Data definition
Composite data items can be defined in terms of primitive data items using the
following data definition operators.
1) +: denotes composition of two data items, e.g. a+b represents data a and b.
2) [,,]: 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 o r b oc-
curs.
3) (): the contents inside the bracket represent optional data which may or may not
appear.a+(b) represents either a or a+b occurs.
4) {}: represents iterative data definition, e.g. {name}5 represents five name da-
ta.{name}* represents zero or more instances of name data.
5) =: represents equivalence, e.g. a=b+c means that a is a composite data item
with b and c.
6) /* */: Anything appearing within /* and */ is considered as comment.
Figure 6.4: DFD model of a system consists of a hierarchy of DFDs and a single data dic-
tionary.
3.3.1 Context Diagram
The context diagram is the most abstract (highest level) data flow representa-
tion of a system.
It represents the entire system as a single bubble ,we can name it with the
name of the software system being developed (usually a noun
As an example of a context diagram, consider the context diagram a software
developed to automate the book keeping activities of a supermarket (see
Figure 6.10). The context diagram has been labelled as ‘Supermarket software’.
The context diagram establishes the context in which the system operates; that
is, who are the users, what data do they input to the system, and what data
they received by the system.
The various external entities with which the system interacts and the data flow
occurring between the system and the external entities are represented. The data
input to the system and the data output from the system are represented as in-
coming and outgoing arrows. These data flow arrows should be annotated with
the corresponding data names.
To develop the context diagram of the system, we have to analyse the SRS doc-
ument to identify the different types of users of the system and the data
they would be receiving from the system.
3.3.2 Level 1 DFD
The level 1 DFD usually contains three to seven bubbles(only important func-
tions).
To develop the level 1 DFD, examine the high-level functional requirements in
the SRS document.
If a system has more than seven high-level requirements identified in the SRS
document then some of the related requirements have to be combined and rep-
resented as a single bubble i n the level 1 DFD. (We illustrate construction of
level 1 DFD in example 6.1 to 6.4)
Decomposition
Each bubble in the DFD represents a function performed by the system. The
bubbles are decomposed into sub functions at the successive levels of the DFD
model.
Decomposition of a bubble is also known as factoring or exploding a bubble.
Each bubble at any level of DFD is usually decomposed to anything three to
seven bubbles.
Decomposition of a bubble should be carried on until a level is reached at
which the function of the bubble can be described using a simple algorithm.
1. Construction of context dia g ra m: Examine the SRS document to de-
termine:
• Different high-level functions that the system needs to perform.
• Data input to every high-level function.
• Data output from every high-level function.
• Interactions (data flow) among the identified high-level functions. Repre-
sent these aspects of the high-level functions in a diagrammatic form,it
iscalled as top-level data flow diagram (DFD) or DFD 0.
Construction of level 1 diagram: Examine the high-level functions described
in the SRS document. If there are three to seven high-level requirements in the
SRS document, then represent each of the high-level function in the form of a bub-
ble. If there are more than seven bubbles, then some of them have to be com-
bined. If there are less than three bubbles, then some of these have to be split.
Construction of lower-level diagrams: Decompose each high-level function into its
constituent subfunctions through the following set of activities:
• Identify the different subfunctions of the high-level function.
• Identify the data input to each of these subfunctions.
• Identify the data output from each of these subfunctions.
• Identify the interactions (data flow) among these subfunctions. Rep-
resent these aspects in a diagrammatic form using a DFD.
Recursively repeat Step 3 for each subfunction until a subfunction can be
represented by using a simple algorithm.
Numbering of bubbles
It is necessary to number the different bubbles occurring in the DFD to unique-
ly identifying any bubble in the DFD from its bubble number.
The bubble at the context level is usually assigned the number 0 to indicate
that it is the 0 level DFD. Bubbles at level 1 are numbered, 0.1, 0.2, 0.3,
etc. When a bubble numbered x is decomposed, its children bubble are
numbered x.1, x.2, x.3, etc.
In this numbering scheme, by looking at the number of a bubble we
can unambiguously determine its level, its ancestors, and its successors.
Balancing DFDs
The DFD model of a system usually consists of many DFDs that are organized in a
hierarchy.
The data that flow into or out of a bubble must match the data flow at the next
level of DFD. This is known as balancing a DFD.
We illustrate the concept of balancing a DFD in Figure 6.5. In the level 1
DFD, data items d1 and d3 flow out of the bubble 0.1 and the data item d2
flows into the bubble 0.1 (shown by the dotted circle). In the next level, bubble
0.1 is decomposed into three DFDs (0.1.1,0.1.2,0.1.3). The decomposition is bal-
anced, as d1 and d3 flow out of the level 2 diagram and d 2 flows in. Please note
that dangling arrows (d1,d2,d3) represent the data flows into or out of a diagram.
How far to decompose?
A bubble should not be decomposed any further once a bubble is found to
represent a simple set of instructions.
Large industry standard problems may need decomposition up to level 3 or
level 4. Rarely, if ever, decomposition beyond level 4 is needed.
Many beginners commit the mistake of drawing more than one bubble in
the context diagram. Context diagram should depict the system as a single
bubble.
Many beginners create DFD models in which external entities appearing
at all levels of DFDs. All external entities interacting with the system should
be represented only in the context diagram.
It is a common oversight to have either too few or too many bubbles in a
DFD. Only three to seven bubbles per diagram should be allowed.
Many beginners leave the DFDs at the different levels of a DFD model un-
balanced.
A common mistake committed by many beginners while developing a
DFD model is attempting to represent control information in a DFD.
It is important to realise that a DFD represents only data flow, and it does
not represent any control information.
The following are some illustrative mistakes of trying to represent control as-
pects such as:
Illustration 1. A book can be searched in the library catalog by inputting its name.
If the book is available in the library, then the details of the book are displayed.
If the book is not listed in the catalog, then an error message is generated. While
developing the DFD model for this simple problem, many beginners commit the
mistake of drawing an arrow (as shown in Figure 6.6) to indicate that the error
function is invoked after the search book. But, this is a control information and
should not be shown on the DFD.
A data flow arrow should not connect two data stores or even a data store
with an external entity.
All the functionalities of the system must be captured by the DFD
model.
Only those functions of the system specified in the SRS document
should be represented. (the system should be overlooked).
Incomplete data dictionary and data dictionary showing incorrect
composition of data items are other frequently committed mistakes.
The data and function names must be relevent.
Novices usually clutter their DFDs with too many data flow arrow. Figure
6.7 shows an example concerning how a DFD can be simplified by combin-
ing several data flows into a single high- level data flow.
Figure 6.8: Context diagram, level 1, and level 2 DFDs for Example 6.1.
Data dictionary for the DFD model of Example 6.1
data-items: {integer}3
rms: float
valid-data:data-items
a: integer
b: integer
c: integer
asq: integer
bsq: integer
csq: integer
msq: integer
Example 6.2 (Tic-Tac-Toe Computer Game ) Tic-tac-toe is a computer game in
which a human player and the computer make alternate moves on a 3 × 3
square. A move consists of marking a previously unmarked square. The
player who is first to place three consecutive marks along a straight line (i.e.,
along a row, column, or diagonal) on the square wins. A s soon as either of the
human player or the computer wins, a message congratulating the winner should
be displayed. If neither player manages to get three consecutive marks along
a straight line, and all the squares on the board a re filled up, then the game is
drawn. The computer always tries to win a game.
The context diagram and the level 1 DFD are shown in Figure 6.9.
Data dictionary for the DFD model of Example 6.2
move: integer /* number between 1 to 9 */
display: game+result
game: board
board: {integer}9
result: [“computer won”, “human won”, “drawn”]
Example 6.3 (Supermarket Prize Scheme) A super market needs to develop a soft-
ware that would help it to automate a scheme that it plans to introduce to en-
courage regular customers. In this scheme, a customer would have first register by
supplying his/her residence address, telephone number, and the driving license
number. Each customer who registers for this scheme is assigned a unique
customer number (CN) by the computer. A customer can present his CN to the
check out staf f when he makes any purchase. In this case, the value of his pur-
chase is credited against his CN. At the end of each year, the supermarket in-
tends to award surprise gifts to 10 customers who make the highest total pur-
chase over the year. Also, it intends to award a 22 caret gold coin to every cus-
tomer whose purchase exceeded Rs. 10,000. The entries against the CN are reset
on the last day of every year after the prize winners’ lists are generated.
Figure 6.9: Context diagram and level 1 DFDs for
Example 6.2.
The context diagram for the supermarket prize scheme problem of Example
6.3 is shown in Figure 6.10. The level 1 DFD in Figure 6.11. The level 2 DFD
in Figure 6.12.
Figure 6.10: Context diagram for Example 6.3.
1. The fact that the customer is issued a manually prepared customer identity
card or that the customer hands over the identity card each time he
makes a purchase has not been shown in the DFD. This is because these
are item transfers occurring outside the computer.
2. The data generate-winner-list in a way represents control information
(that is, command to the software) a n d no real data. We have in-
cluded it in the DFD because it simplifies the structured design pro-
cess as we shall realize after we practise solving a few problems. We
could have also as well done without the generate-winner-list data, but this
could have a bit complicated the design.
3. Observe in Figure 6.11 that w e have two separate stores for the cus-
tomer data and sales data. Should we have combined them into a single
data store? The answer i s—No, we should not. If we had combined
them into a single data store, the structured design that would be carried
out based on this model would become complicated. Customer data and
sales data have very different characteristics. For example, customer data
once created, does not change. On the other hand, the sales data
changes frequently and also the sales data is reset at the end of a year,
whereas the customer data is not.
The trading house has a set of regular customers. The customers place or-
ders with it for various ki nds of commodities. The trading house main-
tains the names and addresses of its regular customers. Each of these
regular customers should be assigned a unique customer identifica-
tion numb e r (CIN) by the computer. The customers quote their CIN on
every order they place.
Once order is placed, as per current practice, the accounts department of
the trading house first checks the credit-worthiness of the customer. The
credit-worthiness of the customer is determined by analysing the history of
his payments to different bills sent to him in the past. After automation,
this task has be done by the computer.
If a customer is not credit-worthy, his orders are not processed any further
and an appropriate order rejection message is generated for the cus-
tomer.
If a customer is credit-worthy, the items that he has ordered are
checked against the list of items that the trading house deals with. The
items in the order which the trading house does not deal with, are not pro-
cessed any further and an appropriate apology message for the
customer for these items is generated.
The items in the customer’s order that the trading house deals with are
checked for availability in the inventory. I f the items are available in the
inventory in desired quantity, then:
If any of the ordered items are not available in the inventory in suf-
ficient quantity to satisfy t he order, then these out-of-stock items along
with the quantity ordered by the customer and the CIN are stored in a
“pending-order” file for further processing to be carried out when the pur-
chase department issues the “generate indent” command. The purchase
department should be allowed to periodically issue
commands to generate indents. When a command to generate indents is
issued, the system should examine the “pending-order” file to deter-
mine the orders that are pending and determine the total quantity
required for each of the items. It should find out the addresses of the ven-
dors who supply these items by examining a file containing vendor details
and then should print out indents to these vendors.
The system should also answer managerial queries regarding the statistics
of different items sold over any given period of time and the corresponding
quantity sold and the price realised.
The context diagram for the trading house automation problem is shown in
Figure 6.13. The level 1 DFD in Figure 6.14.
Figure 6.13: Context diagram for Ex-
ample 6.4.
If two types of data always get updated at the same time, they should be stored
in a single data store. Otherwise, separate data stores should be used for them.
The inventory data changes each time supply arrives and the inventory
is updated or an item is sold, whereas the vendor data remains un-
changed.
2. If we are developing the DFD model of a process which is already being
manually carried out, then the names of the registers being maintained in
the manual process would appear as data stores in the DFD model. For
example, if TAS is currently being manually carried out, then normally
there would registers corresponding to accepted orders, pending orders,
vendor list, etc.
3. We can observe that DFDs enable a software developer to develop the data
domain and functional domain model of the system at the same time. As
the DFD is refined into greater levels of detail, the analyst performs an im-
plicit functional decomposition. At the same time, the DFD refinement
automatically results in refinement of corresponding data items.
4. The data that are maintained in physical registers in manual processing, be-
come data stores in the DFD representation. Therefore, to determine which
data should b e represented as a data store, it is useful t o try to imagine
whether a set of data items would be maintained in a register in a manual
system.
Example 6.5 (Personal Library Software) Perform structured analysis for the per-
sonal library software of Example 6.5.
The context diagram is shown in Figure 6.15.
Transform analysis
Transaction analysis
Normally, one would start with the level 1 DFD, transform it into module
representation using either the transform or transaction analysis and then pro-
ceed toward the lower level DFDs.
At each level of transformation, it is important to first determine whether the
transform or the transaction analysis is applicable to a particular DFD.
Whether to apply transform or transaction processing?
Given a specific DFD of a model, how does one decide whether to apply
transform analysis or transaction analysis? For this, one would have to ex-
amine the data input to the diagram. The data input to the diagram can be
easily spotted because they are represented by dangling arrows. If all the
data flow into the diagram are processed in similar ways (i.e. if all the input
data flow arrows are incident on the same bubble in the DFD) then trans-
form analysis is applicable. Otherwise, transaction analysis is applicable.
Normally, transform analysis is applicable only to very simple processing.
Please recollect that the bubbles are decomposed until it represents a very sim-
ple processing that can be implemented using only a few lines of code. Therefore,
transform analysis is normally applicable at the lower levels of a DFD model. Each
different way in which data is processed corresponds to a separate transaction.
Each transaction corresponds to a functionality that lets a user perform a meaning-
ful piece of work using the software.
Transform analysis
Transform analysis identifies the primary functional components (modules)
and the input and output data for these components. The first step in
transform analysis is to divide the DFD into three types of parts:
• Input.
• Processing.
• Output.
The input portion in the DFD includes processes that transform input data fro
m physical (e.g, character from terminal) to logical form (e.g. internal tables,
lists, etc.). Each input portion is called an afferent branch.
The output portion of a DFD transforms output data from logical form to physical
form. Each output portion is called an efferent branch. The remaining portion of a
DFD is called central transform.
In the next step of transform analysis, the structure chart is derived by drawing
one functional component each for the central transform, the afferent and ef-
ferent branches. These are drawn below a root module, which would invoke these
modules.
Identifying the input and output parts requires experience and skill. One possible
approach is to trace the input data until a bubble is found whose output data
cannot be deduced from its inputs alone. Processes which validate input are
not central transforms. Processes which sort input o r filter data from it are cen-
tral tansforms. T h e first level o f structure chart is produced by representing
each input and output unit as a box and each central transform as a single
box.
In the third step of transform analysis, the structure chart is refined by adding
subfunctions required by each of the high-level functional components. Many levels
of functional components may be added. This process of breaking functional com-
ponents into subcomponents is called factoring. Factoring includes adding read and
write modules, error-handling modules, initialisation and termination process, iden-
tifying consumer modules etc. The factoring process is continued until all bubbles
in the DFD are represented in the structure chart.
Example 6.6 Draw the structure chart for the RMS software of Example 6.1.
By observing the level 1 DFD of Figure 6.8, we can identify validate-input as the
afferent branch and write-output as the efferent branch. The remaining (i.e., com-
pute-rms) as the central transform. By applying the step 2 and step
3 of transform analysis, we get the structure chart shown in Figure 6.19.
Figure 6.19: Structure chart for Example 6.6.
Example 6.7 Draw the structure chart for the tic-tac-toe software of
Example 6.2.
The structure chart for the Tic-tac-toe software is shown in Figure 6.20. Ob-
serve that the check-game-status bubble, though produces some outputs. i s not
really responsible for converting logical data to physical data. On the other hand,
it carries out the processing involving checking game status. That is the main rea-
son, why we have considered it as a central transform and not as an efferent type
of module.
Transaction analysis
Transaction analysis is an alternative to transform analysis and is useful while de-
signing transaction processing programs. A transaction allows the user to perform
some specific type of work by using the software. For example, ‘issue book’, ‘return
book’, ‘query book’, etc., are transactions.
Figure 6.20: Structure chart for Ex-
ample 6.7.
As in transform analysis, first all data entering into the DFD need to be
identified. In a transaction-driven system, different data items may pass
through different computation paths through the DFD. This is in contrast to a
transform centered system where each data item entering the DFD goes through
the same processing steps. Each different way in which input data is processed is a
transaction. A simple way to identify a transaction is the following. Check the input
data. The number of bubbles on which the input data to the DFD are incident de-
fines the number of transactions. However, some transactions may not require any
input data. These transactions can be identified based on the experience gained
from solving a large number of examples.
For each identified transaction, trace the input data to the output. All the trav-
ersed bubbles belong to the transaction. These bubbles should be mapped
to the same module on the structure chart. In the structure chart, draw a root
module and below this module draw each identified transaction as a module.
Every transaction carries a tag identifying its type. Transaction analysis uses this
tag to divide the system into transaction modules a n d a transaction-center mod-
ule.
Example 6.8 Draw the structure chart for the Supermarket Prize Scheme
software of Example 6.3.
The structure chart for the Supermarket Prize Scheme software is shown in
Figure 6.21.
Example 6.9 Draw the structure chart for the trade-house automation system
(TAS) software of Example 6.4.
The structure chart for the trade-house automation system (TAS) software of
Example 6.4 is shown in Figure 6.22.
By observing the level 1 DFD of Figure 6.14, we can see that the data input to
the diagram are handled by different bubbles and therefore transaction analysis is
applicable to this DFD. Input data to this DFD are handled in three different ways
(accept-order, accept- indent-request, and handle-query), we have three different
transactions corresponding to these as shown in Figure
6.22.