Program Development Life Cycle

As stated earlier, a program is needed to instruct the computer about the way a task is to be performed. The instructions in a program have three essential parts:

1. Instructions to accept the input data that needs to be processed,

2. Instructions that will act upon the input data and process it, and

3. Instructions to provide the output to user

The instructions in a program are defined in a specific sequence. Writing a computer program is not a straightforward task. A person who writes the program (computer programmer) has to follow the Program Development Life Cycle.

Let’s now discuss the steps that are followed by the programmer for writing a program:

·         Problem Analysis—The programmer first understands the problem to be solved. The programmer determines the various ways in which the problem can be solved, and decides upon a single solution which will be followed to solve the problem.

·         Program Design—The selected solution is represented in a form, so that it can be coded. This requires three steps—

An algorithm is written, which is an English-like explanation of the solution.

A flowchart is drawn, which is a diagrammatic representation of the solution. The solution is represented diagrammatically, for easy understanding and clarity.

A pseudo code is written for the selected solution. Pseudo code uses the structured programming constructs. The pseudo code becomes an input to the next phase.

Program Development

·         The computer programming languages are of different kinds—low-level languages, and high- level languages like C, C++ and Java. The pseudo code is coded using a suitable programming language.

·         The coded pseudo code or program is compiled for any syntax errors. Syntax errors arise due to the incorrect use of programming language or due to the grammatical errors with respect to the programming language used. During compilation, the syntax errors, if any, are removed.

·         The successfully compiled program is now ready for execution.

·         The executed program generates the output result, which may be correct or incorrect. The program is tested with various inputs, to see that it generates the desired results. If incorrect results are displayed, then the program has semantic error (logical error). The semantic errors are removed from the program to get the correct results.

·         The successfully tested program is ready for use and is installed on the user’s machine.

Program Documentation and Maintenance—The program is properly documented, so that later on, anyone can use it and understand it’s working. Any changes made to the program, after installation, forms part of the maintenance of program. The program may require updating, fixing of errors etc. during the maintenance phase.

Table  summarises the steps of the program development cycle.

 

 

Algorithm

Algorithm is an ordered sequence of finite, well defined, unambiguous instructions for completing a task. Algorithm is an English-like representation of the logic which is used to solve the problem. It is a step- by-step procedure for solving a task or a problem. The steps must be ordered, unambiguous and finite in number.

For accomplishing a particular task, different algorithms can be written. The different algorithms differ in their requirements of time and space. The programmer selects the best-suited algorithm for the given task to be solved.

Let’s now look at two simple algorithms to find the greatest among three numbers, as follows:

Algorithm to find the greatest among three numbers—

ALGORITHM 1.

·         Step 1: Start

·         Step 2: Read the three numbers A, B, C

·         Step 3: Compare A and B. If A is greater perform

·         step 4 else perform

·         step 5. Step 4: Compare A and C. If A is greater, output “A is greatest” else output “C is greatest”. Perform

·         step 6. Step 5: Compare B and C. If B is greater, output “B is greatest” else output “C is greatest”. Step 6: Stop

ALGORITHM 2.

·         Step 7: Start

·         Step 8: Read the three numbers A, B, C

·         Step 9: Compare A and B. If A is greater, store A in MAX, else store B in MAX.

·         Step 10: Compare MAX and C. If MAX is greater, output “MAX is greatest” else output “C is greatest”.

·         Step 11: Stop

Both the algorithms accomplish the same goal, but in different ways. The programmer selects the algorithm based on the advantages and disadvantages of each algorithm. For example, the first algorithm has more number of comparisons, whereas in the second algorithm an additional variable MAX is required.