Programming Methodology

Programming Methodology


Computerized information systems are developed to provide computer solutions to the user problems. If all the requirements of the user are served by the computerised solution, the user is satisfied enough. Thus, the software should be designed effectively so as to meet its objective of user satisfaction. A systematic approach in software design should be adopted to develop an acceptable and efficient solution.

General Concept

Developing a good program is a skill and writing a good program is a quality habit. This good habit can be developed by consciously following the guidelines being covered under this section.

i) Meaningful names for identifiers-:

Identifiers identify different parts of a C++ program. Therefore, identifiers should have meaningful names. Following guidelines should be followed while dealing with identifiers:

  • Assign meaningful names for all identifiers viz. Variables functions and procedures, etc.
  • Do not use similar looking names e.g., manage, manager.
  • Always assign names to scalar constants when it helps in clarity and readability.

ii)Ensure clarity of expressions -:

Expressions carry out the specified action(s). Thus they must be clearly understood by the users. 

iii)Use comments and indentation :-

Comments play a very important role as they provide internal documentation of a program. An indentation makes the statements clear and readable.

In C++ comments are given either by // or /* ….*/ brackets.

Always insert prologues, the comments in the beginning of a program that summarises the purpose of the program. Example prologues are given below:

  • Insert explanatory comments.
  • Always indent statements.
  • Insert Blanks Lines and Blank Spaces.

The blank spaces may beaded before operators like +, -, *, / and %, =, >, <, >=, <=, <> etc. and characters like /*, */, //, comma etc, to improve prevent-ability and readability.


The ability of a program to recover following an error and to continue operating within its environment is known as Robustness.

Guard Code-: The code which can handle exceptional data errors and operational errors is called guard code.

Characteristics of a good program

A program written in a good style is easily understandable to a reader.

Effective and Efficient-: should produce correct result and should be faster, taking into account memory constrains.

User Friendly-: should interact with the user by understandable messages.

Self documenting code-: use of meaningful names to identifiers and appropriate use of comments and indentation.

Reliable-: must be able to handle unexpected situations like input of wrong data or no data input.

Portable-: Should be able to execute on different platforms.

Stages of program development

  • Crack the problem :Involves understanding the problem, identifying minimum number of inputs, step-by-step solution.
  • Problem is cracked and an algorithm is formulated.
  • Code the Algorithm: algorithm is translated into a program (source code) using a programming language. This process is called coding.
  • Compile the program: compilation is the process to convert the source code into the object code (code in machine language).
  • Execute the program.

Types of error

There are broadly three types of errors:

1.Compile Time



1. Compile time errors :

Errors that occurs during compile time

There are two types of compile time errors:

Syntax errors:

When rules of a programming language are misused. i.e. when grammatical rules of C++ is violated. (Syntax refers to formal rules governing the construction of valid statement in a language.)




void main()


int number,

char name,






void main()


int number;

char name;



2. Semantic errors:

When statements are not meaningful.

Example :

A*B = Z is incorrect since an expression cannot come on the left side of an assignment statement.

3.Run-Time Errors:

Errors that occurs during the execution of the program.


Infinite loop, wrong input given e.g. divide error, opening a file which does not exist.

Logical Errors:

Incorrect implementations of an algorithm are logical errors.

Result is incorrect results, even though no errors at the time of compilation or run-time.


  • Use of a variable before initialisation, wrong parameters passed in function.
  • If we are making a c++ program to find the sum of two numbers and in the place of “+” we write “-“.This will cause a logical error.