Software Design
Software Design
Software Design
Software Design
Introduction of Unit:
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.
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.
3. Components: This provides a particular function or group of related functions. They
are made up of modules.
4. Interfaces: This is the shared boundary across which the components of a system
exchange information and relate.
5. Data: This is the management of the information and data flow.
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
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.
Interface design should include the following details:
1. Precise description of events in the environment, or messages from agents to which the
system must respond.
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.
4. Specification of the ordering and timing relationships between incoming events or
messages, and outgoing events or outputs.
Objective: The primary goal of architectural design is to define the system's architecture and the
main components that will be developed. This stage focuses on the overall structure rather than
the specifics of implementation.
In architectural design, the overall structure of the system is chosen, but the internal details of
major components are ignored. Issues in architectural design includes:
1. Gross decomposition of the systems into major components.
2. Allocation of functional responsibilities to components.
3. Component Interfaces.
4. Component scaling and performance properties, resource consumption properties,
reliability properties, and so forth.
5. Communication and interaction between components.
Activities:
1. Architectural Design: Identify the major components of the system and their interactions. This
includes defining subsystems, modules, and their relationships.
2. Component Decomposition: Break down the system into smaller, more manageable parts or
components.
3. Data Design: Define the data structures and database design that will be used to store and
manage data.
4. Interface Design: Specify the interfaces between the system components, including how they
will communicate and interact.
5. Technology Selection: Choose the technologies, frameworks, and platforms that will be used
to implement the system.
Outputs:
Architecture Diagrams: Visual representations of the system's structure and components.
Component Specifications: Descriptions of the components, their responsibilities, and
interactions.
Data Models: Diagrams and descriptions of the data structures and databases.
Interface Specifications: Detailed descriptions of the interfaces between components.
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.
Objective: The goal of detailed design is to refine the high-level design into a detailed blueprint
for implementation. This stage focuses on the specifics of how each component will be built.
The detailed design may include:
1. Decomposition of major system components into program units.
2. Allocation of functional responsibilities to units.
3. User interfaces.
4. Unit states and state changes.
5. Data and control interaction between units.
6. Data packaging and implementation, including issues of scope and visibility of program
elements.
7. Algorithms and data structures.
Activities:
1. Algorithm Design: Develop algorithms and detailed logic for the functions and methods
within each component.
2. Data Structure Design: Specify the exact data structures to be used within the components.
3. Component Design: Define the internal structure of each component, including classes,
methods, and their interactions.
4. Interface Design: Further refine the interfaces, detailing the methods, parameters, and return
values.
5. Error Handling and Exceptions: Define how the system will handle errors and exceptional
conditions.
Outputs:
Detailed Class Diagrams: Diagrams showing the classes, their attributes, methods, and
relationships.
Pseudo Code or Flowcharts: Detailed representations of the algorithms and logic.
Detailed Interface Descriptions: Comprehensive descriptions of the interfaces with method
signatures and protocols.
Error Handling Specifications: Guidelines and mechanisms for handling errors and exceptions.
By dividing the design process into these two stages, software engineers can ensure that the
system is well-structured, maintainable, and scalable. High-level design allows for a clear
understanding of the system's architecture, while detailed design ensures that each component is
thoroughly planned and ready for implementation.
Cohesion:
Cohesion in software engineering refers to the degree to which the responsibilities of a single
module are related & focussed.
It measures how strongly the internal elements of a module are connected & work together to
achieve a common purpose.
High cohesion in software engineering promotes reusability, maintainability, and
understandability of the code.
The higher the degree of cohesion, better the quality of the software.
Cohesion in software engineering refers to the degree to which the elements inside a
module/components belong together, directed towards performing a single task.
In simple words, it is the degree to which the elements of the module are functionally related.
A module with high cohesion encompasses elements tightly related to each other and united in
their purpose.
But, a module is said to have low cohesion if it contains unrelated elements, and if the module
has all related elements, it is considered to have high cohesion.
A good software design will have high cohesion.
The concept of cohesion is closely related to the Single Responsibility Principle, where a class
should only have one responsibility or should perform a single task.
The modules following the SRP are likely to have high cohesion as they are meant to perform a
single task in the software.
2. Sequential Cohesion:
Sequential cohesion occurs when the elements within a module are arranged in a specific
sequence, with the output of one element serves as the input for the next element.
The elements are executed in a step-by-step manner to achieve a particular functionality.
Examples - cross-validated records and formatting of a module, raw records usage, formatting of
raw records, cross-validation of fields in raw records, etc.
3. Communicational Cohesion:
Communicational cohesion is anohter one of the types of cohesion in software engineering
occurs when the elements within a module operate on the same input data or share data through
parameters.
The elements within the module work together by passing data to each other.
It is weaker than sequential cohesion.
Example - usage of a customer account number, finding the name of the customer, the loan
balance of the customer, etc.
4. Procedural Cohesion
Procedural cohesion occurs when the elements within a module are grouped based on a specific
sequence of actions or steps.
This type of cohesion is weaker than the communicational cohesion.
Examples - Read, write, edit of the module, zero padding to the numeric fields, returning records,
etc.
5. Temporal Cohesion
Temporal cohesion occurs when the elements within a module are executed at the same time or
within the same timeframe.
It is considered weaker than the procedural cohesion.
Examples - Setting the counter to zero, opening the student file, clearing the variables of error
messages, initializing the array, etc.
6. Logical Cohesion
Logical cohesion occurs when the elements within a module are logically related, but do not fit
into any other cohesion types.
It is not strong as other cohesion types.
Examples - When a component reads inputs from tape, disk, and network, etc.
7. Coincidental Cohesion
Coincidental cohesion occurs when the elements are not related to each other.
Examples - Module for miscellaneous functions, customer record usage, displaying of customer
records, calculation of total sales, and reading the transaction record, etc.
Coupling
Coupling in software engineering refers to the degree of interdependence between two or more
modules in a system.
It measures how closely the modules are connected & how much they rely on each other.
Low Coupling in software engineering promotes independence, modularity, and flexibility of the
code.
The lower the degree of coupling, better the quality of the software.
Coupling in software engineering refers to the degree of interdependence & connection between
modules or components within a software system.
Two modules are said to have high coupling if they are closely connected.
In simple words, coupling is not just about modules, but the connection between modules and the
degree of interaction or interdependence between the two modules. If two modules contain a
good amount of data, then they are highly interdependent.
If the connection between components is strong, we speak about strongly coupled modules;
when the connection is weak, we speak about the loosely coupled modules.
Different types of Coupling in software engineering?
Here are the 6 types of coupling in software engineering:
1. Data Coupling
Data coupling is a type of coupling in software engineering that occurs when modules share data
through parameters or arguments.
Each module maintains its own data and does not exactly access or modify the data of other
modules.
This type of coupling promotes encapsulation & module interdependence.
2. Stamp Coupling
Stamp coupling is a weaker form of coupling where modules share a composite data structure,
but not all the elements are used by each module.
As the data and elements are pre-organized and well-placed beforehand, no junk or unused data
is shared or passed between the two coupling modules which improves the efficiency of the
modules.
3. Control Coupling
Control coupling is one of the types of coupling in software engineering occurs when one
module controls the behavior of another module.
This type of coupling implies that one module has knowledge of internal workings & decisions
or another module, that makes the code more difficult to maintain.
4. External Coupling
External coupling measures the degree to which the system relies on external entities to fulfill its
functionality or interact with the external environment.
Low external coupling - Changes in the external entities have little impact on internal
implementation of the system.
Medium external coupling - Changes in the external entities require some modifications within
the system to accomodate new interfaces.
High external coupling - Changes in the external entities have a substantial impact on internal
implementation of the system, requiring extensive modifications.
5. Common Coupling
Common coupling occurs when two or more modules in the system share global data.
The modules can access & manipulate the same global variables & the data structures.
6. Content Coupling
Content coupling is another type of coupling in software engineering that occurs when one
module directly accesses or modifies the content of another module.
This type of coupling is strong & undesirable since it tightly couples the modules, making them
highly independent on each other's implementation.
Design Notations
Design Notations are primarily meant to be used during the process of design and are used to
represent design or design decisions. For a function-oriented design, the design can be
represented graphically or mathematically by the following:
Data Flow Diagram
Data-flow design is concerned with designing a series of functional transformations that convert
system inputs into the required outputs. The design is described as data-flow diagrams. These
diagrams show how data flows through a system and how the output is derived from the input
through a series of functional transformations.
Data-flow diagrams are a useful and intuitive way of describing a system. They are generally
understandable without specialized training, notably if control information is excluded. They
show end-to-end processing. That is the flow of processing from when data enters the system to
where it leaves the system can be traced.
Data-flow design is an integral part of several design methods, and most CASE tools support
data-flow diagram creation. Different ways may use different icons to represent data-flow
diagram entities, but their meanings are similar.
For the smallest units of data elements, the data dictionary lists their name and their type.
A data dictionary plays a significant role in any software development process because of the
following reasons:
o A Data dictionary provides a standard language for all relevant information for use by
engineers working in a project. A consistent vocabulary for data items is essential since, in large
projects, different engineers of the project tend to use different terms to refer to the same data,
which unnecessarily causes confusion.
o The data dictionary provides the analyst with a means to determine the definition of
various data structures in terms of their component elements.
o
Structured Charts
It partitions a system into block boxes. A Black box system that functionality is known to the
user without the knowledge of internal design.
Pseudo-code
Pseudo-code notations can be used in both the preliminary and detailed design phases. Using
pseudo-code, the designer describes system characteristics using short, concise, English
Language phases that are structured by keywords such as If-Then-Else, While-Do, and End.
Importance of SA/AD
If you are trying to build a system or upgrade a system then system Analysis and Design is kind
of the backbone of it. This is a kind of layout of the whole system.let’s list of some of them.
To improve the quality of the system and thus reducing the occurrences of error in the
system. By analysing the problem definitely errors can be reduced.
To manage and to make the flow of the system it is really helpful.
Software development is a process that involves architecture, database and backend
development etc, this is what we call analysis which is required to design good software.
Works in the longer run. The analysis helps in keeping in mind to build such a system
Structured Analysis and Structured Design (SA/SD) comprises the following 2 phases:
1. Analysis Phase
2. Design Phase
Analysis Phase
The phase uses diagrammatic system representations using Data Flow Diagram(DFDs), Data
Dictionary, State Transition, and ER diagrams. The analysis phase enables the analyst to
logically comprehend the system and its operations. Here, the system development process
makes use of a variety of tools and methods. It makes use of graphical tools to examine and
improve the goals of an existing system and create a new system definition that the user can
readily comprehend.
1. Data Flow Diagram: In a DFD model, describe how the data flows through the system. It is a
hierarchical graphical model that mainly shows the system’s different functions (or processes)
and the data interchange among the methods.
It is helpful to consider each function as a processing station such that each function consumes
some input data and produces some output data.
The Data Flow diagram Symbols used here, hold the following meaning ->
A directed arc or line here represents data flow in the direction of the arrow where data flow
symbols are annotated with names of the data that they carry.
The Data Store Symbol here represents a logical file that can either be a Data Structure or a
physical file on a disk. Each data store is connected to a process with the help of a data flow
symbol.
The direction of the data flow arrow shows whether data is being read from
or written into it. An arrow into or out of a data store implicitly represents the entire data
whereas the arrows connecting to a data store need not be annotated with any data name.
2. Data Dictionary: A DFD is always accompanied by a data dictionary. A data dictionary lists
all data items appearing in a DFD defining data stores and their relevant meaning.
3. State Transition Diagram: The State Transition Diagram is similar to the Dynamic model. It
specifies how much time the function will take to execute and data access triggered by the
various events involved.
The State Transition diagram Symbols used here, hold the following meaning:
4. ER Diagram: This is a graphical representation of the data layout of a system at a high level
of abstraction that defines data elements and their inter-relationships in the design and the
relationship between data stores.
Design Phase
Involves the use of a Structure Chart and Pseudo Code to model a system. The high level design
or software architecture for the specified problem is another name for this design phase. The goal
of phase design is to specify the solution's structure so that it may be put into practise.
1. Structure Chart: It is created and defined by the DFD. The structure Chart specifies how a
DFD’s processes are grouped into tasks and allocated to CPU’s or other such relative systems.
2. Pseudo Code: It is the actual implementation of the system showing the process specifications
and implied details but not shown in a DFD.
The origins of using a Structured Analysis and Structured Design (SA/SD) approach
Structured Analysis and Structured Design (SA/SD) has a history from way back in the late
1970s modeled by DeMarco, Yourdon, and Constantine after the emergence of the well-known
paradigm of modern structured programming. IBM was the first to incorporate Structured
Analysis and Structured Design (SA/SD) into its development cycle in the late 1970s and early
1980s.
In contrast, people modified the classical Structured Analysis and Structured Design (SA/SD)
due to their inability to represent real-time systems. In 1989, Yourdon came up with another
published version of the methodology with a graphical approach known as “Modern Structured
Analysis”.
The availability of CASE tools in the 1990s enabled many analysts to develop and modify the
graphical Structured Analysis and Structured Design (SA/SD) models. Using this model,
analysts attempted to divide a significant, complex problem into smaller, more easily handled
ones using a “Divide and Conquer”, “Top-Down approach” (Classical SA), or “Middle-Out”
(Modern SA).
Analysts used leverage graphics to illustrate their ideas whenever possible to depict a functional
view of the problem and maintain relevant written records.
Architectural Design
For the program to represent software design, architectural design is required. "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" is how the IEEE defines architectural
design. The following tasks are carried out by an architectural design. One of these numerous
architectural styles can be seen in software designed for computer-based systems.
Interface design
The user interface is the front-end application view to which the user interacts to use the
software. The software becomes more popular if its user interface is:
Attractive
Simple to use
Responsive in a short time
Clear to understand
Consistent on all interface screens
UI Design Stages
1. User, Task, Environmental Analysis, and Modeling
Initially, the focus is based on the profile of users who will interact with the system, i.e.,
understanding, skill and knowledge, type of user, etc., based on the user’s profile users are
made into categories. From each category requirements are gathered. Based on the
requirement’s developer understand how to develop the interface. Once all the requirements
are gathered a detailed analysis is conducted. In the analysis part, the tasks that the user
performs to establish the goals of the system are identified, described and elaborated. The
analysis of the user environment focuses on the physical work environment. Among the
questions to be asked are:
Where will the interface be located physically?
Will the user be sitting, standing, or performing other tasks unrelated to the interface?
Does the interface hardware accommodate space, light, or noise constraints?
Are there special human factors considerations driven by environmental factors?
2. Interface Design
The goal of this phase is to define the set of interface objects and actions i.e., control
mechanisms that enable the user to perform desired tasks. Indicate how these control
mechanisms affect the system. Specify the action sequence of tasks and subtasks, also called a
user scenario. Indicate the state of the system when the user performs a particular task. Always
follow the three golden rules stated by Theo Mandel. Design issues such as response time,
command and action structure, error handling, and help facilities are considered as the design
model is refined. This phase serves as the foundation for the implementation phase.
4. Interface Validation
This phase focuses on testing the interface. The interface should be in such a way that it should
be able to perform tasks correctly, and it should be able to handle a variety of tasks. It should
achieve all the user’s requirements. It should be easy to use and easy to learn. Users should
accept the interface as a useful one in their work.
Define the interaction modes in such a way that does not force the user into unnecessary
or undesired actions: The user should be able to easily enter and exit the mode with little or
no effort.
Provide for flexible interaction: Different people will use different interaction mechanisms,
some might use keyboard commands, some might use mouse, some might use touch screen,
etc., Hence all interaction mechanisms should be provided.
Allow user interaction to be interruptible and undoable: When a user is doing a sequence
of actions the user must be able to interrupt the sequence to do some other work without losing
the work that had been done. The user should also be able to do undo operation.
Streamline interaction as skill level advances and allow the interaction to be
customized: Advanced or highly skilled user should be provided a chance to customize the
interface as user wants which allows different interaction mechanisms so that user doesn’t feel
bored while using the same interaction mechanism.
Hide technical internals from casual users: The user should not be aware of the internal
technical details of the system. He should interact with the interface just to do his work.
Design for direct interaction with objects that appear on-screen: The user should be able to
use the objects and manipulate the objects that are present on the screen to perform a necessary
task. By this, the user feels easy to control over the screen.
Component-Level Design
1. Component Identification: Identify the components needed for the system based on the
architectural design. Components can be classes, objects, functions, or a combination of these.
2. Interface Design: Define the interfaces for each component, specifying how they interact
with other components. This includes method signatures, input/output parameters, and any
events or messages exchanged.
3. Detailed Design: Provide detailed descriptions of the internal workings of each component.
Include algorithms, data structures, and any internal processing details.
4. Design for Reusability: Design components to be reusable across different parts of the
application or in future projects. Use design patterns and principles such as modularity, low
coupling, and high cohesion.
5. Design for Maintainability: Ensure the design facilitates easy maintenance and updates. Use
clear, consistent naming conventions and comprehensive documentation.
6. Error Handling and Security: Incorporate error handling mechanisms and security measures
within components. Ensure components are robust and can handle unexpected inputs gracefully.
Steps in Component-Level Design
1. Decompose the System: Break down the system into smaller, manageable components based
on the system's requirements and architecture.
2. Define Component Interfaces: Specify the interfaces for each component, including public
methods, properties, and events.
3. Design Component Logic: Detail the internal logic of each component, including control
flow and data manipulation.
4. Document the Design: Create comprehensive documentation for each component, detailing
its purpose, interfaces, and internal logic.
5. Review and Refine: Conduct design reviews to identify potential issues and areas for
improvement. Refine the design based on feedback and testing results.
2. Design Reuse: Reusing design patterns, templates, and frameworks. Helps maintain
consistency and standardization across projects.
4. Documentation Reuse: Reusing user manuals, API documentation, and other forms of
documentation. Saves time and ensures consistency in how information is communicated.
Improved Quality: Reused components are often well-tested and proven in previous projects,
reducing the likelihood of defects.
Reduced Costs: Saves development time and resources, leading to lower overall project costs.
Integration Issues: Integrating reused components with new systems can present compatibility
and dependency challenges.
Maintenance of Reused Components: Ensuring that reused components are updated and
maintained properly can be resource-intensive.
Intellectual Property Concerns: Ensuring legal compliance and respecting intellectual property
rights when reusing software assets.
Software Maintenance
Software maintenance involves modifying and updating software after its initial deployment.
This is necessary to correct faults, improve performance, or adapt the software to a changed
environment.
Regression Testing: Ensuring that changes do not introduce new bugs requires extensive
testing, which can be time-consuming and costly.
Cost: Maintenance can be costly, often consuming more resources than initial development.
Balancing maintenance costs with the need for new development is a common challenge.
Technical Debt: Accumulating quick fixes and shortcuts can lead to technical debt, making
future maintenance harder and more expensive.
Skill Requirements: Maintenance requires a deep understanding of the existing system, which
means that skilled and experienced developers are essential.
Automated Testing: Implementing automated regression tests ensures that changes do not
introduce new issues.
Version Control: Using version control systems to manage changes helps track modifications
and collaborate effectively.
Refactoring: Regularly refactoring code to improve its structure and readability reduces
maintenance complexity.
Code Reviews: Conducting code reviews helps catch potential issues early and ensures
adherence to coding standards.