class-note-PROGRAM DEVELOPMENT
class-note-PROGRAM DEVELOPMENT
Definition of a program:
A computer program can be defined as a list of instructions issues to the computer to
perform a particular task.
Debugging is also done in this phase. It is the process of detecting and removing
errors (also known as bugs) in a computer program. There are 3 types of errors that
may be found in a program:
1. Syntax error: occurs when a programmer disobeys any of the rules of the
language e.g., misspelling of a keyword, incorrect format of a statement, etc. This
type of error can be detected by an interpreter or a compiler because a program
cannot run with syntax errors present.
2. Semantic or runtime error: has to do with what statements mean, and not how
they are written. A program can run with semantic error present but will produce
erroneous results. Examples of such errors are mismatch of data type, endless
loop, etc.
3. Logic error: occurs if a program produces an unintended or undesired output. A
logic error is likely to occur if a programmer does not understand a problem very
well. A program will run with logic error present but will produce a wrong result.
E.g., when a program to multiply 2 by 3 gives 5 instead of 6.
Program documentation: involves writing a detailed description about the program,
how to use it and how to maintain it. Proper documentation starts within a program
using comments and proper naming of variables. Program documentation helps a
programmer to maintain and to redesign a program.
EXAMPLES OF INTERPRETED PROGRAMS AND COMPILED PROGRAMS
Compilers and interpreters are the two examples of translators. A translator is a
program that converts program instructions written in a particular programming
language to machine codes, which can be understood and executed by the
computer.
Interpreter: An interpreter, on the other hand, does not produce an Object Code, but
executes the Source Program one statement at a time.
Examples of interpreted programs and compiled programs are shown in the table
below:
Interpreted programs Compiled programs
BASIC C
PHP C++
Python C#
Perl Pascal
Asp FORTRAN
ALGOL