The process of coding a program snippet or an entire application is called Programming. It is a critical step for data processing applications. The developed software should be user friendly and developed in such a way that it meets the objectives of the end user.
Stages for developing a program
Developing a program involves different steps such as :-
- Defining a problem – The programmer should fully understand what exactly the user wants.
- Outlining the solution – A blue-print of how exactly the problem would be solved and interaction between different parts of a module should be done.
- Selecting and representing algorithms – This describes a detailed view of solution and its implementation summary.
- Coding – A programming language is used to implement the solution.
- Debugging – All errors are located and corrected to ensure working program.
- Testing and Validation – The program is tested and validated to see whether it produces correct result.
- Program Maintenance – The program is checked for time to time to eliminate any new error and modified to meet end user needs.
It is a technique in which logical parts of a problem are divided into series of individual routines so that each part can be programmed independently.Any changes in an application which are bound to occur now and then affect only one or few modules which can be modified at a much lower cost.
- Use comments to improve readability of a program.If the programmer changes then the new programmer will find it easier to interpret the program code with comments.
- Select meaningful names for variables.This also helps improving the readability of the program code.
- Proper indentation to improve program readability.
The process of debugging : It is the process of discovering, locating and correcting all errors which cause a program to produce either incorrect results or no results. The errors in a program can be classified as :-
1) Syntax Error
2) Run-Time Error
3) Logical Error
1) Syntax Error – It is due to the violation of any grammatical rules of the programming language. This kind of error is easier to correct as helpful error message is produced by the computer.
void main ( )
Compilation Result :
Error in ‘int j’ semicolon missing.
2) Run-Time Error – If a program compiles successfully but causes abnormal program termination during execution or any undesired result.
Example :- x = a/b ;
If b = 0, x results in Infinity so an exception would occur. The programmer must make sure to input correct data or check for variable values.
3) Logical Error – A logic error is an incorrect translation of the problem statement or the algorithm.
int c = a – b/d ;
A user might interpret this problem as solving (b/d) first and then substracting the result from ‘a’ and storing it in ‘c’ but compiler will execute it as (a – b) / d ;
So desired value of ‘c’ is not obtained. But the compiler wouldn’t show it as error as no violation of programming rules have been done.
Characteristics of a good program
The characteristics of a good program are :-
- Accuracy – It is called integrity of a program.
- Clarity – It is the overall readability of the program
- Efficiency – It is concerned with execution speed and effective memory utilization.
- Modularity – It is the process of breaking a complex problem into smaller sub-parts.
- User-friendly – The program must be user-friendly so that the user can easily communicate with the program.
- Reliable – It should be able to handle situations when wrong inputs are given.
- Portable – It must be able to run on different platforms without doing much changes.
When binary numbers cannot represent the decimal numbers accurately due to truncation or sounding off. This is due to lack of bits for storage due to which the precision of the given number is lost. Such errors are known as Representational errors.
- Computer Science with C++, Reeta Sahoo