Professional Documents
Culture Documents
Basic Programming Concepts: Continuation of Lesson 1
Basic Programming Concepts: Continuation of Lesson 1
Concepts
Continuation of Lesson 1
Compilers and Interpreters
Compilers – is needed to translate a program
written in a compiled language into machine
understandable code before you can run the
program on your machine.
Interpreter – is needed to translate the high-level
instructions into machine understandable
instructions at runtime. A program written in an
interpreted language can be run immediately after
you finish writing it, or while you are writing it.
Four Step Process in
writing & testing the program:
1. writing and editing the program
2. compiling the program
3. linking the program with the required
Blackbox Testing
Whitebox Testing
5. Program Documentation
6. Maintenance
Stages of Program Development
1. Defining & Understanding the
problem – At this stage we list the
information related to the problem and the
requirements from the computer. It consist
of identifying what kind of input to expect,
how the input is to be processed and what
kind of output is required.
Stages of Program Development
2. Planning/Develop the Solution– in developing the
solution we will need detailed plans. We will need to
specify what the program does by dividing it into a set of
well-defined and manageable chunks. We will also need
to detail the way in which these chunks connect and what
information each chunk will need when it executes.
Tools in program logic formulation/Ways of planning the
solution
structure charts – used to designed the whole program
algorithm/pseudocode used to design the individual
parts of the program
flowcharts
Stages of Program Development
3. Implementation/Coding the Program –
After planning the solution, our next step is
to start writing the program codes. Coding is
the act of actual writing the computer
program. This stage requires an extensive
knowledge in the programming language to
be used.
Stages of Program Development
4. Testing/Running/Checking the program –
At this stage the programs are tested by running it
and observing the output it produce and the
programmer makes sure that the program
performs the way it is intended.
Debugging – is the process of finding and correcting
errors in the program, it means to detect, locate and
correct logical or syntax errors.
2 Types of Testing
Blackbox Testing – system test engineer & user
Whitebox Testing - programmer
Stages of Program Development
Two Types of Testing
1.Blackbox Testing – gets its name from the
concept of testing the program without
knowing what is inside it, without knowing
how it works. The test engineer uses
requirements and his knowledge systems
development and the user working
environment to create a test plan that will
be used to test the system as a whole.
Stages of Program Development
Two Types of Testing
2. Whitebox Testing – assumes that the
tester knows everything about the program.
The programmer knows exactly what is
going on inside the program. The
programmer makes sure that every
instruction and every possible situation has
been tested.
Stages of Program Development
5. Program Documentation – usually
includes the necessary information about the
requirements of the program – the operating
system and hardware requirements needed for
the program to run. Typical program
documentation includes the origin of the
problem, brief narrative description of the
program, logic tools, etc. It also contains
technical information such as who created the
program and who to contact, and instructions
on the use and maintenance of the program.
Stages of Program Development
6. Maintenance – is the final stage in
programming or updating the program. This
is where the programmer is tasked to keep
the program running smoothly and updated
with the development and changes in the
field where it is used.
Program Logic Formulation
It provides the tools needed to design the
right solution by helping you define and
identify the problem, its requirements and
the needed instructions.
Tools in program logic formulation
algorithm
pseudocode
flowcharts
structure charts
Tools in program logic formulation
Algorithm – is a list of steps(similar to a
recipe) for solving a problem. Designing an
algorithm to solve a problem requires you to
write a step-by-step procedures and then
verify that it solves the problem as intended.
a typical algorithmic steps in solving a problem:
1. Read the data
2. Perform computations
3. Display the results
Problem:
The price of apples per kilo is 50 pesos. If
the customer buys 3 or more kilos of apples,
5 pesos will be discounted for every kilo.
Determine the total cost of apples
purchased.
Algorithm:
1. Enter the number of Apples.
2. Compute the total cost of apples in pesos
3. Display the Total Cost of Apples in pesos.
The following are algorithmic refinements:
1. Enter the number of Apples.
1.1 Input quantity of apples purchased in kilos
2. Compute the total cost of apples in pesos
2.1 If quantity of apples is equal or more than 3
kilos.
2.2 Compute cost of apples with discount
Else
2.3 Compute cost of apples without discount
3. Display the Total Cost of Apples in pesos.
Tools in program logic formulation
Pseudocode –It is an English like
nonstandard language that lets you state your
solution with more precision than in plain
English. Algorithm refinements are also
expressed in pseudocode.
Pseudocode uses indentation and often
use the statements, if then and else to show
the logical structure of the algorithmic steps.
Refined algorithmic steps expressed in Pseudocode:
1. Enter the number of Apples.
1.1 Input quantity of apples purchased in kilos
2. Compute the total cost of apples in pesos
2.1 If quantity of apples in kilos >= 3 kilos
2.2 Compute cost of apples with discount
2.2.1 Compute for the Total Discounts
Total Discounts=Qty. of Apples in Kilos *Discount
Cost of Apples=(Qty. of Apples in Kilos*Amount of
Apples per kilo) – Total Discounts
Else
2.3 Compute cost of apples without discount
Cost of Apples=Qty. of Apples in Kilos*Amount of Apples
per kilo
3. Display the Total Cost of Apples in pesos.
Tools in program logic formulation
Flowchart – is a diagrammatic or graphical
representation that illustrates the sequence of
operations to be performed to get the solution
of a problem.
Variable – memory cells used for storing a
program’s input data and its computational
results are called variables. It is the
representation of the idea that is changing.
Constant – named item used to specify a