Software Design Principles: Module-4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Module-4

Software Design Principles

Problem Partitioning
For software design, the goal is to divide the problem into manageable pieces.

These pieces cannot be entirely independent of each other as they together form the system.
They have to cooperate and communicate to solve the problem. This communication adds
complexity.

Abstraction
Functional Abstraction
i. A module is specified by the method it performs.
ii. The details of the algorithm to accomplish the functions are not visible to the user of the
function.

Functional abstraction forms the basis for Function oriented design approaches.
Data Abstraction

Details of the data elements are not visible to the users of data. Data Abstraction forms
the basis for Object Oriented design approaches.

Modularity
Advantages of Modularity

o It allows large programs to be written by several or different people


o It produced the well designed and more readable program.

Disadvantages of Modularity

• Execution time maybe, but not certainly, longer

o Storage size perhaps, but is not certainly, increased


o Inter-module communication problems may be increased

Modular Design

1. Functional Independence:

It is measured using two criteria:

o Cohesion: It measures the relative function strength of a module.


o Coupling: It measures the relative interdependence among modules.

2. Information hiding

Strategy of Design
To design a system, there are two possible approaches:

1. Top-down Approach

2. Bottom-up Approach: This approach is suitable in case of an existing system.


Software Design is the process to transform the user requirements into some
suitable form, which helps the programmer in software coding and
implementation.

Objectives of Software Design:

1. Correctness:
A good design should be correct i.e. it should correctly implement all
the functionalities of the system.
2. Efficiency:
A good software design should address the resources, time, and cost
optimization issues.
3. Understandability:
A good design should be easily understandable, for which it should be
modular and all the modules are arranged in layers.
4. Completeness:
The design should have all the components like data structures,
modules, and external interfaces, etc.
5. Maintainability:
A good software design should be easily amenable to change
whenever a change request is made from the customer side.

Software Design Concepts:

The software design concept simply means the idea or principle behind the design.

There are many concepts of software design and some of them are given below:
The following points should be considered while designing Software:
1. Abstraction- hide Irrelevant data
2. Modularity- subdivide the system
3. Architecture- design a structure of something
4. Refinement- removes impurities
5. Pattern- a repeated form
6. Information Hiding- hide the information

7. Refactoring- reconstruct something

Different levels of Software Design:


There are three different levels of software design. They are:

1. Architectural Design:
The architecture of a system can be viewed as the overall structure of
the system & the way in which structure provides conceptual integrity
of the system. The architectural design identifies the software as a
system with many components interacting with each other. At this
level, the designers get the idea of the proposed solution domain.

2. Preliminary or high-level design:


Here the problem is decomposed into a set of modules, the control
relationship among various modules identified, and also the interfaces
among various modules are identified. The outcome of this stage is
called the program architecture. Design representation techniques
used in this stage are structure chart and UML.

3. Detailed design:
Once the high-level design is complete, a detailed design is
undertaken. In detailed design, each module is examined carefully to
design the data structure and algorithms. The stage outcome is
documented in the form of a module specification document.
Effective Modular Design in Software
Engineering
Every software design should follow modularity.

The process of breaking down a software into multiple independent


modules where each module is developed separately is
called Modularization.
Independence of modules of a software system can be measured using 2
criteria : Cohesion, and Coupling.

Cohesion:
Cohesion is a measure of strength in relationship between various functions
within a module.
It is of 7 types which are listed below in the order of high to low cohesion:
1. Functional cohesion
2. Sequential cohesion
3. Communicational cohesion
4. Procedural cohesion
5. Temporal cohesion
6. Logical cohesion
7. Co-incidental cohesion

Coupling:
Coupling is a measure of strength in relationship between various modules
within a software.
It is of 6 types which are listed below in the order of low to high coupling:
1. Data Coupling
2. Stamp Coupling
3. Control Coupling
4. External Coupling
5. Common Coupling
6. Content Coupling
A good software design requires high cohesion and low coupling.

Coupling and Cohesion


Module Coupling
In software engineering, the coupling is the degree of interdependence between software
modules.

The various types of coupling techniques are shown in fig:


Types of Module Coupling

1. No Direct Coupling: There is no direct coupling between M1 and M2.

In this case, modules are subordinates to different modules. Therefore, no direct coupling.

2. Data Coupling: When data of one module is passed to another module, this is called
data coupling.
3. 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 entire 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.

4. Control Coupling: Control Coupling exists among two modules if data from one
module is used to direct the structure of instruction execution in another.

5. 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.

6. Common Coupling: Two modules are common coupled if they share information
through some global data items.

7. 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.

Cohesion is an ordinal type of measurement and is generally described as "high


cohesion" or "low 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.
Software Engineering | Architectural
Design
Introduction: The software needs the architectural design to represents the design
of software. IEEE defines architectural design as “the process of defining a collection
of hardware and software components and their interfaces to establish the
framework for the development of a computer system.”

Taxonomy of Architectural styles:


1. Data centred architectures:

2. Data flow architectures:


• Pipes are used to transmit data from one component to the next.
• Each filter will work independently and is designed to take data input
of a certain form and produces data output to the next filter of a
specified form. The filters don’t require any knowledge of the working
of neighboring filters.
3. Call and Return architectures: It is used to create a program that is easy
to scale and modify. Many sub-styles exist within this category. Two of them are
explained below.

• Remote procedure call architecture: This components is used to


present in a main program or sub program architecture distributed
among multiple computers on a network.
• Main program or Subprogram architectures: The main program
structure decomposes into number of subprograms or function into a
control hierarchy. Main program contains number of subprograms that
can invoke other components.

4. Object Oriented architecture:


The components of a system encapsulate data and the operations that must
be applied to manipulate the data. The coordination and communication
between the components are established via the message passing.

5. Layered architecture:
• A number of different layers are defined with each layer
performing a well-defined set of operations. Each layer will
do some operations that becomes closer to machine
instruction set progressively.
• At the outer layer, components will receive the user interface
operations and at the inner layers, components will perform
the operating system interfacing(communication and
coordination with OS)
• Intermediate layers to utility services and application software
functions.

You might also like