WEEK 2 DATE:…………………………
TOPIC: PROGRAM DEVELOPMENT II
Learning Objectives:
At the end of this lesson students should be able to:
Steps involved in Program development
Description of each of the stages above
Examples of (i) Interpreted programs (ii) Compiled programs
SUB-TOPIC 1: STEPS INVOLVED IN PROGRAM DEVELOPMENT
Before the coding of a good program, there must be a proper planning and steps on
how the problem or program will be solved. The steps include the following:
i. Problem Definition
ii. Problem Analysis
iii. Flowcharting
iv. Desk Checking
v. Problem Coding
vi. Program Compilation
vii. Program Testing /debugging
viii. Program Documentation
ix. Program Running
x. Maintenance
Description of each of the stages
1. Problem Definition: The programmer is expected to first understand the problem and
know exactly what the program entails. The definition of the problem must be
unambiguous. This step is very important for the completion of a satisfactory program. It
is impossible to solve a problem without a clear understanding and identification of the
problem. Inadequate identification of problem leads to poor performance of the system.
The programmer should put his significant portion of time in problem identification. If he
does not spend enough time at this stage, he may find that his well-written program fails
to solve the real problem.
2. Problem Analysis: The programmer is expected to analyze the problem to determine how
it will be solved. This stage is the formal description of the task. It includes the specification
of inputs and output processing requirements, system constraints and error-handling
methods.
3. Flowcharting/Planning Solution: Before a program is written, the algorithm or flowchart
for that program must be drawn and tested before the actual coding of the program and
this is called Dry Running a program. The flowchart therefore, is a diagrammatical
representation of the steps involved in writing a given program. This involves putting the
steps in program development in diagrams.
4. Desk Checking: This involves manual checking of the logic of a program for correctness.
Desk checking is an informal manual test that programmers can use to verify
coding and algorithm logic before a program launch. This enables them to spot
errors that might prevent a program from working as it should.
5. Problem Coding (Program Writing): This is the actual writing or coding of the program in
a programming language, e.g. Basic, VBasic, FORTRAN, PASCAL, and COBOL etc. This stage
translates the program design into computer instructions. These instructions are the
actual program or the software product. During this step, the programmer follows
language syntax to write the instructions of the program. The coding is simply converting
the design (algorithm or flowchart) using the language rules (syntaxes) to write the
instructions.
6. Program Compilation: When the coding process is complete, the program will be
compiled if it necessary. It is necessary to compile if the programming language allows it.
The codes (instructions), which are usually written in high-level or object-oriented
language, are in the human readable form. Here, the codes are translated into computer-
executable instructions (machine language) through compilation/interpretation.
7. Program Testing/Debugging: This is like proof reading. The written program is tested, and
errors corrected to check if the program can solve the problem it is expected to solve. This
stage is the validation of the program. Testing ensures that the program performs
correctly the required tasks. Program testing and program debugging are closely related.
Program debugging is the discovery and correction of programming errors (bugs). Few
programs run correctly the first time, so debugging is an important and time-consuming
stage of software development. Testing is essentially a later stage of debugging in which
the program is validated by trying it on a suitable set of cases.
8. Program Documentation: This involves writing a detailed description about the program
and some specific facts pertaining to the usage and maintenance of the program. This
stage is the documentation (recording explanation) of the program features so that those
who use and maintain it can understand it, and the program can be extended to further
applications. Documentation is a stage of software development that is often overlooked.
Yet, proper documentation is not only useful in the testing and debugging stages but also
essential in the maintenance and redesign stages.
9. Program Running: This is the actual running or execution of the program with the
compiler or interpreter to check if the desired output is generated.
10. Maintenance: It is the process of updating or amending a previously written program for
current use.
Sub-topic 2: Comparison between Interpreter and Compiler (Compiled Program)
Interpreted and Compiled Program
A Compiler translates the entire program written in a high-level language into a low-level
language, which can be the assembly or even the machine language of a computer. The low-
level language is called the source program and its translated version is the object program.
An Interpreter does not produce an object program. It may translate the source program line
by line into an internal intermediate form that it can execute, or it may simply execute the
source program statements directly.
Characteristics of Compiler
i. Spends a lot of time analyzing and processing the program
ii. The resulting executable is some form of machine-specific binary code.
iii. The computer hardware interprets (executes) the resulting code program
iv. Execution is fast
Examples of some Interpreted programs/languages are as follows:
1. APL, ASP Web scripting language, BASIC (although Dartmouth BASIC was compiled as
many modern BASICs), thinBasic, JavaScript, Jscript.
2. Equation manipulation and solving systems: GNU Octave, IDL (Programming language),
Mathematical, MATLAB
3. Euphoria (Interpreted or compiled), Game Maker Language, Inform, Lava, Perl, PHP,
Lisp, Python
4. Spreadsheets: Excel
Characteristics of Compiler
1. Relatively little time is spent analyzing and processing the program
2. The resulting code is some sort of intermediate code
3. The resulting code is interpreted by another program
4. Program execution is relatively slow
Examples of some Compiled program are as follows:
1. Ada, ALGOL, Algol 60, Algol 68, C, C++, Objective-C, COBOL, Cobra, Common Lisp,
Delphi, Eiffel, FORTRAN, IBM
2. RPG, Java, Modula2&3, Pascal, Visual Basic, Visual FoxPro, Visual Prolog.
How a Compile Works
The figure below shows the parts of a compiler. The figure contains the constitute parts of a
typical compiler. The brain of computer is the parser. The parser knows the syntax (rule) of
the source language or grammar rules that determine how the source statements are
written. The parser controls the compilation process.
Whenever the parser needs more of the source program statements to work on, it calls upon
the scanner. The scanner reads in the source program statement and break it into a sequence
of tokens – words, numbers, identifiers, operators, etc.
A–b+c
`
Scanner
Code
Parser Generator
C+b=a
MOV ax, WORD PTR b
ADD ax, WORD PTR c
MOV WORD PTR a, ax
How an Interpreter Works
Just like the compiler, an interpreter also has a parser that controls it. Its scanner does the
same job as that of the compiler. However, an interpreter has an executor instead of the
code generator.
a–b+c
Scanner
c+b=a Parse Executor
r
Source Executable
Machine
Code Code
Preprocessing Processing
Compilation
Source Intermediate
Interpreter
Code Code
Preprocessing Processing
Interpretation
Flow Diagram on how Compiler and Interpreter works
Assignment
1. List three languages that can be implemented as compiled or interpreted.
2. What are the useful techniques in program design?
3. What are the goals of preparing a test plan?
4. List out steps involve in program development.
Class Activities
1. ____ reads in the source program statements and hands it to the parser.
2. State two examples each of programming languages that the programs are:
i. Compiled
ii. Interpreted
Reading Assignment
Read and summarize the next week topic
WEEKEND ASSIGNMENT
1. A good programmer should be able to:_______
(a) Design effective algorithm (b) Translate source program into object
programs
(c) Write program that do not need debugging (d) Make a machine programmable
2. The first stage in program development is________
(a) problem solving (b) Problem analysis (c) Problem definition (d) problem refining
3. Which of the following is a feature of a good program?
(a) Versatility (b) Eligibility (c) Rigidity (d) capability
4. Desk checking refers to:___________
(a) Refining algorithm (b) writing algorithm (c) refining flowchart (d) drawing
flowchart
5. The last stage in program documentation is ________
(a) Program compilation (b) program documentation (c) program writing (d)
program testing