UNIT-3-Design Principles and Methodologies SE
UNIT-3-Design Principles and Methodologies SE
UNIT-3-Design Principles and Methodologies SE
Software Design
Definition
Software design is a process to transform user requirements into some suitable form, which
helps the programmer in software coding and implementation. Software design is the process
by which an agent creates a specification of a software artifact, intended to accomplish
goals, using a set of primitive components and subject to constraints.
A software product is considered a collection of software modules. A module is a part of a
software product which has data and functions together and an interface with other modules to
produce some outcome.
For Example: A banking S/W system consists of various modules like ATM interface, online
transaction, loan management, deposit, and so on. Each of these modules interacts with other modules
to accomplish the banking activities.
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.
Design Principles:
The fundamental concepts or design principles underlining the software design process are:-
1. Abstraction
Abstraction refers to a powerful design tool, which allows software designers to consider
components at an abstract level, while neglecting the implementation details of the
components. IEEE defines abstraction as 'a view of a problem that extracts the
essential information relevant to a particular purpose and ignores the remainder of the
information.'
Each step in the software process is accomplished through various levels of abstraction. At the
highest level, an outline of the solution to the problem is presented whereas at the lower levels, the
solution to the problem is presented in detail.
For example, in the requirements analysis phase, a solution to the problem is presented using
the language of problem environment and as we proceed through the software process, the abstraction
level reduces and at the lowest level, source code of the software is produced.
There are three commonly used abstraction mechanisms in software design namely,
functional abstraction, data abstraction and control abstraction.
i. Functional abstraction: Functional abstraction can be generalized as collections of
subprograms referred to as 'groups'. Within these groups there exist routines which may be
visible or hidden. Visible routines can be used within the containing groups as well as within
other groups, whereas hidden routines are hidden from other groups and can be used within the
containing group only.
ii. Data abstraction: This involves specifying data that describes a data object. For example, the
data object window encompasses a set of attributes (window type, window dimension) that
describe the window object clearly. In this abstraction mechanism, representation and
manipulation details are ignored.
iii. Control abstraction: This states the desired effect, without stating the exact mechanism of
control. For example, if and while statements in programming languages (like C and C++) are
abstractions of machine code implementations, which involve conditional instructions. In the
architectural design level, this abstraction mechanism permits specifications of sequential
subprogram and exception handlers without the concern for exact details of implementation.
2. Architecture
Software architecture refers to the structure of the system, which is composed of various
components of a program/ system, the attributes (properties) of those components and the relationship
amongst them.
The software architecture does the following:-
• Provides an insight to all the interested stakeholders that enable them to communicate with each
other
• Highlights early design decisions, which have great impact on the software engineering activities
(like coding and testing) that follow the design phase
• Creates intellectual models of how the system is organized into components and how these
components interact with each other.
3. Patterns
A pattern provides a description of the solution to a recurring design problem of some specific
domain in such a way that the solution can be used again and again. The objective of each pattern is to
provide an insight to a designer who can determine the following.
i. Whether the pattern can be reused
ii. Whether the pattern is applicable to the current project
iii. Whether the pattern can be used to develop a similar but functionally or structurally different
design pattern.
Types of Design Patterns
i. Architectural patterns: These patterns are high-level strategies that refer to the overall
structure and organization of a software system. i.e., they define the elements of a software
system such as subsystems, components, classes, relationship between the elements along with
the rules and guidelines for specifying these relationships. Note that architectural patterns are
often considered equivalent to software architecture.
ii. Design patterns: These patterns are medium-level strategies that are used to solve design
problems. They provide a means for the refinement of the elements of a software system and
Specific design elements such as relationship among components or mechanisms that affect
component-to- component interaction. Note that design patterns are often considered
equivalent to software components.
iii. Idioms: These patterns are low-level patterns, which are programming-language specific. They
describe the implementation of a software component, the method used for interaction among
software components, etc., in a specific programming language. Note that idioms are often
termed as coding patterns.
iv. Modularity: Modularity is achieved by dividing the software into uniquely named and
addressable components, which are also known as modules. A complex system (large
program) is partitioned into a set of discrete modules in such a way that each module can be
developed independent of other modules. After developing the modules, they are integrated
together to meet the software requirements. Note that larger the number of modules a system is
divided into, greater will be the effort required to integrate the modules.
5. Stepwise Refinement
Stepwise refinement is a top-down design strategy used for decomposing a system from a
high level of abstraction into a more detailed level (lower level) of abstraction. Software designers
start the stepwise refinement process by creating a sequence of compositions for the system being
designed. Each composition is more detailed than the previous one and contains more components
and interactions.
To have a clear understanding of the concept, let us consider an example of stepwise
refinement. Every computer program comprises input, process, and output.
1. INPUT
• Get user's name (string) through a prompt.
• Get user's grade (integer from 0 to 100) through a prompt and validate.
2. PROCESS
3. OUTPUT
This is the first step in refinement. The input phase can be refined further as given here.
1. INPUT
o Get user's name through a prompt.
o Get user's grade through a prompt.
o While (invalid grade) Ask again:
2. PROCESS
3. OUTPUT
Note: Stepwise refinement can also be performed for PROCESS and OUTPUT phase.
6. Refactoring
Refactoring is an important design activity that reduces the complexity of module design
keeping its behaviour or function unchanged. Refactoring can be defined as a process of modifying a
software system to improve the internal structure of design without changing its external behavior.
During the refactoring process, the existing design is checked for any type of flaws like redundancy,
poorly constructed algorithms and data structures, etc., in order to improve the design.
For example, a design model might yield a component which exhibits low cohesion (like a
component performs four functions that have a limited relationship with one another). Software
designers may decide to refactor the component into four different components, each exhibiting high
cohesion. This leads to easier integration, testing, and maintenance of the software components.
7. Structural Partitioning
When the architectural style of a design follows a hierarchical nature, the structure of the
program can be partitioned either horizontally or vertically. Structural partitioning provides the
following benefits.
• The testing and maintenance of software becomes easier.
• The negative impacts spread slowly.
• The software can be extended easily.
In horizontal partitioning, the control modules are used to communicate between functions
and execute the functions.
In vertical partitioning, the functionality is distributed among the modules--in a top-down
manner.
The modules at the top level called control modules perform the decision-making and do
little processing whereas the modules at the low level called worker modules perform all input,
computation and output tasks.
8. Concurrency
Computer has limited resources and they must be utilized efficiently as much as possible. To
utilize these resources efficiently, multiple tasks must be executed concurrently. Every system must
be designed to allow multiple processes to execute concurrently, whenever possible.
For example, if the current process is waiting for some event to occur, the system must
execute some other process in the mean time.
However, concurrent execution of multiple processes sometimes may result in undesirable
situations such as an inconsistent state, deadlock, etc. Thus, the system must control the concurrent
execution and synchronize the actions of concurrent processes. One way to achieve synchronization is
mutual exclusion, which ensures that two concurrent processes do not interfere with the actions of
each other.
In software design, concurrency is implemented by splitting the software into multiple independent units
of execution, like modules and executing them in parallel. In other words, concurrency provides
capability to the software to execute more than one part of code in parallel to each other.
Example
The spell check feature in word processor is a module of software, which runs along side the word
processor itself.
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. A modular design focuses on
minimizing the interconnection between the modules. The most common criterions are functional
independency; levels of abstraction; information hiding; functional diagrams, such as DFD, modular
programming languages, coupling, and cohesion. An effective modular system has low coupling and
high cohesion. So, coupling and cohesion are most popular criterions used to measure the
modularity in a system. The primary characteristics of neat module decomposition are high cohesion
and low coupling.
1. Coupling:
Coupling between two modules is a measure that defines the degree of interdependence or
interaction between the modules of a program. A module having high cohesion and low coupling is
said to be functionally independent of other modules. If two modules interchange large amounts of
data, then they are highly interdependent.
The degree of coupling between two modules depends on their interface complexity. The
interface complexity is basically determined by the number of types of parameters that are
interchanged while invoking the functions of the module. Module coupling can be Tightly or Loosely
coupled based on the dependencies. The lower the coupling, the better the program.
2. Cohesion
Cohesion is a measure that defines the degree of intra-dependability within elements of a
module. A good software design implies clean decomposition of the problem into modules, and the
neat arrangement of these modules in a hierarchy. The greater the cohesion, the better is the program
design.
Cohesion is a measure of functional strength of a module. A module having high cohesion and
low coupling is said to be functionally independent of other modules. By the term functional
independence, we mean that a cohesive module performs a single task or function. A functionally
independent module has minimal interaction with other modules.
Classification of cohesion:
The different classes of cohesion that a module may possess are depicted in fig. given below:
COHESION COUPLING
Cohesion is the concept of intra module. Coupling is the concept of inter module.
Cohesion represents the relationship within Coupling represents the relationships between
Highly cohesive gives the best software. Where as loosely coupling gives the best
In cohesion, module focuses on the single In coupling, modules are connected to the other
Design Methodologies:
A Design methodology provides the techniques and guidelines for the design process of a
system. There are different design processes for different design methodologies. The goal of all
design methodologies is to produce a design for the solution of a system. A design process consists of
various design activities. The most popular design methodologies are:
1) Function Oriented Design
2) Object Oriented Design
The following are the salient features of a typical function-oriented design approach:
i. A system is viewed 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.
For example, consider a function create-new library-member which essentially
creates the record for a new member, assigns a unique membership number to him, and prints a bill
towards his membership charge. This function may consist of the following sub functions:
• Assign-membership-number
• Create-member-record
• Print-bill
Each of these sub-functions may be split into more detailed sub functions and so on.
ii. The system state is centralized and shared among different functions, e.g. data such as member-
records is available for reference and updation to several functions such as:
• Create-new-member
• Delete-member
• Update-member-record
To illustrate the differences between the object-oriented and the function-oriented design approaches,
an example can be considered.
Example: Fire-Alarm System
The owner of a large multi-stored building wants to have a computerized fire alarm system for his
building. Smoke detectors and fire alarms would be placed in each room of the building. The fire
alarm system would monitor the status of these smoke detectors. Whenever a fire condition is
reported by any of the smoke detectors, the fire alarm system should determine the location at which
the fire condition is reported by any of the smoke detectors, the fire alarm system should determine
the location at which the fire condition has occurred and then sound the alarms only in the
neighbouring locations. The fire alarm system should also flash an alarm message on the computer
console. After a fire condition has been successfully handled, the fire alarm system should support
resetting the alarms by the fire fighting personnel.
In the function-oriented program, the system state is centralized and several functions accessing
this central data are defined.
In the object oriented program, an appropriate number of instances of the class detector and alarm
should be created. In case of the object-oriented program, the state information is distributed among
various sensor and alarm objects.
Software design process can be perceived as series of well-defined steps. Though it varies according
to design approach (function oriented or object oriented, yet it may have the following steps involved:
• A solution design is created from requirements or previously used system and/or system sequence
diagram.
• Objects are identified and grouped into classes on behalf of similarity in attribute characteristics.
• Class hierarchy and relation among them is defined.
• Application framework is defined.
Bottom-up Design
The bottom up design model starts with most specific and basic components. It proceeds with
composing higher level of components by using basic or lower level components. It keeps creating
higher level components until the desired system is not evolved as one single component. With each
higher level, the amount of abstraction is increased.
Bottom-up strategy is more suitable when a system needs to be created from some existing system,
where the basic primitives can be used in the newer system.