Good Programming Methods can be of great value in creating the right specifications and also producing correct programs.
Program Specification and Correctness in Good Programming Methods
Program specification is a statement of what the proposed program is required to do. The programmer must then design and implement the program so that it meets the specification. Correctness is when a program designed meets its specification in Good Programming Methods. If the specification is wrong in that it does not specify what is really required, we could write a correct program but it would be unsuitable. Engineering in Kenya has more information.
Stages Involved in Good Programming Methods
In the process of producing the necessary instructions making up a program, the following stages can be recognized:
- Understanding the problem.
- Planning the method of solution.
- Developing the methods using suitable aids e.g. the pseudo code (which in Good Programming Methods is a notational system in which ideas can be expressed informally in the algorithm development process.).
- Typing the instructions into the computer using an editor and suitable programming language.
- Testing the program. In Good Programming Methods the various components as well as the whole program are tested.
- Documenting all the work involved in producing the program. This documentation will be developed stage by stage.
In Good Programming Methods, this is a questions stage. What is the program supposed to do – what is the program specification? Is the task computable? Computable in Good Programming Methods is when a task can be performed by a machine. Strange thou it may seem, many tasks are not computable. It is relatively easy to discover non-computable mathematical functions e.g. a function that requires division by zero is not computable. There are also some celebrated unsolvable problems in the theory of computability. One example in this category in Good Programming Methods is ‘the halting problem’. Put simply, there is no algorithm that can take an arbitrary program and its input and decide whether the program execution will stop if the program is given that input. Such an algorithm would have great practical value but cannot exist.
- Planning the method of solution.
What are the program components? These components become modules, each of which may be handled by a separate programmer, and the modules tested individually and the integrated together.
- Developing the methods using suitable aids e.g. pseudo code
A step by step approach is followed to break the program into components. This in Good Programming Methods can be done in two designs;
- Top-down design in Good Programming Methods breaks the problem into parts and completes each part then integrates the result. Top-down design methods attempt to avoid the problems of the bottom-up design by;
Starting with the general concept of what is required.
Breaking the whole into component parts
Tackling the component parts in the same manner
The interrelationships between components are decided upon before the components are created so that the final integration of the parts of the whole should be more straightforward. A number of methods in use today for Good Programming Methods may be described as top-down.
- Bottom-up design in Good Programming Methods begins by identifying and solving subtasks that are understood and as other subtasks become clearer, they too are solved and then all the pieces are combined into one whole.
There is one severe danger inherent in the bottom up approach; the various parts may not fit together properly, and, in some cases, considerable effort may be necessary to overcome this problem.
- Typing the instructions
This in Good Programming Methods is done using an editor and programming language.
- Testing the program
If during testing the program an error is discovered, then it is important to go back to earlier stages in order to correct the error. If the error comes from misunderstanding the problem, it will probably be better to start again from the beginning. The program in Good Programming Methods is usually tested using a set of carefully selected ‘test data’. Testing the program may be conducted by executing the program on the computer or by simulating its execution by a manual pencil and paper exercise called a ‘dry run’. There are two basic types of testing in Good Programming Methods;
Functional testing (also called black box testing). This form of testing in Good Programming Methods is based on typical, extreme and invalid data values that are representative of those covered by the specification.
Logical testing (also called white box testing). This form of testing in Good Programming Methods is based on examining the internal structure of the program and selecting the data which gives rise to the alternative cases of control flow, e.g. both paths through an ‘if..then….else..’
Conclusion on Good Programming Methods
Functional testing is often used at the final stage of programming as a basis for accepting or rejecting the program. It is not adequate by itself and logical testing by the programmer during program development tends to be far more beneficial. Debugging is also important in Good Programming Methods. A program fault that causes a program to fail during testing, or after it has been commissioned, is called a bug. The process of finding and getting rid of bugs is called debugging. Decomposition is a term used to describe the process of breaking down a program into component parts in Good Programming Methods.