Algorithms &
Programming
PROCESS OF PROGRAM DEVELOPMENT
PROCESS OF PROGRAM
DEVELOPMENT
S TA G E S O F P R O G R A M D E V E L O P M E N T P R O C E S S
1 . P R O B L E M A N A LY S I S A N D P L A N N I N G :
The Planning stage is the stage where
programmers decide and define the tasks that
should be performed by the program.
2. PROGRAM DESIGN/PROGRAM MODELLING:
This stage deals with the flow of the program, the way it
should produce output and gather inputs, the interface or the
working environment of the program, and how it should be
used.
The software developer makes use of tools like algorithms and
flowcharts to develop the design of the program.
o Algorithm
o Flowchart
F L O W C H A RT I N G S Y M B O L S
A flowchart is a diagram made up of boxes, diamonds and
other shapes, connected by arrows - each shape represents a
step in the process, and the arrows show the order in which
they occur.
F L O W C H A RT I N G S Y M B O L S
G E N E R A L R U L E S F O R F L O W C H A RT I N G
1. All boxes of the flowchart are
connected with Arrows. (Not
lines)
G E N E R A L R U L E S F O R F L O W C H A RT I N G
3. The Decision symbol has two exit
points; these can be on the sides or
the bottom and one side.
G E N E R A L R U L E S F O R F L O W C H A RT I N G
3. The Decision symbol has two exit
points; these can be on the sides or
the bottom and one side.
G E N E R A L R U L E S F O R F L O W C H A RT I N G
3. The Decision symbol has two exit
points; these can be on the sides or
the bottom and one side.
G E N E R A L R U L E S F O R F L O W C H A RT I N G
4. Connectors are used to
connect breaks in the
flowchart.
Examples are: • From one
page to another page. • From
the bottom of the page to the
top of the same page.
G E N E R A L R U L E S F O R F L O W C H A RT I N G
5. All flowcharts start with a
Terminal or Predefined
Process (for interrupt
programs or subroutines)
symbol.
G E N E R A L R U L E S F O R F L O W C H A RT I N G
6. All flowcharts end with a terminal or
a contentious loop
Example 1: Suppose you are required to design an algorithm for
finding the average of six numbers, and the sum of the numbers is
given. The pseudocode will be as follows:
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Flowchart
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Example 2: The following pseudo-code describes an algorithm
which will accept two numbers from the keyboard and calculate
the sum and product displaying the answer on the monitor screen.
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Decision Structure or Selection Structure
Selection structures are also called case selection
structures when there are two or more alternatives to
choose from.
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Decision Structure or Selection Structure
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Decision Structure or Selection Structure
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Decision Structure or Selection Structure
ALGORITHM/PSEUDOCODE TO
F L O W C H A RT E X A M P L E S
Practice Activity -
WRITING ALGORITHM and Flowchart
• Finding the area of square.
Input- Read L
Output-" Print area"
Practice Activity -
WRITING ALGORITHM and Flowchart
2. Finding the area of Rectangle.
Input- Read a,Read b
Output-Print "area"
Practice Activity -
WRITING ALGORITHM and Flowchart
3. Calculating the average of three numbers.
Input - Read A,B, C
Output- Print Average
WRITING ALGORITHM and Flowchart
Activity 7
2. Determine Whether Student A Passed or Not
• Input grades of 4 subjects S1, S2, S3 and S4
• Calculate the average grade
• If the average grade is less than 85, print "FAIL", else print "PASS".
3. CODING THE PROGRAM:
It is the process of expressing the fully detailed algorithm to a
standard high-level programming language.
Coding is the act of actual writing of the computer program.
3. CODING THE PROGRAM:
Coding is generally a very small part of the entire program
development process and also a less time-consuming activity
in reality.
3. CODING THE PROGRAM:
For effective coding some of the guide lines which are applied
are :
o Use of meaningful names and labels of variables,
o Simple and clear expressions,
o Modularity with emphasis on making modules generalized,
o Making use of comments and indenting the code properly,
o Avoiding jumps in the program to transfer control.
4. TESTING AND DEBUGGING:
The Testing Stage is where the programmer makes sure that
the program performs the way it is intended.
A. DESK CHECKING
B . T R A N S L AT I O N
C. DEBUGGING
A. DESK CHECKING
Process of sitting in a desk and checking the source code,
proofreading it for obvious syntax errors as well as looking for
logical errors which are not immediately detectable.
TYPES OF ERRORS
Runtime Errors – a program errors that occurs while the program is
running
Syntax Errors- Violations of the rules of a specific programming
language.
Logical Errors- Mistakes in the algorithm or program design
which are not easily detected.
B. T R A N S L AT I O N
It is the conversion of the source code to the internal
instructions that the computer required.
C. DEBUGGING
It is the process of detecting, locating and correcting logic
errors (bugs) by submitting a translated program to the
computer for execution and seeing what happens.
SOME COMMON ERRORS WHICH MIGHT OCCUR IN
THE PROGRAMS INCLUDE:
• Uninitialization of variables.
• Reversing of order of operands.
• Confusion of numbers and characters.
• Inverting of conditions e.g., jumping on zero instead of on
not zero.
5 . D O C U M E N T AT I O N :
It is the detailed description of a program’s algorithm, design,
coding method, testing and proper usage.
5 . D O C U M E N T AT I O N :
Documentation also contains technical information such as
where and who created the program, who contact when there’s
a problem with the program and instructions on the use and
maintenance of the program.
6. MAINTENANCE:
The final stage in programming is in maintaining or updating
the program.
Maintenance becomes essential in following situations:
o Change in specification,
o Change in equipment,
o Errors which are found during the actual execution of the program
ACTIVITY8: PROGRAM DEVELOPMENT CYCLE
A. What is program development cycle? What it is used for? What are
the steps in program development cycle?
B. Explain each step
C. Describe the types of errors.