(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽❤️🧑🏻 89...
Chapter 5 software design
1. Software Design
Goutam Majumder
National Institute of Technology Mizoram
Asst. Professor
Department of CSE
goutam.nita@gmail.com
March 23, 2017
Goutam Majumder (NITMZ) SD March 23, 2017 1 / 26
2. Overview
1 Introduction to software design
2 Outcome of a Design Process
Classification of Design Activities
Classification of Design Methodologies
Analysis vs Design
3 Goodness of a design
4 Functional Independence
5 Cohesion and Coupling
Classification of cohesiveness
Classification of Coupling
6 Function-oriented design vs. Object-oriented design
Goutam Majumder (NITMZ) SD March 23, 2017 2 / 26
3. Introduction
Design phase transforms SRS document:
To a form easily implementable in some programming language
Figure: Software Design Process
Goutam Majumder (NITMZ) SD March 23, 2017 3 / 26
4. Outcome of a Design Process
Different Modules Required: Different modules must be clearly iden-
tified and documented. Modules name must be given as their task (e.g.
handle registration task)
Control Relationship among Modules:It is arise due to function call
between the modules. It must be identified and documented
Interface among different modules: It identifies the exact data items
exchanged between the module.
Data structure of the individual modules: Each module store some
data that the function of the module need to share to accomplish the
overall responsibility.
Algorithm required to implement the individual modules: Each
function in a module do some specific task. Required algorithm must
be clearly designed and documented with due consideration to the ac-
curacy of the result, space and time.
Goutam Majumder (NITMZ) SD March 23, 2017 4 / 26
5. Classification of Design Activities
A good software design is a single step procedure but rather by iterating
over a series of design activities. Activities are classify into two stages:
High Level Design
A problem is decomposed into set of modules, the control relationship
among various modules identified, and also the interfaces among various
modules are identified.
Detailed Design
Each module is examined carefully to design its data structures and the
algorithms.
Outcome of detailed design is Module specification (MSPEC)
document
Goutam Majumder (NITMZ) SD March 23, 2017 5 / 26
6. High Level Design
It identifying the followings:
Modules; Control relationships among modules; Interfaces among
modules.
Several notations are available to represent high-level design:
Usually a tree-like diagram called structure chart is used.
Other notations: Jackson diagram or Warnier-Orr diagram can also be
used.
The outcome of high-level design: Program structure (or software
architecture).
Figure: High Level Design
Goutam Majumder (NITMZ) SD March 23, 2017 6 / 26
7. Outcome of a Design Process
Classification of Design Methodologies
It is roughly classify these methodologies into two:
procedural
object-oriented
Does a design technique ensure a unique solution?
Designer must employ many design technique (candidate). Among them
designer must choose superior one
Analysis vs Design
An analysis technique helps elaborate the customer requirements through
careful thinking–at the same time consciously avoids making any decisions
regarding implementation.
In function oriented: analysis (DFD) and design (structure chart)
In object-oriented: UML for analysis and design
Goutam Majumder (NITMZ) SD March 23, 2017 7 / 26
8. Goodness of a design
It can vary depending on the exact application being designed. For example
memory issue for embedded software. Characteristics for good software
design for general application have the following:
Should implement all functionalities of the system correctly.
Should be easily understandable.
Should be efficient.
Should be easily amenable to change (i.e. easily maintainable).
Understandability of a design is a major issue
To determines the goodness of design:
A design that is easy to understand and also easy to maintain and change.
Unless a design is easy to understand,
Tremendous effort needed to maintain it
We already know that about 60% effort is spent in maintenance
If the software is not easy to understand: Maintenance effort would
increase many times.
Goutam Majumder (NITMZ) SD March 23, 2017 8 / 26
9. Goodness of a design
Understandability of a design is a major issue
Use consistent and meaningful names: For various design components.
Should make use of abstraction and decomposition principles in ample
measure
How are Abstraction and Decomposition Principles Used in Design?
By two principal ways:
1 Modularity: It is a fundamental attributes of any good design.
Decomposition of a problem cleanly into modules
Modules are almost independent of each other
Divide and conquer principle
If modules are independent:
Modules can be understood separately,
Reduces the complexity greatly
2 Layered Design: It is one in which when the call relations among dif-
ferent modules are represented graphically
Goutam Majumder (NITMZ) SD March 23, 2017 9 / 26
10. Goodness of a design
Can we quantitatively measure the modularity of a design solution?
No other solution is available
No quantitative metrics available to directly measure the modularity
But we can quantitatively characterise the modularity of a design
solution
using cohesion and
coupling
A good design with high cohesion and low coupling among modules is
the effective problem decomposition
Goutam Majumder (NITMZ) SD March 23, 2017 10 / 26
11. Goodness of a design
Layered design
Figure: Two design solution
Goutam Majumder (NITMZ) SD March 23, 2017 11 / 26
12. Goodness of a design
Layered design
A module can invoke only module in the layer immediately below.
A layered design can be considered to be implementing control abstrac-
tion
It makes debugging easy. Since one would need to concentrate only on
a few modules to detect the error
It makes easy to understand how the lower layer module works
Superordinate and subordinate modules
Visibility
Depth and Width: It indicates number of layers and the overall span
of control respectively
Fan-out: it measures the number of modules that are directly controlled
by a given module. High fan-out numbers is not a good design
Fan-in: number of modules that directly invoke a given module
Goutam Majumder (NITMZ) SD March 23, 2017 12 / 26
13. Functional Independence
We mean that a module performs a single task and needs very little inter-
action with other modules.
Functional independence reduces error propagation
Degree of interaction between modules is low.
An error existing in one module does not directly affect other modules
Reuse of modules is possible : Can be easily taken out and reused in a
different program
Each module does some well-defined and precise function
The interfaces of a module with other modules is simple and minimal
Goutam Majumder (NITMZ) SD March 23, 2017 13 / 26
14. Cohesion and Coupling
Cohesion
When the functions of the module cooperate with each other for performing
a single objective, then the module has good cohesion.
Functional strength of a module.
A cohesive module performs a single task or function
Coupling
It is a measure of the degree of the interdependence between the two mod-
ules. Two modules are said to be highly coupled, if they are:
1 If the function call between two modules involve passing large chunks
of shared data, the modules are tightly coupled
2 If the interactions occur through some shared data, then also we say
that they are highly coupled
If two modules either do not interact with each other or interact by a few
primitive data items, they are said to have low coupling.
Goutam Majumder (NITMZ) SD March 23, 2017 14 / 26
15. Classification of Cohesiveness
Classification is often subjective:
Yet gives us some idea about cohesiveness of a module
By examining the type of cohesion exhibited by a module
We can roughly tell whether it displays high cohesion or low cohesion
Figure: Classification of Cohesion
Goutam Majumder (NITMZ) SD March 23, 2017 15 / 26
16. Classification of Cohesiveness
Coincidental Cohesion
The module performs a set of tasks: Which relate to each other very
loosely, if at all
The module contains a random collection of functions
Functions have been put in the module out of pure coincidence
without any thought or design
Logical Cohesion
All elements of the module perform similar operations: e.g. error handling,
data input, data output, etc.
An example of logical cohesion: A set of print functions to generate
an output report arranged into a single module
Goutam Majumder (NITMZ) SD March 23, 2017 16 / 26
17. Classification of Cohesiveness
Temporal Cohesion
The module contains tasks that are related by the fact: All the tasks must
be executed in the same time span. Example:
The set of functions responsible for initialization,
start-up, shut-down of some process, etc.
Procedural Cohesion
The set of functions of the module:
All part of a procedure (algorithm)
Certain sequence of steps have to be carried out in a certain order for
achieving an objective (e.g. the algorithm for decoding a message)
Communicational Cohesion
All functions of the module: Reference or update the same data structure
(e.g. The set of functions defined on an array or a stack)
Goutam Majumder (NITMZ) SD March 23, 2017 17 / 26
18. Classification of Cohesiveness
Sequential Cohesion
Elements of a module form different parts of a sequence
Output from one element of the sequence is input to the next
e.g. sort→search→display
Functional Cohesion
Different elements of a module cooperate:
To achieve a single function,
e.g. managing an employee’s pay-roll
When a module displays functional cohesion,
We can describe the function using a single sentence.
Goutam Majumder (NITMZ) SD March 23, 2017 18 / 26
19. Determining Cohesiveness
Write down a sentence to describe the function of the module
If the sentence is compound,
It has a sequential or communicational cohesion
If it has words like first, next, after, then, etc.
It has sequential or temporal cohesion
If it has words like initialize
It probably has temporal cohesion
Goutam Majumder (NITMZ) SD March 23, 2017 19 / 26
20. Classification of Coupling
Coupling indicates:
How closely two modules interact or how interdependent they are.
The degree of coupling between two modules depends on their
interface complexity.
There are no ways to precisely determine coupling between two
modules:
Classification of different types of coupling will help us to
approximately estimate the degree of coupling between two modules
Five types of coupling can exist between any two modules
Figure: Coupling Classes
Goutam Majumder (NITMZ) SD March 23, 2017 20 / 26
21. Classification of Coupling
Data Coupling
Two modules are data coupled - If they communicate via a parameter:
an elementary data item e.g an integer, a float, a character, etc.
The data item should be problem related: Not used for control purpose.
Stamp Coupling
Two modules are stamp coupled - If they communicate via a composite data
item - such as a record in PASCAL or a structure in C.
Control Coupling
Data from one module is used to direct the order of instruction
execution in another
e.g. A flag set in one module and tested in another module
Goutam Majumder (NITMZ) SD March 23, 2017 21 / 26
22. Classification of Coupling
Common Coupling
If module share some global data items
Content Coupling
Content coupling exists between two modules:
If they share code
e.g, branching from one module into another module
The degree of coupling increases
from data coupling to content coupling
Goutam Majumder (NITMZ) SD March 23, 2017 22 / 26
23. Design Approaches
Two fundamentally different software design approaches:
Function-oriented design
Object-oriented design
These two design approaches are radically different
However, are complementary – Rather than competing techniques.
Each technique is applicable at – Different stages of the design process
Function-oriented Design
A system is looked upon as something – That performs a set of
functions
Starting at this high-level view of the system:
Each function is successively refined into more detailed functions.
Functions are mapped to a module structure.
The function create-new-library- member
Creates the record for a new member
Assigns a unique membership number
Prints a bill towards the membership
Goutam Majumder (NITMZ) SD March 23, 2017 23 / 26
24. Design Approaches
Function Oriented Design
The system state is centralized:
Accessible to different functions
Member–records – Available for reference and updation to several
functions
Create-new-member
Delete-member
Update-member-record
Several function-oriented design approaches have been developed
Structured design (Constantine and Yourdon, 1979)
Jackson’s structured design (Jackson, 1975)
Warnier-Orr methodology
Wirth’s step-wise refinement
Hatley and Pirbhai’s Methodology
Goutam Majumder (NITMZ) SD March 23, 2017 24 / 26
25. Design Approaches
Object–Oriented Design
System is viewed as a collection of objects (i.e. entities).
System state is decentralized among the objects – Each object
manages its own state information
Library Automation Software:
Each library member is a separate object – With its own data and
functions
Functions defined for one object – Cannot directly refer to or change
data of other objects
Objects have their own internal data – Defines their state.
Similar objects constitute a class – Each object is a member of some
class.
Classes may inherit features – From a super class.
Conceptually, objects communicate by message passing.
Goutam Majumder (NITMZ) SD March 23, 2017 25 / 26