Monday, 2 March 2015

Program Development


Developing a program involves a set of steps:

1. Define the problem
2. Outline the solution
3. Develop an algorithm1
4. Test the algorithm for correctness
5. Code the algorithm using a suitable programming language
6. Compile and correction of compile errors
7. Run the program on the computer
8. Test, document and maintain the program

Most of these steps are common to any problem solving task. Program development (software development) may take several hours, days, weeks, months or years. After development, customers will make use of the system. While in use the system needs to be maintained. The maintenance phase will continue for several months, several years or even several decades. Therefore software development is not a onetime task; it is a lifecycle where some of the above steps are reformed again and again. The steps are discussed in the following.


1.2.1 Define the Problem

First of all the problem should be clearly defined. The problem can be divided into three components:

· Inputs – what do you have?
· Outputs – what do you want to have?
· Processing – how do you go from inputs to outputs?

Programmers should clearly understand “what are the inputs to the program”, “what is expected as output(s)” and “how to process inputs to generate necessary outputs”. Consider an example where a computer program is to be written to calculate and display the circumference and area of a circle when the radious .

· Inputs – the radius (r)
· Outputs – circumference (c) and area (a)
· Processing
§ c = 2pr, a = pr2


1.2.2 Outline the Solution

The programmer should define:

· the major steps required to solve the problem
· any subtasks
· the major variables and data structures
· the major control structures (e.g. sequence, selection, repetition loops)2 in the algorithm
· the underlined logic

Consider the above mentioned example . In order to calculate the circumference:

· Variables – radius (r), circumference (c)
· Calculation – c = 2pr

In order to calculate the area:

· Variables – radius (r), area (a)
· Calculation – a = pr2

1.2.3 Develop the Algorithm

The next step is to develop an algorithm that will produce the desired result(s). An algorithm is a segment of precise steps that describes exactly the tasks to be performed, and the order in which they are to be carried out to solve a problem. Pseudocode (a structured form of the English language) can be used to express an algorithm. A suitable algorithm for our example would be:

Start
Input r
Calculate circumference
c = 2 * PI* r
Calculate area
a = PI* r^2
Output c & a
End

In here PI is a constant that represents the value of p.

1.2.4 Test the Algorithm for Correctness

The programmer must make sure that the algorithm is correct. The objective is to identify major logic errors early, so that they may be easily corrected. Test data should be applied to each step, to check whether the algorithm actually does what it is supposed to. Our simple example can be quite easily check by submitting some values for radius (r) and walking through the algorithm to see whether the resulting output is correct for each input.

1.2.5 Code the Algorithm

After all the design considerations have been met and when the algorithm is finalised code it using a suitable programming language.

1.2.6 Compile

The next step is to compile (section 1.3) the program. While compiling syntax errors can be identified. When the written program does not adhere to the programming language rules those are called syntax errors. These errors occur mostly due to miss typed characters, symbols, missing punctuations , etc. If there are no syntax errors the program gets compiled and it produces an executable program.

1.2.7 Run the Program

Executable program generated after compiling can then be executed. While the program is running runtime errors and sometimes logic errors can be identified. Runtime errors occur while executing the program and those are mostly due to incorrect inputs.


1.2.8 Test, Document and Maintain the Program

Test the running program using test data to make sure program is producing correct output(s). During this phase logic errors can be found. Logic errors occur due to incorrect algorithms (although you provide correct inputs you do not get the correct outputs). All the steps involved in developing the program algorithm and code should be documented for future reference. Programmers should also maintain and update the program according to new or changing requirements.




No comments:

Post a Comment