Unit 3 Notes SE (BCS601)
Unit 3 Notes SE (BCS601)
SOFTWARE DESIGN
• Designs must specify systems that can be constructed on time and within budget
• Designs that specify systems that are easy to change are better.
• Static Models
o These models represent aspects of software systems that do not change during
execution.
Examples – interaction diagrams, state charts, DFDs, decision trees and tables, mini
specs.
1. Efficiency
2. Correctness
3. Understandability
4. Usability
5. Reliability
6. Maintainability
Data flow architecture is applied when input data takes the form of output after
passing through various phases of transformations. These transformations can be
through various computations done on data.
Object oriented architecture, the software design moves around the
classes and objects of the system. The class encapsulates the data and
methods.
Layered approach defines the number of layers and each layer performs
tasks. The outermost layer handles the functionality of user interface and the
innermost layer handles interaction with the hardware.
Call and return architecture
It is the specification of the internal elements of all major system components, their
structure properties, relationships, processing and other their algorithms and data
structures.
1. Modularization
2. Structure Charts
3. Pseudo Codes
4. Flow Charts
1. Modularization
There are many definitions of the term module. They range from “a module is a
FORTRAN subroutine” to “a module is an ADA package” to “a module is a work
assignment for an individual programmer. ”All of these definitions are correct, in the
sense that modular systems incorporate collections of abstractions in which each
functional abstraction, each data abstraction, and each control abstraction handles a
local aspect of the problem being solved. Modular system consists of well-defined,
manageable units with well-defined interfaces among the units
Process support modules: In these all the functions and data items that are
required to support a particular business process are grouped together.
Data abstraction modules: These are abstract types that are created by
associating data with processing components.
Functional modules: In these all the functions that carry out similar or
Closely related tasks are grouped together.
1. Modular systems are easier to understand and explain because their parts are
functionally independent.
2. Modular systems are easier to document because each part can be
documented
as an independent unit.
3. Programming individual modules is easier because the programmer can focus
on just one small, simple problem rather than a large complex problem.
4. Testing and debugging individual modules is easier because they can be dealt
with in isolation from the rest of the program.
5. Bugs are easier to isolate and understand, and they can be fixed without fear
of introducing problems outside the module.
6. Well-composed modules are more reusable because they are more likely to
comprise part of a solution to many problems. Also, a good module should be
easy to extract from one program and insert into another.
2. Structure Charts
• A Structure Chart is a chart which shows the breakdown of a system to its
lowest manageable parts.
• They are used in structured programming to arrange program modules into a
tree.
• Each module is represented by a box, which contains the module's name.
• The tree structure visualizes the relationships between modules, showing data
transfer between modules using arrows. Structured Charts are an example of a
top−down design where a problem (the program) is broken into its components.
• The tree shows the relationship between modules, showing data transfer
between the models.
It partitions a system into black boxes. A black box means that functionality is known to
the user without the knowledge of internal design. Inputs are given to a black box and
appropriate outputs are generated by the black box. This concept reduces complexity
because details are hidden from those who have no need or desire to know. Thus,
systems are easy to construct and easy to maintain. Here, black boxes are arranged in
hierarchical format as shown below.
Modules at the top level call the modules at the lower level. The connections between
modules are represented by lines between the rectangular boxes. The components are
generally read from top to bottom, left to right. Modules are numbered in a hierarchical
numbering scheme. In any structure chart there is one and only one module at the top
called the root.
Basic Building Blocks of a Structure Chart
A control module branches to more than one sub−module. Library Modules are
re−usable and invokable from any module.
A directed arrow with filled circle at the end represents control flow.
3. Data-flow Arrows. Data-flow arrows represent that the named data passes
from one module to the other in the direction of the arrow.
A directed arrow with empty circle at the end represents data flow.
4. Library Modules. Library modules are the frequently called modules and are
usually represented by a rectangle with double edges. Usually when a module
is invoked by many other modules, it is made into a library module.
5. Selection. The diamond symbol represents that one module out of several
modules connected with the diamond symbol are invoked depending on the
condition satisfied, which is written in the diamond symbol.
It is represented by small diamond at the base of module. It depicts that control module
can select any of sub−routine based on some condition.
6. Repetitions. A loop around the control-flow arrows denotes that the respective
modules are invoked repeatedly.
A curved arrow represents loop in the module. All sub−modules covered by loop
repeat execution of module.
Example
An example of structure chart representing the logic for calculating average:
Pseudocode
A pseudocode is an informal way of writing a program. However, it is not a computer program. It only
represents the algorithm of the program in natural language and mathematical notations. Besides,
there is no particular programming language to write a pseudocode. Unlike in regular programming
languages, there is no syntax to follow when writing a pseudocode. Furthermore, it is possible to use
pseudocodes using simple English language statements.
Sum_Of_Two_Numbers()
Begin
Set sum =0;
Read: number 1, number 2;
Set sum = number1 + number 2;
Print sum;
End
Area_of_Trinagle()
Begin
Read: base, height;
Set area = 0.5 * base * height;
Print area;
End
So, after writing the pseudocode, we can write the actual program using that pseudocode. Moreover,
as it represents the algorithm, we can implement it using any programming language.
Advantages
• It is easy to understand even a complex program
• It does not follow any programming language syntax
• Programs can be easily generated by pseudo−code
• It allows us to understand the logic of a program very quickly
• Pseudo−code can be modified easily
Disadvantages
• Unlike the programs, a pseudo−code cannot be compiled or interpreted from which errors
cannot be identified
• As pseudo−code can be written in any order, so it becomes difficult to understand the flow of
a program
Flowchart
A flowchart represents an algorithm using a diagram. Flow charts, use rectangles, ovals, diamonds and
potentially numerous other shapes to define the type of step, along with connecting arrows to define
flow and sequence. They are widely used in multiple fields to document, study, plan, and communicate
often complex processes in clear, easy−to−understand diagrams.
In it, the oval shape denotes the start and end. And, the rhombus shape represents inputs and outputs.
Entering marks is an input while displaying marks is an output. Further, the diamond shape symbol
represents the decision selection. Depending on the decision, the correct output will be displayed.
Flow Chart
In overall, a flow chart represents the sequence of steps to follow in order to solve the problem.
Thus, the flowchart diagrams are easier to draw and understand.
Advantages of Flowchart
• Effective Communication: Flowcharts are better way of communicating the logic of the
system.
• Effective Analysis: Flowchart which gives broad idea about the logic so that problem can be
analyzed more efficiently.
• Easy Debugging and Efficient Testing: The Flowchart helps in debugging and testing process.
• Efficient Coding: The flowcharts are very useful during program development phase.
• Proper Documentation: Flowcharts serves as a good program documentation, which is
needed for various purposes.
• Efficient Program Maintenance: Maintenance of operating programs becomes easy with the
help of flowchart.
Disadvantages of Flowchart
• Complex Logic: For complicated logic, flowchart becomes complex and clumsy.
• Difficulty in Modifications: If change is required in the logic then
flowchart needs to be redrawn and requires a lot of time.
Structured Design
Structured design gives better understanding of how the problem is
being solved. Structured design is mostly based on ‘divide and conquer’
strategy where a problem is broken into several small problems and
each small problem is individually solved until the whole problem is
solved.
• Structured design is a top-down decomposition of system
functionality
• Process and procedures
• DFD
• Decision Tree
• ER Diagram
Object Oriented Design
Object-oriented methodology is defined as the system of principles and
procedures applied to object-oriented software development. Each
object can hide data from other objects.
• Focus on object
• Use Case Model
• Object Model
Concepts of Object-Oriented Design:
1. Objects
2. Classes
3. Polymorphism
4. Encapsulation
5. Inheritance
2. Bottom-up approach
These modules are further combined to form the next higher-level modules.
process of grouping several simpler modules to form higher level modules
continues until the main module of system development process is achieved.
Difference between top down and bottomup
approach
Top down Approach Bottom up Approach
Module Coupling
A good design is the one that has low coupling. Coupling is measured by the number of
relations between the modules. That is, the coupling increases as the number of calls
between modules increase or the amount of shared data is large. Thus, it can be said that a
design with high coupling will have more errors.
In this case, modules are subordinates to different modules. Therefore, no direct coupling.
Data Coupling: When data of one module is passed to another module, this is called data coupling.
2. Stamp Coupling: Two modules are stamp coupled if they communicate using composite data items
such as structure, objects, etc. When the module passes non-global data structure or entir e structure to
another module, they are said to be stamp coupled. For example, passing structure variable in C or
object in C++ language to a module.
3. Control Coupling: Control Coupling exists among two modules if data from one module is used to
direct the structure of instruction execution in another.
4. External Coupling: External Coupling arises when two modules share an externally imposed data
format,communication protocols, or device interface. This is related to communication to external tools
and devices.
5. Common Coupling: Two modules are common coupled if they share information through some
global data items.
6. Content Coupling: Content Coupling exists among two modules if they share code, e.g., a branch
from one module into another module.
Module Cohesion
In computer programming, cohesion defines to the degree to which the elements of a module belong
together. Thus, cohesion measures the strength of relationships between pieces of functionality within a
given module. For example, in highly cohesive systems, functionality is strongly related.
Cohesion is an ordinal type of measurement and is generally described as "high cohesion" or "low
cohesion."
Types of Modules Cohesion
1. Functional Cohesion: Functional Cohesion is said to exist if the different elements of a module,
cooperate to achieve a single function.
2. Sequential Cohesion: A module is said to possess sequential cohesion if the element of a module form
the components of the sequence, where the output from one component of the sequence is input to the
next.
3. Communicational Cohesion: A module is said to have communicational cohesion, if all tasks of the
module refer to or update the same data structure, e.g., the set of functions defined on an array or a stack.
4. Procedural Cohesion: A module is said to be procedural cohesion if the set of purpose of the module
are all parts of a procedure in which particular sequence of steps has to be carried out for achieving a
goal, e.g., the algorithm for decoding a message.
5. Temporal Cohesion: When a module includes functions that are associated by the fact that all the
methods must be executed in the same time, the module is said to exhibit temporal cohesion.
6. Logical Cohesion: A module is said to be logically cohesive if all the elements of the module perform a
similar operation. For example Error handling, data input and data output, etc.
7. Coincidental Cohesion: A module is said to have coincidental cohesion if it performs a set of tasks that
are associated with each other very loosely, if at all.
Coupling Cohesion
Coupling shows the relationships between Cohesion shows the relationship within the
modules. module
Coupling is also called Inter-Module Cohesion is also called Intra-Module
Binding Binding
In coupling, modules are linked to the other In cohesion, the module focuses on a single
modules. thing.
Loose coupling is the best for software. Highly cohesion is the best for software.
high coupling will have more errors Low cohesion is the Error of software.
It represents the independence among the It represents the independence among the
modules. modules.
Production P=FP/Effort
Example 1
Consider a software project with the following information domain characteristics for calculation of
function point metric.
It is given that the complexity weighting factors for I, O, E, F and N are 4, 5, 4, 10 and 7, respectively.
It is also given that, out of fourteen value adjustment factors that influence the development effort,
four factors are not applicable, each of the other four factors have value 3, and each of the remaining
factors have value 4. The computed value of function point metric is _________.
Answer
The Halstead’s measures are applicable to operational system and to development efforts once
the code has been written. Thus using Halstead’s measurement experimental verification can be
performed in software science.
Program length:
The length of a program is total usage of operators and operands in the program.
Length (N) = N1 + N2
Program vocabulary:
The Program vocabulary is the number of unique operators and operands used in the program.
Vocabulary (n) = n1 + n2
Program Volume:
The Program Volume can be defined as minimum number of bits needed to encode the program.
Length estimation:
N = n1 log2 n1 + n2 log2 n2
Example: Obtain Halstead’s length and volume measure for following C function.
int temp;
Temp = a[i];
a[i] = a[i+1];
a[i+1] = temp;
We first find out the operands and operators from above function along with their occurrences.
N = N1 + N2
= 16 +21 = 37
N = 37
n = n1 + n2
= 5 + 9 = 14
n = 14
= 5 log 5 + 9 log 9
Volume = N * log n
= 37 * log (14)
37 * 2.63 = 97.64
V (G) = E - N + 2 * P
Or
V (G) = E - N + 2
E = The number of edges in graphs G
N = The number of nodes in graphs G
P = The number of connected components in graph G.
Advantages:
1. Gives complexity of various designs
2. Computed early in life cycle
3. Easy to apply
4. Measures minimum effort
Disadvantages:
1. Measures program’s control complexity and not the data complexity
2. Nested conditional structures are harder to understand
3. Ignore the size of the program
Method 1: Total number of regions in the flow
graph is a Cyclomatic complexity.+1
Method 2: The Cyclomatic complexity, V (G) for a
flow graph G can be defined as V (G) = E - N + 2
Where: E is total number of edges in the flow graph.
N is the total number of nodes in the flow graph.
Method 3: The Cyclomatic complexity V (G) for a
flow graph G can be defined as V (G) = P + 1 Where:
P is the total number of predicate nodes contained
in the flow G.
Example 1
Example 2