unit-3
unit-3
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:
a. Decomposition of major system components into program units.
b. Allocation of functional responsibilities to units.
c. User interfaces
d. Unit states and state changes
e. Data and control interaction between units
f. Data packaging and implementation, including issues of scope and visibility
of program elements
g. Algorithms and data structures
Advantage of Object Oriented architecture
It enables the designer to separate a challenge into a collection of autonomous
objects. Other objects are aware of the implementation details of the object,
allowing changes to be made without having an impact on other objects
10. The output criteria in LLD The output criteria in HLD include
are program definition and database design, functional design,
unit tests plan. and review records.
Modularization
Modularization is the process of separating the functionality of a program into
independent, interchangeable modules, such that each contains everything
necessary to execute only one aspect of the desired functionality.
Benefits of modularization
In modularization, the modules have minimal dependency on other modules. So,
we can easily make changes in a module without affecting other parts of the
program.
Easier to add and maintain smaller components
Easier to understand each module and their purpose
Easier to reuse and refactor modules
Better abstraction between modules
Saves time needed to develop, debug, test and deploy a program
Structure Chart
Structure Chart represents the hierarchical structure of modules. It represents
the software architecture that means the various modules making up the system
and the dependency. Structure chart representation can be easily implemented
using some common programming language. The main focus in the structure
chart is on the module structure of the software.
Flow Chart
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.
Flow chart is a convenient technique to represent the flow of control in a
program.
Structure chart Flow chart
Symbols used in structure chart are Symbols used in flow chart are
complex. simple.
Coupling:
Coupling is the measure of the degree of interdependence between the modules.
A good software will have low coupling.
Types of Coupling:
Data Coupling: If the dependency between the modules is based on the
fact that they communicate by passing only data, then the modules are said
to be data coupled. In data coupling, the components are independent of
each other and communicate through data. Module communications don’t
contain tramp data. Example-customer billing system.
Stamp coupling: in stamp coupling, the complete data structure is passed
from one module to another module. Therefore, it involves tramp data. It
may be necessary due to efficiency factors- this choice was made by the
insightful designer, not a lazy programmer.
Control Coupling: If the modules communicate by passing control
information, then they are said to be control coupled. It can be bad if
parameters indicate completely different behavior and good if parameters
allow factoring and reuse of functionality. Example- sort function that takes
comparison function as an argument.
External Coupling: In external coupling, the modules depend on other
modules, external to the software being developed or to a particular type
of hardware. Ex- protocol, external file, device format, etc.
Common Coupling: The modules have shared data such as global data
structures. The changes in global data mean tracing back to all modules
which access that data to evaluate the effect of the change. So it has got
disadvantages like difficulty in reusing modules, reduced ability to control
data accesses, and reduced maintainability.
Content Coupling: In a content coupling, one module can modify the data
of another module, or control flow is passed from one module to the other
module. This is the worst form of coupling and should be avoided.
Temporal Coupling: Temporal coupling occurs when two modules depend
on the timing or order of events, such as one module needing to execute
before another. This type of coupling can result in design issues and
difficulties in testing and maintenance.
Sequential Coupling: Sequential coupling occurs when the output of one
module is used as the input of another module, creating a chain or
sequence of dependencies. This type of coupling can be difficult to maintain
and modify.
Communicational Coupling: Communicational coupling occurs when two
or more modules share a common communication mechanism, such as a
shared message queue or database. This type of coupling can lead to
performance issues and difficulty in debugging.
Functional Coupling: Functional coupling occurs when two modules
depend on each other’s functionality, such as one module calling a function
from another module. This type of coupling can result in tightly-coupled
code that is difficult to modify and maintain.
Data-Structured Coupling: Data-structured coupling occurs when two or
more modules share a common data structure, such as a database table or
data file. This type of coupling can lead to difficulty in maintaining the
integrity of the data structure and can result in performance issues.
Interaction Coupling: Interaction coupling occurs due to the methods of a
class invoking methods of other classes. Like with functions, the worst form
of coupling here is if methods directly access internal parts of other
methods. Coupling is lowest if methods communicate directly through
parameters.
Component Coupling: Component coupling refers to the interaction
between two classes where a class has variables of the other class.
Cohesion:
Cohesion is a measure of the degree to which the elements of the module are
functionally related. It is the degree to which all elements directed towards
performing a single task are contained in the component. Basically, cohesion
is the internal glue that keeps the module together. A good software design
will have high cohesion.
Types of Cohesion:
Functional Cohesion: Every essential element for a single computation is
contained in the component. A functional cohesion performs the task and
functions. It is an ideal situation.
Sequential Cohesion: An element outputs some data that becomes the
input for other element, i.e., data flow between the parts. It occurs
naturally in functional programming languages.
Communicational Cohesion: Two elements operate on the same input data
or contribute towards the same output data. Example- update record in the
database and send it to the printer.
Procedural Cohesion: Elements of procedural cohesion ensure the order of
execution. Actions are still weakly connected and unlikely to be reusable.
Ex- calculate student GPA, print student record, calculate cumulative GPA,
and print cumulative GPA.
Temporal Cohesion: The elements are related by their timing involved. A
module connected with temporal cohesion all the tasks must be executed
in the same time span. This cohesion contains the code for initializing all
the parts of the system. Lots of different activities occur, all at unit time.
Logical Cohesion: The elements are logically related and not functionally.
Ex- A component reads inputs from tape, disk, and network. All the code
for these functions is in the same component. Operations are related, but
the functions are significantly different.
Coincidental Cohesion: The elements are not related (unrelated). The
elements have no conceptual relationship other than location in source
code. It is accidental and the worst form of cohesion. Ex- print next line and
reverse the characters of a string in a single component.
Procedural Cohesion: This type of cohesion occurs when elements or tasks
are grouped together in a module based on their sequence of execution,
such as a module that performs a set of related procedures in a specific
order. Procedural cohesion can be found in structured programming
languages.
Communicational Cohesion: Communicational cohesion occurs when
elements or tasks are grouped together in a module based on their
interactions with each other, such as a module that handles all interactions
with a specific external system or module. This type of cohesion can be
found in object-oriented programming languages.
Temporal Cohesion: Temporal cohesion occurs when elements or tasks are
grouped together in a module based on their timing or frequency of
execution, such as a module that handles all periodic or scheduled tasks in
a system. Temporal cohesion is commonly used in real-time and embedded
systems.
Informational Cohesion: Informational cohesion occurs when elements or
tasks are grouped together in a module based on their relationship to a
specific data structure or object, such as a module that operates on a
specific data type or object. Informational cohesion is commonly used in
object-oriented programming.
Functional Cohesion: This type of cohesion occurs when all elements or
tasks in a module contribute to a single well-defined function or purpose,
and there is little or no coupling between the elements. Functional
cohesion is considered the most desirable type of cohesion as it leads to
more maintainable and reusable code.
Layer Cohesion: Layer cohesion occurs when elements or tasks in a module
are grouped together based on their level of abstraction or responsibility,
such as a module that handles only low-level hardware interactions or a
module that handles only high-level business logic. Layer cohesion is
commonly used in large-scale software systems to organize code into
manageable layers.
Advantages of low coupling:
Improved maintainability: Low coupling reduces the impact of changes in
one module on other modules, making it easier to modify or replace
individual components without affecting the entire system.
Enhanced modularity: Low coupling allows modules to be developed and
tested in isolation, improving the modularity and reusability of code.
Better scalability: Low coupling facilitates the addition of new modules and
the removal of existing ones, making it easier to scale the system as
needed.
Advantages of high cohesion:
Improved readability and understandability: High cohesion results in clear,
focused modules with a single, well-defined purpose, making it easier for
developers to understand the code and make changes.
Better error isolation: High cohesion reduces the likelihood that a change
in one part of a module will affect other parts, making it easier to Isolate
and fix errors.
Improved reliability: High cohesion leads to modules that are less prone to
errors and that function more consistently, Leading to an overall
improvement in the reliability of the system.
Disadvantages of high coupling:
Increased complexity: High coupling increases the interdependence
between modules, making the system more complex and difficult to
understand.
Reduced flexibility: High coupling makes it more difficult to modify or
replace individual components without affecting the entire system.
Decreased modularity: High coupling makes it more difficult to develop
and test modules in isolation, reducing the modularity and reusability of
code.
Disadvantages of low cohesion:
Increased code duplication: Low cohesion can lead to the duplication of
code, as elements that belong together are split into separate modules.
Reduced functionality: Low cohesion can result in modules that lack a clear
purpose and contain elements that don’t belong together, reducing their
functionality and making them harder to maintain.
Difficulty in understanding the module: Low cohesion can make it harder
for developers to understand the purpose and behavior of a module,
leading to errors and a lack of clarity.
Cohesion Coupling
Coupling is created
Cohesion is created between the same between two different
modules. modules.
It is used in debugging,
5. It is basically used in testing.
module documentation, etc.
Pros-
Easier isolation of interface
errors
Pros-
It benefits in the case error
occurs towards the top of the Easy to create test conditions
9. program. Test results are easy to observe
Defects in design get It is suited if defects occur at the
detected early and can be bottom of the program.
corrected as an early working
module of the program is
available.
Cons-
Cons-
There is no representation of the
Difficulty in observing the working model once several
output of test case. modules have been constructed.
Stub writing is quite crucial as There is no existence of the
it leads to setting of output program as an entity without the
10. parameters. addition of the last module.
When stubs are located far From a partially integrated
from the top level module, system, test engineers cannot
choosing test cases and observe system-level
designing stubs become more functions. It can be possible only
challenging. with the installation of the top-
level test driver.
Matrices
A metric is a measurement of the level at which any impute belongs to a system
product or process. Software metrics is a quantifiable or countable assessment
of the attributes of a software product.
There are 4 functions related to software metrics:
Planning
Organizing
Controlling
Improving
Characteristics of software Metrics:
Quantitative: Metrics must possess quantitative nature. It means metrics
can be expressed in numerical values.
Understandable: Metric computation should be easily understood, and the
method of computing metrics should be clearly defined.
Applicability: Metrics should be applicable in the initial phases of the
development of the software.
Repeatable: When measured repeatedly, the metric values should be the
same and consistent in nature.
Economical: The computation of metrics should be economical.
Language Independent: Metrics should not depend on any programming
language.
Classification of Software Metrics:
There are 3 types of software metrics:
Product Metrics: Product metrics are used to evaluate the state of the
product, tracing risks and undercover prospective problem areas. The
ability of the team to control quality is evaluated. Examples include lines of
code, cyclamatric complexity, code coverage, defect density, and code
maintainability index.
Process Metrics: Process metrics pay particular attention to enhancing the
long-term process of the team or organization. These metrics are used to
optimize the development process and maintenance activities of software.
Examples include effort variance, schedule variance, defect injection rate,
and lead time.
Project Metrics: The project metrics describes the characteristic and
execution of a project. Examples include effort estimation accuracy,
schedule deviation, cost variance, and productivity.
Usually measures-
Number of software developer
Staffing patterns over the life cycle of software
Cost and schedule
Productivity
Advantages of Software Metrics:
1. Reduction in cost or budget.
2. It helps to identify the particular area for improvising.
3. It helps to increase the product quality.
4. Managing the workloads and teams.
5. Reduction in overall time to produce the product,
6. It helps to determine the complexity of the code and to test the code with
resources.
7. It helps in providing effective planning, controlling and managing of the
entire product.
Disadvantages of Software Metrics:
It is expensive and difficult to implement the metrics in some cases.
Performance of the entire team or an individual from the team can’t be
determined. Only the performance of the product is determined.
Sometimes the quality of the product is not met with the expectation.
It leads to measure the unwanted data which is wastage of time.
Measuring the incorrect data leads to make wrong decision making.
Objectives of software testing
Software Testing is the process of evaluating the software product for identifying
bugs/issues in the product. Improving software quality is the core purpose of
running software tests. A mix of manual and automated tests are normally
conducted at every juncture of software development. This is to make sure that
a fully-functional application is released to the end-users of the product. It is
important to reiterate that testing must be performed from different angles like
functional, non-functional, security, accessibility, and more.
1. Identification of Bugs
2. Improvement of software quality
3. Enhancement of software quality
4. Enhancement of scalability and reliability
Main objective of software testing
To find any defects or bugs that may have been created when the software
was being developed
To increase confidence in the quality of the software
To prevent defects in the final product
To ensure the end product meets customer requirements as well as the
company specifications
To provide customers with a quality product and increase their confidence
in the company
Grey box testing
The Gray Box Testing is a combination of Black Box and White Box Testing.
In the Black Box Testing technique, the tester is unaware of the internal structure
of the item being tested and in White Box Testing the internal structure is known
to the tester. The internal structure is partially known in Gray Box Testing. This
includes access to internal data structures and algorithms to design the test
cases. Gray Box Testing is named so because the software program is like a
semitransparent or gray box inside which the tester can partially see. It
commonly focuses on context-specific errors related to web systems. It is based
on requirement test case generation because it has all the conditions presented
before the program is tested.
Objectives of Gray Box Testing
1. To provide combined advantages of both black box testing and white box
testing.
2. To combine the input of developers as well as testers.
3. To improve overall product quality.
4. To reduce the overhead of long process of functional and non-functional
tastings.
5. To provide enough free time to developers to fix defects.
6. To test from the user point of view rather than a designer point of view.
Advantages of Gray Box Testing
Clarity of goals: Users and developers have clear goals while doing testing.
Done from user perspective: Gray box testing is mostly done by the user
perspective.
High programming skills not required: Testers are not required to have
high programming skills for this testing.
Non-intrusive: Gray box testing is non-intrusive.
Improved product quality: Overall quality of the product is improved.
Defect fixing: In gray box testing, developers have more time for defect
fixing.
Benefits of black box and white box testing: By doing gray box testing,
benefits of both black box and white box testing is obtained.
Unbiased: Gray box testing is unbiased. It avoids conflicts between a tester
and a developer.
Effective testing: Gray box testing is much more effective in integration
testing.
Importance of software testing
Software testing is the culmination of application development through which
software testers evaluate code by questioning it. This evaluation can be brief or
proceed until all stakeholders are satisfied. Software testing identifies bugs and
issues in the development process so they're fixed prior to product launch. This
approach ensures that only quality products are distributed to consumers.
1. Identifies defects early.
2. Improves product quality.
3. Increases customer trust and satisfaction.
4. Detects security vulnerabilities.
5. Helps with scalability.
6. Saves money.
Types of software testing
1. Integration testing. This groups together two or more modules of an
application to ensure they function collectively. This type of testing also
reveals interface, communication and data flow defects between modules.
2. Unit testing. Typically conducted during the application development
phase, the purpose of unit testing is to ensure that each individual unit or
component performs as expected. This is a type of white box testing and
test automation tools -- such as NUnit, JUnit and xUnit -- are typically used
to execute these tests.
3. Functional testing. This entails checking functions against functional
requirements. A common way to conduct functional testing is by using the
black box testing
4. Security testing. This ensures the software is free of potential
vulnerabilities, known flaws and security loopholes that might affect the
user system and data. Security testing is generally conducted through
penetration testing
5. Performance testing. This tests the performance and speed of an
application under a given workload.
6. Regression testing. This verifies whether adding new features causes a
decline in the functionality of an application.
7. Stress testing. This assesses the strength of software by testing how much
load it can take before reaching a breaking point. This is a type of
nonfunctional test.
8. Acceptance testing. This evaluates the entire system against the desired
requirements and ensures the project is complete.
Unit testing
Unit testing is a type of software testing that focuses on individual units or
components of a software system. The purpose of unit testing is to validate that
each unit of the software works as intended and meets the requirements. Unit
testing is typically performed by developers, and it is performed early in the
development process before the code is integrated and tested as a whole system.
unit testing is a software testing technique using which individual units of
software i.e. group of computer program modules, usage procedures, and
operating procedures are tested to determine whether they are suitable for use
or not. It is a testing method using which every independent module is tested to
determine if there is an issue by the developer himself.
The objective of Unit Testing is:
1. To isolate a section of code.
2. To verify the correctness of the code.
3. To test every function and procedure.
4. To fix bugs early in the development cycle and to save costs.
5. To help the developers understand the code base and enable them to make
changes quickly.
6. To help with code reuse
Integration testing
Integration testing is a type of software testing where components of the
software are gradually integrated and then tested as a unified group. Usually
these components are already working well individually, but they may break
when integrated with other components. With integration testing, testers want
to find defects that surface due to code conflicts between software modules
when they are integrated with each other.
Importance of integration testing
1. Inconsistent code logic: They are coded by different programmers whose
logic and approach to development differ from each other, so when
integrated, the modules cause functional or usability issues.
2. Shifting requirements: Clients change their requirements frequently.
Modifying the code of 1 module to adapt to new requirements sometimes
means changing in its code logic entirely, which affects the entire
application.
3. Erroneous Data: Data can change when transferred across modules. If not
properly formatted when transferring, the data can’t be read and
processed, resulting in bugs.
4. Third-party services and API integrations: Since data can change when
transferred, API and third-party services may receive false input and
generate false responses.
5. Inadequate exception handling: Developers usually account for exceptions
in their code, but sometimes they can’t fully see all of the exception
scenarios until the modules are pieced together.
6. External Hardware Interfaces: Bugs can also arise when there is software-
hardware incompatibility, which can easily be found with proper
integration testing.
Advantages:
Suitable for simple and small-sized system with low level of dependency among
software components.
Little to no planning beforehand required
Easy to set up since all modules are integrated simultaneously
Management and coordination efforts are minimized since there is only
one major testing phase
Disadvantages:
Costly and time-consuming for large systems with a huge number of units
as testers have to wait until all modules have been developed to start
testing.
Waiting for all modules to be developed before testing also means late
defect detection.
Hard to isolate and pinpoint bugs in specific modules
Hard to debug due to the complexity of multiple integrated modules
Acceptance testing
It is a formal testing according to user needs, requirements and business
processes conducted to determine whether a system satisfies the acceptance
criteria or not and to enable the users, customers or other authorized entities to
determine whether to accept the system or not.
Types of Acceptance Testing
1. User acceptance testing
2. Business acceptance testing
3. Contract acceptance testing
4. Regulation acceptance testing
5. Operational acceptance testing
6. Alpha testing
7. Beta testing
Advantages of Acceptance Testing:
This testing helps the project team to know the further requirements from
the users directly as it involves the users for testing.
Automated test execution.
It brings confidence and satisfaction to the clients as they are directly
involved in the testing process.
It is easier for the user to describe their requirement.
It covers only the Black-Box testing process and hence the entire
functionality of the product will be tested.
Disadvantages of Acceptance Testing:
Users should have basic knowledge about the product or application.
Sometimes, users don’t want to participate in the testing process.
The feedback for the testing takes long time as it involves many users and
the opinions may differ from one user to another user.
Development team is not participated in this testing process.
Regression Testing
Regression Testing is the process of testing the modified parts of the code and
the parts that might get affected due to the modifications to ensure that no new
errors have been introduced in the software after the modifications have been
made. Regression means the return of something and in the software field, it
refers to the return of a bug.
Performance of regression testing
When a new functionality is added to the system and the code has been
modified to absorb and integrate that functionality with the existing code.
When some defect has been identified in the software and the code is
debugged to fix it.
When the code is modified to optimize its working.
Techniques for the selection of Test cases for Regression Testing:
Select all test cases: In this technique, all the test cases are selected from
the already existing test suite. It is the simplest and safest technique but
not much efficient.
Select test cases randomly: In this technique, test cases are selected
randomly from the existing test-suite, but it is only useful if all the test cases
are equally good in their fault detection capability which is very rare. Hence,
it is not used in most of the cases.
Select modification traversing test cases: In this technique, only those test
cases are selected which covers and tests the modified portions of the
source code the parts which are affected by these modifications.
Select higher priority test cases: In this technique, priority codes are
assigned to each test case of the test suite based upon their bug detection
capability, customer requirements, etc.
Advantages of Regression Testing:
It ensures that no new bugs has been introduced after adding new
functionalities to the system.
As most of the test cases used in Regression Testing are selected from the
existing test suite, and we already know their expected outputs. Hence, it
can be easily automated by the automated tools.
It helps to maintain the quality of the source code.
Disadvantages of Regression Testing:
It can be time and resource consuming if automated tools are not used.
It is required even after very small changes in the code.
Functional testing
Functional Testing is a type of Software Testing in which the system is tested
against the functional requirements and specifications. Functional testing
ensures that the requirements or specifications are properly satisfied by the
application. This type of testing is particularly concerned with the result of
processing.
Purpose of functional testing
1. Functional testing mainly involves black box testing and can be done
manually or using automation. The purpose of functional testing is to:
2. Test each function of the application: Functional testing tests each function
of the application by providing the appropriate input and verifying the
output against the functional requirements of the application.
3. Test primary entry function: In functional testing, the tester tests each
entry function of the application to check all the entry and exit points.
4. Test flow of the GUI screen: In functional testing, the flow of the GUI screen
is checked so that the user can navigate throughout the application.
Functional testing involves the following steps:
Identify test input: This step involves identifying the functionality that
needs to be tested. This can vary from testing the usability functions, and
main functions to error conditions.
Compute expected outcomes: Create input data based on the
specifications of the function and determine the output based on these
specifications.
Execute test cases: This step involves executing the designed test cases and
recording the output.
Compare the actual and expected output: In this step, the actual output
obtained after executing the test cases is compared with the expected
output to determine the amount of deviation in the results. This step
reveals if the system is working as expected or not.
Type of Functional Testing
Unit testing
Integration testing
Smoke testing
User acceptance testing
Interface testing
Usability testing
System testing
Regression testing
Sanity testing
White box testing
Black box testing
Database testing
Adhoc testing
Recovery testing
Static testing
Grey box testing
Component testing
Parameters Functional Testing Non-functional Testing
Functional testing
Non-functional verifies
verifies the operations
Definition the behavior of an
and actions of an
application.
application.
Non-functional testing is
Functional testing is
carried out using the
Requirements carried out using the
performance
functional specification.
specifications.
Higher level modules are Lower level modules are tested &
tested & integrated first and integrated first and then higher
then lower level modules are level modules are tested &
tested & integrated. integrated.
Mainly implemented in
Mainly implemented in object
structure or procedure
oriented programming
oriented programming
languages.
languages.