Friday, 4 October 2013

Characteristics of a good program


CHARACTERISTICS OF A GOOD PROGRAM:

        i.            Correctness – A program should produce exactly what is desired.

      ii.            Simplicity of logic – The logic of the program should be as simple as possible. There can be many methods to solve a program. We should select the easiest method.

    iii.            Clarity – The program should be made in such a way that it should be easily understandable to others. For this following points should be kept in mind: Documentation, indentation and naming of variable.

     iv.            Documentation – The programmer should include comments in his program. The comments enhance the understandability.

 

Following are the positions where the documentations essential:

·         At the beginning of the program about its purpose.

·         At if condition.

·         Just before loops.

·         Just before a set of statements for a special purpose.

·         Just before the body of a function telling about its purpose.

 

       v.            Indentation – Indentation means right shifting of the statements inside the special constructs, like – if and for statements. Indentation clearly indicates the limit of the body of the construct.

     vi.            Modularity – Many programs can be broken down into a series of identifiable subtasks. It is good programming practice to implement each of these subtask as a separate program module. In BASIC programming language these modules are called subroutines and in C, functions.

   vii.            Portability or Platform independence – A program made on a source platform should behave in the similar manner on the target platform. The source and target platform may be in different configuration. A C or C++ program prepared on UNIX operating system should behave in the similar manner on DOS or WINDOWS based system. If a program is accessing the hardware resources directly, it is platform dependent.

 viii.            Robustness – The program should be able to sustain mishandling. The program should be self error handled. It means that the program should not behave abruptly in case of mishandling by naïve user.

     ix.            Minimum resource requirement– The program should be such that, it should consume minimum computing resource:

·         Minimum CPU time

·         Minimum main memory

·         Minimum secondary memory

 
So the logic of the program should be simple, the size of the program should be small, dynamic allocation should be preferred.

No comments:

Post a Comment