SE Unit-3
SE Unit-3
SE Unit-3
Software design is a process to transform user requirements into some suitable form, which helps the
programmer in software coding and implementation.
For assessing user requirements, an SRS (Software Requirement Specification) document is created
whereas for coding and implementation, there is a need of more specific and detailed requirements in
software terms. The output of this process can directly be used into implementation in programming
languages.
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.
Architectural Design - The architectural design is the highest abstract version of the system. It
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.
Interface design/High-level Design- The high-level design breaks the ‘single entity-multiple
component’ concept of architectural design into a less-abstracted view of subsystems and
modules and depicts their interaction with each other. High-level design focuses on how the
system along with all of its components can be implemented in forms of modules. It recognizes
the modular structure of each sub-system and their relation and interaction among each other.
Detailed Design- Detailed design deals with the implementation part of what is seen as a system
and its sub-systems in the previous two designs. It is more detailed towards modules and their
implementations. It defines the logical structure of each module and their interfaces to
communicate with other modules.
The software design concept simply means the idea or principle behind the design. It describes how
you plan to solve the problem of designing software, and the logic, or thinking behind how you will
design software. It allows the software engineer to create the model of the system software or product
that is to be developed or built. The software design concept provides a supporting and essential
structure or model for developing the right software.
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 rules of ‘divide and conquer’ problem-solving strategy this
is because there are many other benefits attached with the modular design of a software.
○ Each module is a well-defined system that can be used with other applications.
Advantages of Modularity
○ It encourages the creation of commonly used routines to be placed in the library and used by
other programs.
○ It simplifies the overlay procedure of loading a large program into main storage.
Disadvantages of Modularity
Modular Design
Modular design reduces the design complexity and results in easier and faster implementation by
allowing parallel development of various parts of a system. We discuss a different section of modular
design in detail in this section:
2. Information hiding: The fundamentals of Information hiding suggests that modules can be
characterized by the design decisions that protect from the others, i.e., In other words, modules should
specify that data included within a module is inaccessible to other modules that do not need such
information.
When a software program is modularized, its tasks are divided into several modules based on some
characteristics. As we know, modules are a set of instructions put together in order to achieve some
tasks. They are, though, considered as a single entity but may refer to each other to work together.
There are measures by which the quality of a design of modules and their interaction among them can
be measured. These measures are called coupling and cohesion.
Module Coupling
In software engineering, the coupling is the degree of interdependence between software modules. Two modules
that are tightly coupled are strongly dependent on each other. However, two modules that are loosely coupled
are not dependent on each other. Uncoupled modules have no interdependence at all within them.
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.
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."
2. Sequential Cohesion: A module is said to possess sequential cohesion if the element of a module forms
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 a 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 Cohesion shows the relationship within the
between modules. module.
While creating, you should aim for low While creating you should aim for high
coupling, i.e., dependency among cohesion, i.e., a cohesive component/
modules should be less. module focuses on a single function (i.e.,
single-mindedness) with little interaction
with other modules of the system.
In coupling, modules are linked to the In cohesion, the module focuses on a single
other modules. thing.
Structure Charts
● It is a static system representation, focusing on the structure rather than the process.
● Structure Chart represents the hierarchical structure of modules. It breaks down the entire
system into the lowest functional modules and describes the functions and sub-functions of each
module of a system in greater detail.
● Structure charts are primarily used in top-down modular design and structured programming,
where the system is broken down into manageable modules.
● They help visualize the system’s complexity, making it easier for developers to understand and
manage.
● They also assist in identifying potential issues or bottlenecks in the system’s design.
1. Module
● Jump - An arrow is shown pointing inside the module to depict that the control will jump in the
middle of the sub-module.
● Loop - A curved arrow represents loop in the module. All sub-modules covered by loop repeat
execution of module
.
● 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.
Example
Structure chart for an Email server
Role of structure charts in software engineering
● Structure charts are pivotal in software engineering, aiding in various stages of the software
development lifecycle.
● They are instrumental in system design, where they help visualise the system’s architecture and
divide it into manageable modules.
● Structure charts guide the coding process during the development phase, facilitating efficient
code management.
● Moreover, structure charts are a valuable tool for project management.
● They visually represent the system’s complexity, making it easier for project managers to plan
and allocate resources.
● They also assist in identifying potential issues or bottlenecks, enabling proactive
problem-solving.
Pseudocode
Pseudocode is an informal way of programming description that does not require any strict
programming language syntax or underlying technology considerations. It is used for creating an
outline or a rough draft of a program. Pseudocode summarizes a program’s flow, but excludes
underlying details. System designers write pseudocode to ensure that programmers understand a
software project's requirements and align code accordingly.
A Pseudocode is defined as a step-by-step description of an algorithm. Pseudocode does not use any
programming language in its representation instead it uses the simple English language text as it is
intended for human understanding rather than machine reading.
Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level
language.
transition of the algorithm into the program.
● Use standard programming structures such as if-else, for, while, and cases the way we use them
in programming. Indent the statements if-else, for, while loops as they are indented in a
program, it helps to comprehend the decision control and execution mechanism. It also improves
readability to a great extent.
Example:
IF “1”
print response
“I AM CASE 1”
IF “2”
print response
“I AM CASE 2”
● Use appropriate naming conventions. The human tendency follows the approach of following
what we see. If a programmer goes through a pseudo code, his approach will be the same as per
that, so the naming must be simple and distinct.
● Reserved commands or keywords must be represented in capital letters.
Example: if you are writing IF…ELSE statements then make sure IF and ELSE be in capital
letters.
● Check whether all the sections of a pseudo code are complete, finite, and clear to understand and
comprehend. Also, explain everything that is going to happen in the actual code.
● Don’t write the pseudocode in a programming language. It is necessary that the pseudocode is
simple and easy to understand even for a layman or client, minimizing the use of technical
terms.
Pseudocode Examples:
Example: Given a sorted array Arr[] and a value X, The task is to find the index at which X is present
in Arr[].
Below is the pseudocode for Binary search.
BinarySearch(ARR, X, LOW, HIGH)
repeat till LOW = HIGH
MID = (LOW + HIGH)/2
if (X == ARR[mid])
return MID
else
HIGH = MID – 1
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.
Algorithm Pseudocode
An Algorithm is used to provide a
A Pseudocode is a step-by-step
solution to a particular problem in
description of an algorithm in code-like
form of a well-defined step-based
structure using plain English text.
form.
There are no rules to writing There are certain rules for writing
algorithms pseudocode
A Pseudocode is a step-by-step
A Flowchart is pictorial representation
description of an algorithm in code
of flow of an algorithm.
like structure using plain English text.
This is a way of visually representing These are fake codes as the word
data, these are nothing but the graphical pseudo means fake, using code like
representation of the algorithm for a structure but plain English text
better understanding of the code instead of programming language
Flowchart
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”.
Flowchart symbols
Different types of boxes are used to make flowcharts flowchart Symbols. All the different kinds of
boxes are connected by arrow lines. Arrow lines are used to display the flow of control. Let’s learn
about each box in detail.
Terminal/Terminat
or
Process
Decision
Document
Data or
Input/Output
Stored Data
Flow Arrow
Comment or
Annotation
Predefined process
On-page
connector/referenc
e
Off-page
connector/referenc
e
Types of Flowcharts
Three types of flowcharts are listed below:
1. Process flowchart: This type of flowchart shows all the activities that are involved in
specifically it helps in analyzing the structural details related to the project. Using this
flowchart, one can easily understand the data inflow and outflow from the system. It is most
commonly used to manage data or to analyze information to and fro from the system.
3. Business Process Modeling Diagram: Using this flowchart or diagram, one can analytically
represent the business process and help simplify the concepts needed to understand business
activities and the flow of information. This flowchart illustrates the business process and
models graphically which paves the way for process improvement.
Advantages of Flowchart
● It is the most efficient way of communicating the logic of the system.
● It acts as a guide for a blueprint during the program design.
● It also helps in the debugging process.
● Using flowcharts we can easily analyze the programs.
● flowcharts are good for documentation.
Disadvantages of Flowchart
● Flowcharts are challenging to draw for large and complex programs.
● It does not contain the proper amount of details.
● Flowcharts are very difficult to reproduce.
● Flowcharts are very difficult to modify.
Question 1. Draw a flowchart to find the greatest number among the 2 numbers.
Solution:
Algorithm:
1. Start
2. Input 2 variables from user
3. Now check the condition If a > b, goto step 4, else goto step 5.
4. Print a is greater, goto step 6
5. Print b is greater
6. Stop
FlowChart:
Question 2. Draw a flowchart to check whether the input number is odd or even.