Unit 3: Software Design: Topics
Unit 3: Software Design: Topics
SOFTWARE DESIGN
TOPICS: Software Design: Basic Concept of Software Design, Architectural Design, Low Level Design:
Modularization, Design Structure Charts, Pseudo Codes, Flow Charts, Coupling and Cohesion Measures, Design
Strategies: Function Oriented Design, Object Oriented Design, Top-Down and Bottom-Up Design. Software
Measurement and Metrics: Various Size Oriented Measures: Halestead’s Software Science, Function Point (FP) Based
Measures, Cyclomatic Complexity Measures: Control Flow Graphs.
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:
Smaller components are easier to maintain
Program can be divided based on functional aspects
Desired level of abstraction can be brought in the program
Components with high cohesion can be re-used again
Concurrent execution can be made possible
Desired from security aspect
STRUCTURE CHARTS:
Structure Chart represent hierarchical structure of modules. It breaks down the entire system into lowest
functional modules, describe functions and sub-functions of each module of a system to a greater detail.
Structure Chart partitions the system into black boxes (functionality of the system is known to the users but
inner details are unknown). Inputs are given to the black boxes and appropriate outputs are generated.
Modules at top level called modules at low level. Components are read from top to bottom and left to right.
When a module calls another, it views the called module as black box, passing required parameters and
receiving results.
Symbols used in construction of structured chart
Module: It represents the process or task of the system. It is of three types.
o Control Module: A control module branches to more than one sub module.
o Sub Module: Sub Module is a module which is the part (Child) of another module.
o Library Module: Library Module are reusable and invokable from any module.
Conditional Call: It represents that control module can select any of the sub module on the basis of
some condition.
Loop (Repetitive call of module): It represents the repetitive execution of module by the sub module.
and a curved arrow represents loop in the module.
Data Flow: It represents the flow of data between the modules. It is represented by directed arrow with
empty circle at the end.
Control Flow: It represents the flow of control between the modules. It is represented by directed arrow
with filled circle at the end.
Physical Storage: Physical Storage is that where all the information are to be stored.
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.
Pseudo code contains more programming details than Structured English. It provides a method to perform the
task, as if a computer is executing the code.
Advantages of Pseudocode
Improves the readability of any approach. It’s one of the best approaches to start implementation of an
algorithm.
Acts as a bridge between the program and the algorithm or flowchart. Also works as a rough
documentation, so the program of one developer can be understood easily when a pseudo code is
written out. In industries, the approach of documentation is essential. And that’s where a pseudo-code
proves vital.
The main goal of a pseudo code is to explain what exactly each line of a program should do, hence
making the code construction phase easier for the programmer.
Disadvantages of Pseudocode
Pseudocode does not provide a visual representation of the logic of programming.
There is no proper format for writing the for pseudocode.
In Pseudocode there is extra need of maintain documentation.
In Pseudocode there is no proper standard very company follow their own standard for writing the
pseudocode.
FLOW CHARTS:
Flowchart is a graphical representation of an algorithm. Programmers often use it as a program-planning tool
to solve a problem. It makes use of symbols which are connected among them to indicate the flow of
information and processing. The process of drawing a flowchart for an algorithm is known as “flowcharting”.
Basic Symbols used in Flowchart Designs
Advantages of Flowchart:
Flowcharts are better way of communicating the logic of system.
Flowcharts act as a guide for blueprint during program designed.
Flowcharts helps in debugging process and provides better documentation.
With the help of flowcharts programs can be easily analyzed.
Flowcharts serve as a good proper documentation.
Disadvantages of Flowchart:
It is difficult to draw flowchart for large and complex programs.
In this there is no standard to determine the amount of detail.
Difficult to reproduce the flowcharts.
It is very difficult to modify the Flowchart.
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.
There are seven types of cohesion, namely –
Co-incidental cohesion - It is unplanned and random cohesion, which might be the result of breaking
the program into smaller modules for the sake of modularization. Because it is unplanned, it may serve
confusion to the programmers and is generally not-accepted.
Logical cohesion - When logically categorized elements are put together into a module, it is called
logical cohesion.
Emporal Cohesion - When elements of module are organized such that they are processed at a similar
point of time, it is called temporal cohesion.
Procedural cohesion - When elements of module are grouped together, which are executed sequentially
in order to perform a task, it is called procedural cohesion.
Communicational cohesion - When elements of module are grouped together, which are executed
sequentially and work on same data (information), it is called communicational cohesion.
Sequential cohesion - When elements of module are grouped because the output of one element serves
as input to another and so on, it is called sequential cohesion.
Functional cohesion - It is considered to be the highest degree of cohesion, and it is highly expected.
Elements of module in functional cohesion are grouped because they all contribute to a single well-
defined function. It can also be reused.
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.
There are five levels of coupling, namely -
Content coupling - When a module can directly access or modify or refer to the content of another
module, it is called content level coupling.
Common coupling- When multiple modules have read and write access to some global data, it is called
common or global coupling.
Control coupling- Two modules are called control-coupled if one of them decides the function of the
other module or changes its flow of execution.
Stamp coupling- When multiple modules share common data structure and work on different part of
it, it is called stamp 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 STRATEGIES:
Software design is a process to conceptualize the software requirements into software implementation.
Software design takes the user requirements as challenges and tries to find optimum solution. While the
software is being conceptualized, a plan is chalked out to find the best possible design for implementing the
intended solution. There are multiple variants of software design
4. 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.
Bottom-up strategy is more suitable when a system needs to be created from some existing system, where the
basic primitives can be used in the newer system.
“Both, top-down and bottom-up approaches are not practical individually. Instead, a good combination of
both is used.”
Metrics: A metrics is a measurement of the level that any impute belongs to a system product or process.
There are 4 functions related to software metrics:
1. Planning
2. Organizing
3. Controlling
4. Improving
Based on the LOC/KLOC count of software, many other metrics can be computed:
Errors/KLOC.
$/ KLOC.
Defects/KLOC.
Pages of documentation/KLOC.
Errors/PM.
Productivity = KLOC/PM (effort is measured in person-months).
$/ Page of documentation.
Advantages of LOC
Simple to measure
Disadvantage of LOC
It is defined on the code. For example, it cannot measure the size of the specification.
It characterizes only one specific view of size, namely length, it takes no account of functionality or
complexity
Bad software design may cause an excessive line of code
It is language dependent
Users cannot easily understand it
When we select source file to view its complexity details in Metric Viewer, the following result is seen in
Metric Report:
Metric Meaning Mathematical
Representation
n Vocabulary n1 + n2
N Size N1 + N2
V Volume Length * Log2
Vocabulary
D Difficulty (n1/2) * (N1/n2)
E Efforts Difficulty * Volume
B Errors Volume / 3000
T Testing time Time = Efforts / S,
where S=18
seconds.
2. 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.
Simple - if output count is low
Complex - if output count is high
Average - in between simple and complex.
5. 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
Average - in between simple and complex.
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:
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
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 formula:
CAF = 0.65 + 0.01N
Then
Delivered Function Points (FP)= CAF x Raw FP
Benefits of FPA:
FPA is a tool to determine the size of a purchased application package by counting all the functions
included in the package.
It is a tool to help users discover the benefit of an application package to their organization by counting
functions that specifically match their requirements.
It is a tool to measure the units of a software product to support quality and productivity analysis.
It is a vehicle to estimate cost and resources required for software development and maintenance.
It is a normalization factor for software comparison.
A = 10
IF B > C THEN
A=B “Control flow of code”
ELSE
A=C
ENDIF
Print A
Print B
Print C
The cyclomatic complexity calculated for above code will be from control flow graph. The graph shows
seven shapes(nodes), seven lines(edges), hence cyclomatic complexity is 7-7+2 = 2.
It is the measure of the programs’s control complexity and not the data the data complexity.
In this, nested conditional structures are harder to understand than non-nested structures.
In case of simple comparisons and decision structures, it may give a misleading figure.