Software Design Tutorial
Software Design Tutorial
Software design is the first step in SDLC (Software Design Life Cycle), which
moves the concentration from problem domain to solution domain. It tries to
specify how to fulfill the requirements mentioned in SRS.
91
Software Engineering Tutorial
Modularization
Modularization is a technique to divide a software system into multiple discrete
and independent modules, which are expected to be capable of carrying out
task(s) independently. These modules may work as basic constructs for the entire
software. Designers tend to design modules such that they can be executed and/or
compiled separately and independently.
Modular design unintentionally follows the rule of ‘divide and conquer’ problem-
solving strategy, this is because there are many other benefits attached with the
modular design of a software.
Advantage of modularization:
Concurrency
Back in time, all software are meant to be executed sequentially. By sequential
execution, we mean that the coded instruction will be executed one after another
implying only one portion of program being activated at any given time. Say, a
software has multiple modules, then only one of all the modules can be found
active at any time of execution.
Example
The spell check feature in word processor is a module of software, which runs
along side the word processor itself.
37
Software Engineering Tutorial
Cohesion
Cohesion is a measure that defines the degree of intra-dependability within
elements of a module. The greater the cohesion, the better is the program design.
38
Software Engineering Tutorial
Coupling
Coupling is a measure that defines the level of inter-dependability among modules
of a program. It tells at what level the modules interfere and interact with each
other. The lower the coupling, the better the program.
Common coupling- When multiple modules have read and write access to
some global data, it is called common or global coupling.
Data coupling- Data coupling is when two modules interact with each
other by means of passing data (as parameter). If a module passes data
structure as parameter, then the receiving module should use all its
components.
Design Verification
The output of software design process is design documentation, pseudo codes,
detailed logic diagrams, process diagrams, and detailed description of all
functional or non-functional requirements.
The next phase, which is the implementation of software, depends on all outputs
mentioned above.
It is then becomes necessary to verify the output before proceeding to the next
phase. The early any mistake is detected, the better it is or it might not be
detected until testing of the product. If the outputs of design phase are in formal
notation form, then their associated tools for verification should be used otherwise
a thorough design review can be used for verification and validation.
39
Software Engineering Tutorial
40
Software Engineering Tutorial
Software analysis and design is the intermediate stage, which helps human-
readable requirements to be transformed into actual code.
Let us see few analysis and design tools used by software designers:
There is a prominent difference between DFD and Flowchart. The flowchart depicts
flow of control in program modules. DFDs depict flow of data in the system at
various levels. It does not contain any control or branch elements.
Types of DFD
Data Flow Diagrams are either Logical or Physical.
Logical DFD - This type of DFD concentrates on the system process, and
flow of data in the system. For example in a banking software system, how
data is moved between different entities.
Physical DFD - This type of DFD shows how the data flow is actually
implemented in the system. It is more specific and close to the
implementation.
DFD Components
DFD can represent source, destination, storage, and flow of data using the
following set of components -
91
Software Engineering Tutorial
Process - Activities and action taken on the data are represented by Circle
or Round-edged rectangles.
Data Storage - There are two variants of data storage - it can either be
represented as a rectangle with absence of both smaller sides or as an
open-sided rectangle with only one side missing.
Levels of DFD
Level 0 - Highest abstraction level DFD is known as Level 0 DFD, which
depicts the entire information system as one diagram concealing all the
underlying details. Level 0 DFDs are also known as context level DFDs.
Level 1 - The Level 0 DFD is broken down into more specific, Level 1 DFD.
Level 1 DFD depicts basic modules in the system and flow of data among
various modules. Level 1 DFD also mentions basic processes and sources
of information.
42
Software Engineering Tutorial
Level 2 - At this level, DFD shows how data flows inside the modules
mentioned in Level 1.
Higher level DFDs can be transformed into more specific lower level DFDs
with deeper level of understanding unless the desired level of specification
is achieved.
Structure Charts
Structure chart is a chart derived from Data Flow Diagram. It represents the
system in more detail than DFD. It breaks down the entire system into lowest
functional modules, describes functions and sub-functions of each module of the
system to a greater detail than DFD.
43
Software Engineering Tutorial
Jump - An arrow is shown pointing inside the module to depict that the
control will jump in the middle of the sub-module.
44
Software Engineering Tutorial
Data flow - A directed arrow with empty circle at the end represents data
flow.
Control flow - A directed arrow with filled circle at the end represents
control flow.
HIPO Diagram
Hierarchical Input Process Output (HIPO) diagram is a combination of two
organized methods to analyze the system and provide the means of
documentation. HIPO model was developed by IBM in year 1970.
HIPO diagram represents the hierarchy of modules in the software system. Analyst
uses HIPO diagram in order to obtain high-level view of system functions. It
45
Software Engineering Tutorial
In contrast to Input Process Output (IPO) diagram, which depicts the flow of
control and data in a module, HIPO does not provide any information about data
flow or control flow.
Example
Both parts of HIPO diagram, Hierarchical presentation, and IPO Chart are used for
structure designing of software program as well as documentation of the same.
46
Software Engineering Tutorial
Structured English
Most programmers are unaware of the large picture of software so they only rely
on what their managers tell them to do. It is the responsibility of higher software
management to provide accurate information to the programmers to develop
accurate yet fast code.
Hence, analysts and designers of the software come up with tools such as
Structured English. It is nothing but the description of what is required to code
and how to code it. Structured English helps the programmer to write error-free
code. Here, both Structured English and Pseudo-Code tries to mitigate that
understanding gap.
IF-THEN-ELSE,
DO-WHILE-UNTIL
Analyst uses the same variable and data name, which are stored in Data
Dictionary, making it much simpler to write and understand the code.
Example
We take the same example of Customer Authentication in the online shopping
environment. This procedure to authenticate customer can be written in
Structured English as:
Enter Customer_Name
ELSE
ENDIF
47
Software Engineering Tutorial
The code written in Structured English is more like day-to-day spoken English. It
can not be implemented directly as a code of software. Structured English is
independent of programming language.
Pseudo-Code
Pseudo code is written more close to programming language. It may be considered
as augmented programming language, full of comments, and descriptions.
Pseudo code avoids variable declaration but they are written using some actual
programming language’s constructs, like C, Fortran, Pascal, etc.
48
Software Engineering Tutorial
Example
Program to print Fibonacci up to n numbers.
if a greater than b
Increase b by a;
Print b;
increase a by b;
print a;
}
}
Decision Tables
A Decision table represents conditions and the respective actions to be taken to
address them, in a structured tabular format.
It is a powerful tool to debug and prevent errors. It helps group similar information
into a single table and then by combining tables it delivers easy and convenient
decision-making.
49
Software Engineering Tutorial
Example
Let us take a simple example of day-to-day problem with our Internet
connectivity. We begin by identifying all problems that can arise while starting the
internet and their respective possible solutions.
We list all possible problems under column conditions and the prospective actions
under column Actions.
Conditions/Actions Rules
Shows Connected N N N N Y Y Y Y
Opens Website Y N Y N Y N Y N
Do no action
Entity-Relationship Model
Entity-Relationship model is a type of database model based on the notion of real
world entities and relationship among them. We can map real world scenario onto
ER database model. ER Model creates a set of entities with their attributes, a set
of constraints and relation among them.
50
Software Engineering Tutorial
ER Model is best used for the conceptual design of database. ER Model can be
represented as follows :
Mapping cardinalities:
one to one
one to many
many to one
many to many
Data Dictionary
Data dictionary is the centralized collection of information about data. It stores
meaning and origin of data, its relationship with other data, data format for usage,
etc. Data dictionary has rigorous definitions of all names in order to facilitate user
and software designers.
51
Software Engineering Tutorial
Contents
Data dictionary should contain information about the following:
Data Flow
Data Structure
Data Elements
Data Stores
Data Processing
Data Flow is described by means of DFDs as studied earlier and represented in
algebraic form as described.
= Composed of
{} Repetition
() Optional
+ And
[/] Or
Example
Address = House No + (Street / Area) + City + State
Data Elements
Data elements consist of Name and descriptions of Data and Control Items,
Internal or External data stores etc. with the following details:
Primary Name
Secondary Name (Alias)
Use-case (How and where to use)
52
Software Engineering Tutorial
Data Store
It stores the information from where the data enters into the system and exists
out of the system. The Data Store may include -
Files
o Internal to software.
o External to software but on the same machine.
o External to software and system, located on different machine.
Tables
o Naming convention
o Indexing property
Data Processing
There are two types of Data Processing:
53
Software Engineering Tutorial
There are multiple variants of software design. Let us study them briefly:
Structured Design
Structured design is a conceptualization of problem into several well-organized
elements of solution. It is basically concerned with the solution design. Benefit of
structured design is, it gives better understanding of how the problem is being
solved. Structured design also makes it simpler for designer to concentrate on the
problem more accurately.
The small pieces of problem are solved by means of solution modules. Structured
design emphasis that these modules be well organized in order to achieve precise
solution.
These modules are arranged in hierarchy. They communicate with each other. A
good structured design always follows some rules for communication among
multiple modules, namely -
91
Software Engineering Tutorial
This design mechanism divides the whole system into smaller functions, which
provides means of abstraction by concealing the information and their operation.
These functional modules can share information among themselves by means of
information passing and using information available globally.
Design Process
The whole system is seen as how data flows in the system by means of data
flow diagram.
DFD depicts how functions change data and state of the entire system.
The entire system is logically broken down into smaller units known as
functions on the basis of their operation in the system.
Objects - All entities involved in the solution design are known as objects.
For example, person, banks, company, and customers are treated as
objects. Every entity has some attributes associated to it and has some
methods to perform on the attributes.
55
Software Engineering Tutorial
Design Process
Software design process can be perceived as series of well-defined steps. Though
it varies according to design approach (function oriented or object oriented, yet It
may have the following steps involved:
56
Software Engineering Tutorial
Top-down design takes the whole software system as one entity and then
decomposes it to achieve more than one sub-system or component based on some
characteristics. Each sub-system or component is then treated as a system and
decomposed further. This process keeps on running until the lowest level of
system in the top-down hierarchy is achieved.
Top-down design starts with a generalized model of system and keeps on defining
the more specific part of it. When all the components are composed the whole
system comes into existence.
Top-down design is more suitable when the software solution needs to be designed
from scratch and specific details are unknown.
Bottom-up Design
The bottom up design model starts with most specific and basic components. It
proceeds with composing higher level of components by using basic or lower level
components. It keeps creating higher level components until the desired system
is not evolved as one single component. With each higher level, the amount of
abstraction is increased.
Both, top-down and bottom-up approaches are not practical individually. Instead,
a good combination of both is used.
57
Software Engineering Tutorial
User interface is part of software and is designed in such a way that it is expected
to provide the user insight of the software. UI provides fundamental platform for
human-computer interaction.
Attractive
Simple to use
Responsive in short time
Clear to understand
Consistent on all interfacing screens
UI is broadly divided into two categories:
CLI provides a command prompt, the place where the user types the command
and feeds to the system. The user needs to remember the syntax of command
and its use. Earlier CLI were not programmed to handle the user errors effectively.
91
Software Engineering Tutorial
CLI Elements
59
Software Engineering Tutorial
Typically, GUI is more resource consuming than that of CLI. With advancing
technology, the programmers and designers create complex GUI designs that
work with more efficiency, accuracy, and speed.
GUI Elements
GUI provides a set of components to interact with software or hardware.
Every graphical component provides a way to work with the system. A GUI system
has following elements such as:
60
Software Engineering Tutorial
Cursor - Interacting devices such as mouse, touch pad, digital pen are
represented in GUI as cursors. On screen cursor follows the instructions
from hardware in almost real-time. Cursors are also named pointers in GUI
systems. They are used to select menus, windows and other application
features.
Dialogue Box - It is a child window that contains message for the user and
request for some action to be taken. For Example: Application generate a
dialogue to get confirmation from user to delete a file.
Text-Box - Provides an area for user to type and enter text-based data.
Buttons - They imitate real life buttons and are used to submit inputs to
the software.
61
Software Engineering Tutorial
List-box - Provides list of available items for selection. More than one item
can be selected.
Sliders
Combo-box
Data-grid
Drop-down list
62
Software Engineering Tutorial
A model used for GUI design and development should fulfill these GUI specific
steps.
GUI Requirement Gathering - The designers may like to have list of all
functional and non-functional requirements of GUI. This can be taken from
user and their existing software solution.
User Analysis - The designer studies who is going to use the software GUI.
The target audience matters as the design details change according to the
knowledge and competency level of the user. If user is technical savvy,
advanced and complex GUI can be incorporated. For a novice user, more
information is included on how-to of software.
63
Software Engineering Tutorial
Testing - GUI testing can be done in various ways. Organization can have
in-house inspection, direct involvement of users and release of beta version
are few of them. Testing may include usability, compatibility, user
acceptance etc.
GUI implementation tools provide powerful array of GUI controls. For software
customization, designers can change the code accordingly.
There are different segments of GUI tools according to their different use and
platform.
Example
Mobile GUI, Computer GUI, Touch-Screen GUI etc. Here is a list of few tools which
come handy to build GUI:
FLUID
AppInventor (Android)
LucidChart
Wavemaker
Visual Studio
64
Software Engineering Tutorial
Permit easy reversal of actions - This feature relieves anxiety, since the
user knows that errors can be undone. Easy reversal of actions encourages
exploration of unfamiliar options. The units of reversibility may be a single
action, a data entry, or a complete group of actions.
65
Software Engineering Tutorial
66
Software Engineering Tutorial
91
Software Engineering Tutorial
Parameter Meaning
When we select source file to view its complexity details in Metric Viewer, the
following result is seen in Metric Report:
n Vocabulary n1 + n2
N Size N1 + N2
If we compare two programs of same size, the one with more decision-making
statements will be more complex as the control of program jumps frequently.
68
Software Engineering Tutorial
Draw an arc
Draw an arc.
V(G) = e – n + 2
Where:
e = 10
n=8
Cyclomatic Complexity = 10 - 8 + 2
69
Software Engineering Tutorial
=4
Function Point
It is widely used to measure the size of software. Function Point concentrates on
functionality provided by the system. Features and functionality of the system are
used to measure the software complexity.
External Input
Every unique input to the system, from outside, is considered as external input.
Uniqueness of input is measured, as no two inputs should have same formats.
These inputs can either be data or control parameters.
70
Software Engineering Tutorial
External Output
All output types provided by the system are counted in this category. Output is
considered unique if their output format and/or processing are unique.
External Inquiry
An inquiry is a combination of input and output, where user sends some data to
inquire about as input and the system responds to the user with the output of
inquiry processed. The complexity of a query is more than External Input and
External Output. Query is said to be unique if its input and output are unique in
terms of format and data.
Simple - if query needs low processing and yields small amount of output
data
Complex - if query needs high process and yields large amount of output
data
71
Software Engineering Tutorial
Each of these parameters in the system is given weightage according to their class
and complexity. The table below mentions the weightage given to each parameter:
Inputs 3 4 6
Outputs 4 5 7
Enquiry 3 4 6
Files 7 10 15
Interfaces 5 7 10
The table above yields raw Function Points. These function points are adjusted
according to the environment complexity. System is described using fourteen
different characteristics:
Data communications
Distributed processing
Performance objectives
Operation configuration load
Transaction rate
Online data entry,
End user efficiency
Online update
Complex processing logic
Re-usability
Installation ease
Operational ease
Multiple sites
Desire to facilitate changes
These characteristics factors are then rated from 0 to 5, as mentioned below:
No influence
72
Software Engineering Tutorial
Incidental
Moderate
Average
Significant
Essential
All ratings are then summed up as N. The value of N ranges from 0 to 70 (14
types of characteristics x 5 types of ratings). It is used to calculate Complexity
Adjustment Factors (CAF), using the following formulae:
Then,
Cost = $ / FP
Quality = Errors / FP
Productivity = FP / person-month
73