Unit Ii Notes
Unit Ii Notes
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
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.
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 of Modularity
Disadvantages of Modularity
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.
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.
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.
Coupling Cohesion
Coupling shows the relationships Cohesion shows the relationship within the
between modules. module.
While creating, you should aim for low While creating you should aim for high
coupling, i.e., dependency among cohesion, i.e., a cohesive component/ module
modules should be less. focuses on a 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
other modules. thing.
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 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.
A data dictionary lists the objective of all data items and the definition of all composite
data elements in terms of their component data items. For example, a data dictionary
entry may contain that the data grossPay consists of the
parts regularPay and overtimePay.
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.
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.
Coding
The coding is the process of transforming the design of a system into a computer language
format. This coding phase of software development is concerned with software translating
design specification into the source code. It is necessary to write source code & internal
documentation so that conformance of the code to its specification can be easily verified.
Coding is done by the coder or programmers who are independent people than the
designer. The goal is not to reduce the effort and cost of the coding phase, but to cut to
the cost of a later stage. The cost of testing and maintenance can be significantly reduced
with efficient coding.
Goals of Coding
1. To translate the design of system into a computer language format: The
coding is the process of transforming the design of a system into a computer
language format, which can be executed by a computer and that perform tasks as
specified by the design of operation during the design phase.
2. To reduce the cost of later phases: The cost of testing and maintenance can be
significantly reduced with efficient coding.
3. Making the program more readable: Program should be easy to read and
understand. It increases code understanding having readability and
understandability as a clear objective of the coding activity can itself help in
producing more maintainable software.
For implementing our design into code, we require a high-level functional language. A
programming language should have the following characteristics:
Generality: Most high-level languages allow the writing of a vast collection of programs,
thus relieving the programmer of the need to develop into an expert in many diverse
languages.
Brevity: Language should have the ability to implement the algorithm with less amount
of code. Programs mean in high-level languages are often significantly shorter than their
low-level equivalents.
Cost: The ultimate cost of a programming language is a task of many of its characteristics.
A coding standard lists several rules to be followed during coding, such as the way
variables are to be named, the way the code is to be laid out, error return conventions,
etc.
Coding Standards
General coding standards refers to how the developer writes code, so here we will discuss
some essential standards regardless of the programming language being used.
The following are some representative coding guidelines recommended by many software
development organizations.
1. Line Length: It is considered a good practice to keep the length of source code lines
at or below 80 characters. Lines longer than this may not be visible properly on some
terminals and tools. Some printers will truncate lines longer than 80 columns.
2. Spacing: The appropriate use of spaces within a line of code can improve readability.
Example:
Bad: cost=price+(price*sales_tax)
fprintf(stdout ,"The total cost is %5.2f\n",cost);
4. The length of any function should not exceed 10 source lines: A very lengthy
function is generally very difficult to understand as it possibly carries out many various
functions. For the same reason, lengthy functions are possible to have a disproportionately
larger number of bugs.
5. Do not use goto statements: Use of goto statements makes a program unstructured
and very tough to understand.
Programming Style
Programming style refers to the technique used in writing the source code for a computer
program. Most programming styles are designed to help programmers quickly read and
understands the program as well as avoid making errors. (Older programming styles also
focused on conserving screen space.) A good coding style can overcome the many
deficiencies of a first programming language, while poor style can defeat the intent of an
excellent language.
2. Naming: In a program, you are required to name the module, processes, and variable,
and so on. Care should be taken that the naming style should not be cryptic and non-
representative.
3. Control Constructs: It is desirable that as much as a possible single entry and single
exit constructs used.
4. Information hiding: The information secure in the data structures should be hidden
from the rest of the system where possible. Information hiding can decrease the coupling
between modules and make the system more maintainable.
5. Nesting: Deep nesting of loops and conditions greatly harm the static and dynamic
behavior of a program. It also becomes difficult to understand the program logic, so it is
desirable to avoid deep nesting.
6. User-defined types: Make heavy use of user-defined data types like enum, class,
structure, and union. These data types make your program code easy to write and easy
to understand.
7. Module size: The module size should be uniform. The size of the module should not
be too big or too small. If the module size is too large, it is not generally functionally
cohesive. If the module size is too small, it leads to unnecessary overheads.
Testing is mandatory because it will be a dangerous situation if the software fails any of
time due to lack of testing. So, without testing software cannot be deployed to the end
user.
What is Testing
Testing is a group of techniques to determine the correctness of the application under the
predefined script but, testing cannot find all the defect of application. The main intent of
testing is to detect failures of the application so that failures can be discovered and
corrected. It does not demonstrate that a product functions properly under all conditions
but only that it is not working in some specific conditions.
Testing furnishes comparison that compares the behavior and state of software against
mechanisms because the problem can be recognized by the mechanism. The mechanism
may include past versions of the same specified product, comparable products, and
interfaces of expected purpose, relevant standards, or other criteria but not limited up to
these.
Testing includes an examination of code and also the execution of code in various
environments, conditions as well as all the examining aspects of the code. In the current
scenario of software development, a testing team may be separate from the development
team so that Information derived from testing can be used to correct the process of
software development.
The success of software depends upon acceptance of its targeted audience, easy graphical
user interface, strong functionality load test, etc. For example, the audience of banking is
totally different from the audience of a video game. Therefore, when an organization
develops a software product, it can assess whether the software product will be beneficial
to its purchasers and other audience.
Manual Testing
Manual testing is a software testing process in which test cases are executed manually
without using any automated tool. All test cases executed by the tester manually according
to the end user's perspective. It ensures whether the application is working as mentioned
in the requirement document or not. Test cases are planned and implemented to complete
almost 100 percent of the software application. Test case reports are also generated
manually.
Manual Testing is one of the most fundamental testing processes as it can find both visible
and hidden defects of the software. The difference between expected output and output,
given by the software is defined as a defect. The developer fixed the defects and handed
it to the tester for retesting.
Manual testing is mandatory for every newly developed software before automated testing.
This testing requires great efforts and time, but it gives the surety of bug-free software.
Manual Testing requires knowledge of manual testing techniques but not of any automated
testing tool.
Manual testing is essential because one of the software testing fundamentals is "100%
automation is not possible."
There are various methods used for manual testing. Each method is used according to its
testing criteria. Types of manual testing are given below:
Appium
TestLink
Postman
Firebug
JMeter
Mantis
Mantis is used for bug tracking.
Automation Testing
When the testing case suites are performed by using automated testing tools is known as
Automation Testing. The testing process is done by using special automation tools to
control the execution of test cases and compare the actual result with the expected result.
Automation testing requires a pretty huge investment of resources and money.
Generally, repetitive actions are tested in automated testing such as regression tests. The
testing tools used in automation testing are used not only for regression testing but also
for automated GUI interaction, data set up generation, defect logging, and product
installation.
The goal of automation testing is to reduce manual test cases but not to eliminate any of
them. Test suits can be recorded by using the automation tools, and tester can play these
suits again as per the requirement. Automated testing suites do not require any human
intervention.
The term 'white box' is used because of the internal perspective of the system. The clear
box or white box or transparent box name denote the ability to see through the software's
outer shell into its inner workings.
Test cases for white box testing are derived from the design phase of the software
development lifecycle. Data flow testing, control flow testing, path testing, branch testing,
statement and decision coverage all these techniques used by white box testing as a
guideline to create an error-free software.
White box testing follows some working steps to make testing manageable and easy to
understand what the next task to do. There are some basic steps to perform white box
testing.
In this method, tester selects a function and gives input value to examine its functionality,
and checks whether the function is giving expected output or not. If the function produces
correct output, then it is passed in testing, otherwise failed. The test team reports the
result to the development team and then tests the next function. After completing testing
of all functions if there are severe problems, then it is given back to the development team
for correction.
Generic steps of black box testing
o The black box test is based on the specification of requirements, so it is examined
in the beginning.
o In the second step, the tester creates a positive test scenario and an adverse test
scenario by selecting valid and invalid input values to check that the software is
processing them correctly or incorrectly.
o In the third step, the tester develops various test cases such as decision table, all
pairs test, equivalent division, error estimation, cause-effect graph, etc.
o The fourth phase includes the execution of all test cases.
o In the fifth step, the tester compares the expected output against the actual output.
o In the sixth and final step, if there is any flaw in the software, then it is cured and
tested again.
Test procedure
The test procedure of black box testing is a kind of process in which the tester has specific
knowledge about the software's work, and it develops test cases to check the accuracy of
the software's functionality.
It does not require programming knowledge of the software. All test cases are designed
by considering the input and output of a particular function. A tester knows about the
definite output of a particular input, but not about how the result is arising. There are
various techniques used in black box testing for testing like decision table technique,
boundary value analysis technique, state transition, All-pair testing, cause-effect graph
technique, equivalence partitioning technique, error guessing technique, use case
technique and user story technique. All these techniques have been explained in detail
within the tutorial.
Test cases
Test cases are created considering the specification of the requirements. These test cases
are generally created from working descriptions of the software including requirements,
design parameters, and other specifications. For the testing, the test designer selects both
positive test scenario by taking valid input values and adverse test scenario by taking
invalid input values to determine the correct output. Test cases are mainly designed for
functional testing but can also be used for non-functional testing. Test cases are designed
by the testing team, there is not any involvement of the development team of software.