Unit 4 Software Design-1
Unit 4 Software Design-1
Software design is a mechanism to transform user requirements into some suitable form,
which helps the programmer in software coding and implementation. It deals with
representing the client's requirement, as described in SRS (Software Requirement
Specification) document, into a form, i.e., easily implementable using programming language.
The software design phase is the first step in SDLC (Software Design Life Cycle), which moves
the concentration from the problem domain to the solution domain. In software design, we
consider the system to be a set of components or modules with clearly defined behaviors &
boundaries.
2. Completeness: The design should have all components like data structures, modules,
and external interfaces, etc.
The design phase of software development deals with transforming the customer
requirements as described in the SRS documents into a form implementable using a
programming language. The software design process can be divided into the following three
levels or phases of design:
1. Interface Design
2. Architectural Design
3. Detailed Design
Elements of a System
1. Architecture: This is the conceptual model that defines the structure, behavior, and
views of a system. We can use flowcharts to represent and illustrate the architecture.
2. Modules: These are components that handle one specific task in a system. A
combination of the modules makes up the system.
4. Interfaces: This is the shared boundary across which the components of a system
exchange information and relate.
Interface Design
Interface design is the specification of the interaction between a system and its environment.
This phase proceeds at a high level of abstraction with respect to the inner workings of the
system i.e, during interface design, the internal of the systems are completely ignored, and
the system is treated as a black box. Attention is focused on the dialogue between the target
system and the users, devices, and other systems with which it interacts. The design problem
statement produced during the problem analysis step should identify the people, other
systems, and devices which are collectively called agents.
2. Precise description of the events or messages that the system must produce.
3. Specification of the data, and the formats of the data coming into and going out of the
system.
Architectural Design
3. Component Interfaces.
The architectural design adds important details ignored during the interface design. Design of
the internals of the major components is ignored until the last phase of the design.
Detailed Design
Detailed design is the specification of the internal elements of all major system components,
their properties, relationships, processing, and often their algorithms and the data structures.
The detailed design may include:
3. User interfaces.
6. Data packaging and implementation, including issues of scope and visibility of program
elements.
Problem Partitioning
For small problem, we can handle the entire problem at once but for the significant problem,
divide the problems and conquer the problem it means to divide the problem into smaller
pieces so that each piece can be captured separately.
For software design, the goal is to divide the problem into manageable pieces.
Abstraction
1. Functional Abstraction
2. Data Abstraction
Functional Abstraction
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
Modularity specifies to the division of software into separate modules which are differently
named and addressed and are integrated later on in to obtain the completely functional
software. It is the only property that allows a program to be intellectually manageable. Single
large programs are difficult to understand and read due to a large number of reference
variables, control paths, global variables, etc.
o Each module is a well-defined system that can be used with other applications.
Advantages of Modularity
o It encourages the creation of commonly used routines to be placed in the library and
used by other programs.
o It simplifies the overlay procedure of loading a large program into main storage.
Disadvantages of Modularity
o More linkage required, run-time may be longer, more source lines must be written,
and more documentation has to be done
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 fundamental 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 be specified that data include within a module is inaccessible to other
modules that do not need for such information.
The use of information hiding as design criteria for modular system provides the most
significant benefits when modifications are required during testing's and later during software
maintenance. This is because as most data and procedures are hidden from other parts of the
software, inadvertent errors introduced during modifications are less likely to propagate to
different locations within the software.
Strategy of Design
A good system design strategy is to organize the program modules in such a method that are
easy to develop and latter too, change. Structured design methods help developers to deal
with the size and complexity of programs. Analysts generate instructions for the developers
about how code should be composed and how pieces of code should fit together to form a
program.
1. Top-down Approach
2. Bottom-up Approach
1. Top-down Approach: This approach starts with the identification of the main components
and then decomposing them into their more detailed sub-components.
2. Bottom-up Approach: A bottom-up approach begins with the lower details and moves
towards up the hierarchy, as shown in fig. This approach is suitable in case of an existing
system.
Coupling and Cohesion
When a software program is modularized, its tasks are divided into several modules based on
some characteristics. As we know, modules are set of instructions put together in order to
achieve some tasks. They are though, considered as 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.
• Cohesion: A module for book operations (e.g., adding, updating, and removing books)
should exhibit functional cohesion as it performs closely related tasks. If the module
also handles user authentication, then it would have low cohesion because it mixes
unrelated functionalities.
• Coupling: If the book module calls the user authentication module and passes only
necessary data (e.g., user ID), it has data coupling (low coupling). If the book module
directly accesses and modifies variables inside the user authentication module, it
would exhibit content coupling (high coupling).
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.
• Logical cohesion - When logically categorized elements are put together into a
module, it is called logical cohesion.
• Temporal Cohesion - When elements of module are organized such that they are
processed at a similar point in 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.
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.
• 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 Verification
The output of software design process is design documentation, pseudo codes, detailed logic
diagrams, process diagrams, and detailed description of all functional or non-functional
requirements.
The next phase, which is the implementation of software, depends on all outputs mentioned
above.
It is then becomes necessary to verify the output before proceeding to the next phase. The
early any mistake is detected, the better it is or it might not be detected until testing of the
product. If the outputs of design phase are in formal notation form, then their associated tools
for verification should be used otherwise a thorough design review can be used for verification
and validation.
By structured verification approach, reviewers can detect defects that might be caused by
overlooking some conditions. A good design review is important for good software design,
accuracy and quality.
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.
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.
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.
The software needs an architectural design to represent the design of the 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.” The software that is built for computer-based systems can exhibit one of
these many architectural styles.
• Conditions that defines how components can be integrated to form the system.
• Semantic models that help the designer to understand the overall properties of the
system.
The use of architectural styles is to establish a structure for all the components of the system.
• A data store will reside at the center of this architecture and is accessed frequently by
the other components that update, add, delete, or modify the data present within the
store.
• The figure illustrates a typical data-centered style. The client software accesses a
central repository. Variations of this approach are used to transform the repository
into a blackboard when data related to the client or data of interest for the client
change the notifications to client software.
• This data-centered architecture will promote integrability. This means that the existing
components can be changed and new client components can be added to the
architecture without the permission or concern of other clients.
• This kind of architecture is used when input data is transformed into output data
through a series of computational manipulative components.
• The figure represents pipe-and-filter architecture since it uses both pipe and filter and
it has a set of components called filters connected by lines.
• Pipes are used to transmitting 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.
• If the data flow degenerates into a single line of transforms, then it is termed as batch
sequential. This structure accepts the batch of data and then applies a series of
sequential components to transform it.
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.
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.
Characteristics of Object Oriented architecture:
• Other objects are aware of the implementation details of the object, allowing changes
to be made without having an impact on other objects.
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)
Layered architecture
Data Architectural and Procedural Design and Design Documentation are essential
components in the software design and development process. These aspects help ensure that
the system's structure and processes are well-planned, clearly defined, and communicated to
all stakeholders. Below is an explanation of these concepts:
• Definition: Data architectural design refers to the organization and structure of data
within a system, focusing on how data is collected, stored, managed, and utilized.
• Purpose: It provides a blueprint for managing data that aligns with business goals,
ensuring data quality, consistency, and security.
• Components:
o Data Models: Diagrams and schemas that represent data entities and their
relationships, such as ER (Entity-Relationship) diagrams.
o Data Storage Solutions: Decisions about databases (SQL vs. NoSQL), data
warehousing, data lakes, and cloud-based storage.
o Data Flow: How data moves within the system, represented through data flow
diagrams (DFDs).
o Data Integration: Processes for merging data from multiple sources and
ensuring data consistency.
2. Procedural Design
Procedural Design in software engineering refers to the detailed blueprint that outlines the
sequence of operations or steps needed to perform specific tasks within a system. It focuses
on defining how the system's functionality will be implemented through structured
procedures, ensuring that the processes are efficient and logically sound.
1. Algorithms: At the core of procedural design are algorithms, which provide step-by-
step instructions for specific tasks. Algorithms guide how data is processed and how
operations are executed in a sequence.
2. Modular Structure: Procedural design often breaks down complex tasks into smaller,
manageable functions or modules. Each module is designed to perform a specific part
of the overall task, promoting code reusability and maintainability.
3. Control Structures:
o Sequence: A straightforward execution of statements in the order they appear.
o Selection: Conditional statements such as if, else if, and switch that allow the
program to make decisions.
o Iteration: Loops like for, while, and do-while that repeat code until a condition
is met.
5. Data Handling: This includes reading inputs, processing them according to the defined
logic, and producing outputs. Proper handling ensures data is manipulated efficiently
and accurately.
1. Define the Problem: Clearly understand what the system needs to achieve and break
down the task into smaller objectives.
2. Design the Algorithm: Create an algorithm that outlines the steps to complete each
task.
3. Choose Control Structures: Identify which control structures (loops, conditionals, etc.)
are needed to guide the logic flow.
4. Divide into Modules: Break down the overall process into smaller, reusable modules
or functions.
6. Review and Refine: Test the design on paper or with peers to identify potential issues
or inefficiencies before actual implementation.
Consider a simple bank account management system that includes a procedure for handling
a withdrawal request:
• Algorithm:
Pseudocode:
START
Input user authentication details
IF authentication is successful THEN
Input withdrawal amount
IF account balance >= withdrawal amount THEN
Deduct withdrawal amount from account balance
Log the transaction
Display updated balance
ELSE
Display "Insufficient balance"
ENDIF
ELSE
Display "Authentication failed"
ENDIF
END
• Improved Clarity: Outlines the exact steps required, making it easier for developers to
write and maintain code.
• Reusability: Modular design allows the reuse of procedures in different parts of the
application or in other projects.
• Small and Medium-Sized Projects: Ideal for applications where procedural, step-by-
step logic is needed.
• Routine Operations: Used in scripts, automation tools, and utility programs where
tasks need a defined sequence of operations.
• Embedded Systems: Useful for software that runs on devices with limited functions
and where specific sequences of actions are essential (e.g., ATMs, traffic light systems).
3. Design Documentation
1. Overview Document:
o Includes the purpose of the project, target audience, and expected outcomes.
o Often presented with class diagrams, sequence diagrams, and state diagrams
to clarify design choices.
o Details the structure of data within the system, including database design, data
models, and relationships between data entities.
o Describes the testing strategy and approach for validating the system’s
functionality.
o Outlines test cases, testing methods (unit testing, integration testing, etc.), and
expected results.
• Risk Mitigation: Helps identify potential issues and risks early in the development
process, allowing for proactive management and adjustments.
1. Keep it Updated: Design documents should be living documents that are regularly
updated to reflect changes in the design or requirements.
3. Be Clear and Concise: Use clear language and avoid jargon where possible to ensure
that documents are understandable to all stakeholders.