Programming Methodology

Description

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 :-

  1. Defining a problem – The programmer should fully understand what exactly the user wants.
  2. 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.
  3. Selecting and representing algorithms – This describes a detailed view of solution and its implementation summary.
  4. Coding – A programming language is used to implement the solution.
  5. Debugging – All errors are located and corrected to ensure working program.
  6. Testing and Validation – The program is tested and validated to see whether it produces correct result.
  7. Program Maintenance – The program is checked for time to time to eliminate any new error and modified to meet end user needs.

Modular Programming

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.

Programming Guidelines

  • 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.

Program Debugging

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.

Example :–

void main (  )
{
int j
}

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.

Example :–

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 :-

  1. Accuracy – It is called integrity of a program.
  2. Clarity – It is the overall readability of the program
  3. Efficiency – It is concerned with execution speed and effective memory utilization.
  4. Modularity – It is the process of breaking a complex problem into smaller sub-parts.
  5. User-friendly – The program must be user-friendly so that the user can easily communicate with the program.
  6. Reliable – It should be able to handle situations when wrong inputs are given.
  7. Portable – It must be able to run on different platforms without doing much changes.

Representational Error

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.

References

  • Computer Science with C++, Reeta Sahoo