Lesson 2-Basics of Program Development
Lesson 2-Basics of Program Development
1|P a g e
He who teaches is a teacher.
He who cooks is a ____________. (a cooker?!?)
And… he who programs is a programmer.
Thus, we say that a programmer is the key person charged of producing a program. From our several
definition of a program listed above, it becomes imperative to expect the following competencies from a
programmer:
2|P a g e
Programming is also a creative task. Designing an appropriate solution to a problem also entails that the
program-developer is able to conceptualize a presentation that is fit and suitable to the target end-users. The
interface may be enhanced with colors and layout schemes to better provide an interaction of least eye glare,
reduced monotony and engaging user interaction. Because a program is a product in itself, user acceptability is
very important. When a user is satisfied with the use of the program because of simplicity, ease of use and
functionality, the program is characterized as user-friendly.
The figure below depicts the several phases of the program development process.
3|P a g e
o If so, how many and of what type?
o Where is the input expected to come from—the program user, generated automatically by the
computer, or from an external file?
o Is there a format requirement when receiving the input?
o At what stage of the operation will the inputs be received?
PROCESS
o What steps are appropriate to covert the input to the desired output?
o What operators are to be used to produce the results?
o Is the solution complex and requires multi-step operations?
o What is the proper sequence of the steps if the operations are compound?
OUTPUT
o Is there an output requirement?
o If so, how many and of what type?
a. Where is the output expected to be directed—on the display screen, on a hard copy or
stored to a file?
b. Is there a format specification for the output?
o When are the outputs expected to be displayed?
Using the examples given earlier, let us try sorting out the requirements using the IPO approach.
Example 1: From a user’s input of two nonzero, nonnegative integer, determine their greatest
common factor (GCF) and least common multiple (LCM).
o Input Requirement
2 input values : nonzero, nonnegative integers (whole numbers)
o Process
Compute for the Greatest Common Factor (GCF): an integer
Compute for the Least Common Multiple (LCM): an integer
o Output Requirement
2 output values: greatest common factor and greatest common multiple: both are integers
The manner may vary as to how you specify and put into words the entries under each domain of the IPO.
That is acceptable. This is where differences may emerge among programmers. Just the same you should be
pointing out to the same items. What is important is that the IPO entries are complete, clear and consistent. You
may need to draft and re-work a multiple number of times until you are convinced of its clarity and completeness.
After which, it is time to move on to the second phase.
4|P a g e
Phase II: Solution Mapping
Phase II is the Solution Mapping stage. This entails planning the logic of the solution and requires
specifying the details and steps of the solution. It is stressed that the steps and opertions should be logical and
directed towards the solution of the problem. The creative aspect is tentatively not the priority at this stage. In
designing solutions, remember that form follows function. In other words, the main focus is the correctness and
completeness of the solution; anything pertaining to the design will only be secondary. You should not devote
excessive time in the aesthetics of the solution and forgetting the heart of the problem. A working and correct
program with simple presentation is desired rather than an incorrect program even though enhanced with colorful
layout.
The steps and operations you have identified in the Process domain of the IPO approach may not yet be
detailed. In this stage, however, it is necessary to spell out the individual steps needed to carry out the solution.
To reiterate, a program is expected to be detailed since you needed to design instructions for the computer machine
to execute. Our inability to bring details may result to non-completeness of our desired results.
In programming, we speak of a solution as an algorithm.
What is an algorithm?
The word algorithm stem from Algoritmi, the Latin form of the name of Abū Abdallāh Muhammad ibn
Mūsā al-Khwārizmī, a Persian mathematician, astronomer and geographer (among others of his achievements)
whose systematic approach to solving linear and quadratic equations led to algebra. Al-Khwarizmi is considered
the founder of algebra.
An algorithm is a detailed, sequenced and ordered set of instructions designed to solve a problem. An
algorithm is basically a program minus the specific programming language. In presenting our algorithm, two
schemes are available—using pseudocodes or using flowcharts. A pseudocode is like what it says—pseudo which
means false; so we have false codes. This means that the codes we specify need not make use of any programming
language codes. It may be expressed using English-like structure and may simply be enumerated to signify
sequence and order.
PSEUDOCODES
Pseudocodes may be thought of as drafts for your programs. The pseudocode observes a free format and
presentation may be as simple as enumerating the steps to be undertaken to complete the solution.
In the first example, let us design our solution or algorithm using pseudocodes, as follows:
Compute for the Greatest Common Factor (GCF):
o Divide the 2 values starting with the smaller value as divisor.
o When both values do not return a remainder, the divisor is the GCF, this may now be
printed and execution stops.
5|P a g e
o If not, repeatedly reduce the divisor by 1 and perform check of remainder until a GCF is
found.
o The least possible GCF is 1 for any valid input values.
Another way to specify the pseudocode is as follows:
1. Determine the smaller value between the inputs, tag this as S
2. Set a divisor starting at S
3. If S is equal to 1, stop. This is the
GCF. Otherwise, proceed to step #4.
4. Divide individually the 2 inputs by S
5. If no remainder exists for both inputs, stop. The GCF
is S. Otherwise proceed to step #6.
6. Decrease S by 1 and goto step #3
FLOWCHARTING
Flowcharts are graphical representation of the solution to the problem. Flowcharting is a common choice
among programmers for algorithm presentation purposes. The non-programmer will most likely be able to
comprehend better the flow of operations when presented a flowchart rather than the text-based pseudocodes. The
flowchart makes use of symbols such as ovals, rectangles and diamonds, each one denoting specific action and
purpose.
Example #2: Compute for the tuition fee for a given number of units and per-
unit rate.
Pseudocode:
The equivalent flowchart for the above pseudocode is presented beside this
example.
The sample flowchart observes a simple sequence. There are 3 identifiers used—units, rate and fee. When
the user types in the units and rate, the value is mapped with the identifier units and rate, respectively. The
6|P a g e
computed product of units and rate is mapped with the identifier fee. Finally, the computed fee is displayed as an
output.
Flowcharting is especially designated a separate section in this manual. Sample exercises are provided for
better understanding and for practice purpose.
7|P a g e
working knowledge of a programming language. Being able to confidently navigate and use advanced features of
the language will result to a more sophisticated and powerful program yet simplified for the users.
Coding involves the translation of the solution into a statement consistent with the syntax of the
programming language. A language’s syntax dictates the structure and organization of the statements. These
statements shall be converted by the programming language itself into a format that the computer is able to
recognize and execute.
8|P a g e