Unit 2
Unit 2
Unit 2
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.
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
An abstraction is a tool that enables a designer to consider a component at an
abstract level without bothering about the internal details of the implementation.
Abstraction can be used for existing element as well as the component being
designed.
1. Functional Abstraction
2. Data 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.
AD
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.
o Each module has single specified objectives.
o Modules can be separately compiled and saved in the library.
o Modules should be easier to use than to build.
o Modules are simpler from outside than inside.
Advantages and Disadvantages of Modularity
Advantages of Modularity
AD
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:
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.
AD
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.
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.
Architectural Design
Architectural design is the specification of the major components of a system, their
responsibilities, properties, interfaces, and the relationships and interactions between
them. 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.
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
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:
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.
3. **Scalability and Flexibility**: Patterns encourage designs that are flexible and
scalable. They provide guidelines for creating software components that can evolve
and adapt to changing requirements without significant rework.
**Definition**:
**Key Characteristics**:
- **Examples**:
- **Client-Server**: Divides the system into two major components: clients
(requesters of services) and servers (providers of services).
- **Layered (n-tier)**: Organizes the system into layers, each with specific
responsibilities, promoting separation of concerns.
**Definition**:
**Key Characteristics**:
- **Scope**: More detailed and specific than architectural styles, but still high-level.
- **Examples**:
- **Pipe and Filter**: Breaks down a task into a series of processing steps (filters)
connected by data streams (pipes).
**Definition**:
Design patterns are solutions to recurring design problems at a more granular level,
typically within the scope of individual components or classes in the system.
**Key Characteristics**:
- **Scope**: Detailed and specific, focusing on individual parts of the system rather
than the system as a whole.
- **Examples**:
- **Singleton**: Ensures a class has only one instance and provides a global point
of access to it.
- **Factory Method**: Defines an interface for creating an object, but allows
subclasses to alter the type of object that will be created.
- **Structural Patterns**: Deal with object composition and typically identify simple
ways to realize relationships between entities.
### Summary
Each of these concepts operates at different levels of abstraction and scope within the
system design process, and understanding their differences helps in applying them
appropriately to create well-structured, maintainable, and scalable software systems.
- Design guidelines provide general principles that help shape the design
process, such as simplicity, consistency, and clarity.
- They also offer specific recommendations and best practices for addressing
common design challenges.
2. **Consistency**:
- They also address accessibility, ensuring that the system is usable by people
with a wide range of abilities and disabilities.
4. **Maintainability**:
5. **Performance**:
- They may also cover performance considerations, ensuring that the system is
efficient and responsive.
### Conclusion
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.
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.
Coupling Cohesion
Coupling shows the relationships Cohesion shows the relationship within the module.
between modules.
While creating, you should aim for low While creating you should aim for high cohesion,
coupling, i.e., dependency among i.e., a cohesive component/ module focuses on a
modules should be less. 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 thing.
other modules.