Chapter 12
sequence of commands used to generate a desired result is a program.
The output depends upon the input given. We may have different sets of
commands to achieve the same result.
A program is written in a computer language. There are several languages and
GUIs that can be used to write a program, i.e., Cobol, Fortran, C, C++, Java, Visual
Basic, and Visual Basic.NET, but we will discuss here only Visual Basic.
Before writing a program you must clearly understand the actual problem
or requirement, and then you will write the program instructions to generate the
desired output.
Let us write a small program to multiply two numbers. The different steps
involved are:
Step 1: Input first number
Step 2: Input second number
Step 3: Processing (multiplying) the input numbers
Step 4: Store the processed data
Step 5: Display the stored result
The different phases involved in writing a complete program are:
1. Identification of the exact problem
2. Development of a mathematical model
3. Design of an algorithm
4. Testing of the algorithm
5. Coding
6. Testing of the program
7. Documentation
Use the following instructions to write a good program:
1. Readability: The program should be written in such a manner that it can
be understood by other programmers easily. Follow some standards when
writing the program. Never create your own style if other programmers have
to work on the same program at the same time or later. Always use explanatory
comments while writing the program. Variables should be named in such a
manner that their use in the program can be understood easily. A long program
should be divided into small sections and subroutines. There should be proper
use of functions to avoid lengthy programs.
2. Design: Program design is the most important phase because it affects all
the phases. The efficiency of the program depends upon the design. There
should be simplicity and adaptability in the program and it should fulfill all
the requirements of the user and must give the desired output.
3. Efficiency: Program efficiency is very important in program development. The
program should be very efficient during the compilation and execution stage;
otherwise, it will consume much time during compilation and execution.
4. Debugging: The errors that occur during compilation and execution of the
program are called bugs, and tracing of an error once its existence has been
confirmed is called debugging. The time spent in debugging may vary from
50% to 90% of total programming time. The debugging time is longer for a
novice and unskilled programmer, whereas for an experienced programmer it
may be less.
Some common errors which cause bugs are:
1. Errors in analysis
2. Errors in correct algorithm
3. Syntax errors
4. Data errors
5. Documentation errors
6. Operating system errors
7. Database connectivity errors
8. Missing supporting or linked files
9. Version support errors
These errors may cause an incomplete compilation and execution, termination,
undesired output, or running in an infinite loop.
5. Testing: The program should be thoroughly tested before implementing it. It
should give correct results and the desired output in all conditions. During
testing all the executions must be tested at least once.
In Visual Basic the different levels of testing are:
1. Event level – Lowest level of testing
2. Form level – Testing of entire form
3. Module level – Testing of all linked forms of different modules
4. Project level – Testing of entire project
5. Field level – Testing of project with real-time data
6. Release level – Testing of package with setup
7. User level – Testing at the user end
Different tools used to generate program logic are:
1. Algorithms: A sequence of logic used to accomplish a particular task. An
algorithm may be defined as an unambiguous procedure used to solve a
2. Flowcharts: A graphical representation of an algorithm is called a flowchart.
3. Pseudo-code: A structural representation of an algorithm is called pseudo-
code. It is used to represent the program logic which helps in understanding
the process.
4. Data-flow Diagrams (DFD): The flow of data is represented by a DFD. Data-
flow diagrams are made at different levels. In the first level there is a simple
representation of data flow. In the second and third level the diagram is more
illustrative, deeper, and complex.

Get Software Engineering and Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.