You are on page 1of 1

The idea was to allow the programmer to think about a problem in terms familiar to him and relevant to

the problem rather than have to worry about the machine. So, for instance, if he wanted to know the
larger of two quantities, A and B, he could write IF A IS GREATER THAN B THEN BIGGER = A ELSE BIGGER
= B rather than have to fiddle with several machine or assembly language instructions to get the same
result. Thus high-level languages enabled the programmer to concentrate on solving the problem at
hand, without the added burden of worrying about the idiosyncrasies of a particular machine. However,
the computer still could only execute instructions written in machine language. A program called a
compiler is used to translate a program written in a high-level language to machine language. Thus we
speak of a FORTRAN compiler or a COBOL compiler for translating FORTRAN and COBOL programs,
respectively. But that’s not the whole story. Since each computer has its own machine language, we
must have, say, a FORTRAN compiler for a Lenovo ThinkPad computer and a FORTRAN compiler for a
MacBook computer. 1.2 How a Computer Solves a Problem Solving a problem on a computer involves
the following activities: 1. Define the problem. 2. Analyze the problem. 3. Develop an algorithm (a
method) for solving the problem. 4. Write the computer program that implements the algorithm. 5. Test
and debug (find the errors in) the program. 6. Document the program. (Explain how the program works
and how to use it.) 7. Maintain the program. There is normally some overlap of these activities. For
example, with a large program, a portion may be written and tested before another portion is written.
Also, documentation should be done at the same time as all the other activities; each activity produces
its own items of documentation that will be part of the final program documentation. 1.2.1 Define the
Problem Suppose we want to help a child work out the areas of squares. This defines a problem to be
solved. However, a brief analysis reveals that the definition is not complete or specific enough to
proceed with developing a program. Talking with the child might reveal that she needs a program that
requests her to enter the length of a side of the square; the program then prints the area of the square.

You might also like