Chapter 1: Introduction To Computer, Program & Programming Language
Chapter 1: Introduction To Computer, Program & Programming Language
Chapter 1: Introduction To Computer, Program & Programming Language
CHAPTER 1: INTRODUCTION TO
COMPUTER, PROGRAM &
P R O G R A M M I N G L A N G UA G E
1 P RO B L E M D E F I N I T I O N ( A NA LYS I S )
Problem definition is also called the analysis phase. The
problem is defined to obtain a clear understanding of the
problem requirement.
The following questions should be asked to get a complete
problem specification:
a. What are the input data?
b. What are the output (desired) data?
c. What formula is to be used?
d. What other assumptions or constraints can be made?
e. What is the expected output screen?
2 A LG O R I T H M D E S I G N
The specifications derived earlier in the analysis phase are
translated into the algorithm.
An algorithm is a step‐by‐step sequence of precise
instructions that must terminate and describes how the
data is to be processed to produce the desired outputs. The
instruction may be expressed in a human language.
2 A LG O R I T H M D E S I G N
An algorithm must satisfy some requirements:
a. Input and output
It must have zero or more input and must produce at least
one output.
b. Unambiguous
Every step in algorithm must be clear as to what it is
supposed to do and how many times it is expected to be
executed.
c. Correct and efficient
It must be correct and efficiently solve the problem for
it is designed.
d. Finite
It must execute its instruction and terminate in a finite
time.
CSC126 FUNDAMENTALS OF ALGORITHMS AND COMPUTER PROBLEM SOLVING 6
PROGRAM DEVELOPMENT LIFE CYCLE (PDLC)
An algorithm can be written or described using several tools:
2 ( i ) Ps e u d o co d e
Use English‐like phrases to describe the processing
task. It is not standardized since every programmer has
his or her own way of planning the algorithm.
2 Problem
Style 1
Problem
Style 2 (Modular design)
Begin Begin
Ps e u d o c o d e s t yl e
1. Subproblem 1 1. Subproblem 1
Task 1,1 2. Subproblem 2
Action 1,1,1 3. End
Action 1,1,2
2. Subproblem 2 1. Subproblem 1
Task 1,2 Task 1,1
Action 1,2,1 Action 1,1,1
Action 1,2,2 Action 1,1,2
End 2. Subproblem 2
Task 1,2
Action 1,2,1
Action 1,2,2
End
2 ( i i ) F l owc h a r t
Use standardized symbol to show the steps the
computer needs to take to accomplish the
program’s objective.
Because flowcharts are cumbersome to revise, they
have fallen out of favour by professional programmers.
Pseudocode, on the other hand, has gained increasing
acceptance.
2
F l owc h a r t Sy m b o l s
2 ( i i ) F l owc h a r t ( c o n t . )
Most computer algorithms consist of at least the following
processes.
a. Get the input (data)
b. Perform the computation (processing)
c. Display the output (results)
3 A LG O R I T H M I M P L E M E N TAT I O N ( CO D I N G )
The algorithm is translated into a computer program by using a
specific programming language, for example C++. The process
called coding, which involves editing, compiling and debugging.
4 P RO G R A M T E ST I N G
Program testing requires testing the completed program to verify
that it produces expected output. A different set of testing data
is normally used to verify that the program works properly and
that it is indeed solving the given problem.
5 P RO G R A M M A I N T E NA N C E
Often, there may be new requirements to be added into the
current program. Making revisions to meet the changing needs
with ongoing correction of problem are the major efforts in the
program maintenance.
As a result, the program codes may be modified, added or
deleted accordingly. Thus, it is very important that a program is
well documented for future development.
ST E P 1 : P RO B L E M D E F I N I T I O N ( A NA LYS I S )
21
Simple Modular
22
Simple Sequential
Defence of Research Proposal (DRP) | 30th of
23
October 2014
Simple Modular
24
Describe FIVE (5) steps of Program Development Life Cycle (PDLC).
Define an algorithm.
Define a flowchart.
Define a pseudocode.