WRITING THE PROGRAM
a. Choosing a Programming Language. With the problem defined, and the
solution designed, the programmer can proceed with the actual writing of the program.
First, the programming language best suited to the specific application must be chosen.
For example, COBOL is normally used for business applications, FORTRAN for
science. Sometimes, a programmer will not have a choice of languages, the selection
having been made at a higher level. COBOL, for example, is often required for
business because of its readability. (Programming languages will be discussed more
fully later in the lesson, in Section II.)
b. Desirable Program Qualities. There is always more than one way to code a
program to provide the correct solution. The programmer should, therefore, keep in
mind not only solving the problem, but making the program reliable and user friendly.
(1) Reliability. Programs should consistently produce the correct output.
example, all checks and deposits on a bank statement should be accurately reflected
with 0 mistakes.
(2) Will it work under all conditions? What will the program do if a person's
age is input as 4,892? A good program that uses the age of a person as input should
have a test, or error trap, for incorrect ages built onto it. Otherwise, despite the internal
logic of the program, "a garbage in, garbage out" syndrome will prevail.
(3) Readability and understandability. The programmer should do
everything possible to ensure that the user can read and understand the program
easily. For example, data names should be descriptive, not short and cryptic. The
format should enhance readability of statements, not cloud meaning. A variable holding
a name need not be called "x$" when it could be called "names $." (The dollar sign is
used to represent text rather than numbers.)
revision are easily accomplished. By writing a program in independent segments, for
example, a change in one section will not automatically necessitate a change in others.
COMPILING, DEBUGGING, AND TESTING THE PROGRAM
a. Compiling. Most programs are written in hi h-level or assembly language.
Once written, they must be compiled or translated into a form that computer will
understand. A language translator program does the job of encoding (converting) the
program into machine executable form. As an aid to he programmer, a list of errors
detected during the compiling process is generated. The list includes syntax errors:
violations of the rules associated with the particular programming language (for
example, data entered in the wrong column), misspellings of language keywords (such
as WRITE or COMPUTE), grammatical and punctuation errors.