INTRODUCTION TO
PROGRAM LOGIC FORMULATION
Data
Data are raw facts and figures which are
meaningless.
Real data may be characters, numbers, or images
Ex.
patients weight is recorded as 140lb
Height of a man, suppose 65 inches, is a data
His name, suppose Jack, is a data
Characteristics of data
Data are the raw materials of information
Data is a distinct piece of information
Data must be disorganized or unprocessed
Information
Information is the simplified form of data.
When the data is processed or organized it becomes
information.
Approaches in Organizing data:
Sorting
Classifying
Summarizing
calculating
Ex. of Information
Students will often take all of their notes and
handouts from their classes and organize them into
folders.
The average height or weight of several people,
suppose 62 inch, is an information
Procedure vs. Computer Program
Procedure is a logical sequence of actions, either
consciously or subconsciously, to carry out a certain task
or process.
Elements of Procedure
Action – the sequence of steps to be taken
Order – specifies the logical arrangement of the actions
Data – the elements operated upon by the action
Language – the medium of communication
Computer and Program
Computer is an electronic device designed to
manipulate data.
Program is a set of instructions to carry out a
particular task.
Computer program is a set of instructions which
directs computer to perform/carry out a particular
task.
Elements of Computer Program
Operation – define the series of actions to be
followed by the computer
Order - specifies the logical arrangement of the
operations
Data - the elements operated upon by the
operations
Language – the medium by which the operations
are communicated
Understanding the Programming Process
1. Problem Analysis
2. Program Design
3. Program Coding
4. Program Debugging and Testing
5. Program Implementation and Maintenance
Problem Analysis
It is the step wherein a good definition of the problem
are considered and the program specification are
developed.
Program specification is a document being prepared
as a part of system design which contain the following:
Program Background
I/O Specifications
Program Methodology
Program Design
It is the stage where logical sequence/ arrangement
of operations for the solution have to be planned,
consistent with the program specifications.
Algorithm is a written series of logical instructions
which accomplish solution to a problem.
Algorithms are developed by using any of the
program design tools such as structure charts,
flowcharts, decision table, pseudo codes, etc.
Program Design Tools
Commonly used program design tools:
Structure/hierarchy chart - depicts the overall
organization of a program, it shows how
segments/modules are defined and how they relate to
one another
Transaction_program
Input Process Output
Data Report
Sort Compute
Figure 1.1 Example of Structure/hierarchy chart
Program Design Tools
Flowchart – it shows graphical presentation of an
algorithm
- also known by other names such as block diagram,
logic diagram, run diagram, flow diagram and system
chart
Start
print(“Hello”)
Stop
Figure 1.2 Example of Flowchart
Program Design Tools
Decision table – is a table showing the actions to be
taken for different combinations of condition
(conditions and actions)
Pseudo codes – it describes the logical flow of the
solution to a problem through the use of English–like
statements (structured English)
Program Coding
Coding – is the process of writing the actual program steps
in the proper format for a particular programming language
Factors that may affect the programming language used are:
Suitability
Integration
Standards
Portability
Development speed
Program Testing and Debugging
Testing – refers to the process of verifying the accuracy or
workability of the program
Debugging – refer to the process of locating/identifying and
correcting the errors in the program
Two main types of errors:
Syntax error – occurs when the programmer has not followed the
rules of the programming language
Logic error – occurs when running a program produces incorrect
results
Testing and Debugging
Source code – a computer program before it is compiled
Object code – the machine language version of the
computer program generated after the program source
code is compiled
Compiler – is a system special software which translates
a programming language into machine language and
assembles the program to check errors upon correct
usage of programming language
Program Documentation
It entails the preparation of a document describing
how the program is constructed, together with all
the significant resources surrounding its creation
This phase is performed at every stage of the
program development such that an output of each
development stage is documented
Program Implementation and Maintenance
It is the final stage of program development life
cycle which involves running the system and
updating the software as needed
Program continually be modified or revised to cope
with changes and persistently be useful.
Evolution of Programming Languages
“Programming languages were developed to
facilitate communication between the user and the
computer.”
Programming Language Era
Machine Language
Symbolic Language
High – level Language
Fourth Generation Language
Machine Language
It is the only language that computer can
understand which consists of a string of ones and
zeros (1s and 0s)
It is machine-dependent
Computer ready to execute it
Symbolic Language
Assembly language/Language processor – it
enabled programmer to write instructions that used
symbols, words or abbreviations which stand for
certain operations
Assembler – it translate the assembly language into
machine language
It is machine-dependent
High – level Language
Compiler/interpreter – it is a special software
which act as language translator for high-level
language
It is machine independent
The use of high-level language means lesser time
in writing program
High – level Programming Languages
Some of the high-level programming languages:
Fortran (Formula Translation)
Started in 1954 by IBM Laboratory
It is a scientific language used in research applications or
analysis of problems in science, engineering and sometimes in
business
Lisp (List Processing)
Developed in 1958
Designed for the manipulation of symbols and patterns
One of the most popular languages for Artificial Intelligence
High – level Programming Languages
Cobol (Common Business Oriented Language)
Developed in 1959 by USA Army
Designed for administrative purposes and among its significant
features are its file processing, editing, and I/O capabilities
PL/1 (Programming Language 1)
Developed in the middle of 1960s by IBM
Characterized as general-purpose and procedural applicable to
business as well as scientific applications
Basic (Beginners All – purpose Symbolic Instruction Code)
Developed in 1965 by John Chimney and Thomas Kurt at
Dartmouth College, New Hampshire, USA
Described as conversational, procedure-oriented and general-
purpose programming language
High – level Programming Languages
Prolog (Programming in Logic)
Developed in 1972
A logic-language based on logical rewrite systems that can
support artificial intelligence and expert system
Pascal
Named after Blaise Pascal, a brilliant 17 th century
mathematician
Designed by Niklaus Wirth at the Institute fur Informatik in
Zurich (1971)
Intended as an instructional language
RPG (Report Program Generator)
Designed for programming business-oriented reports
High – level Programming Languages
ADA
Named after Lady Ada Byron
Conceptualized in 1974 by the US Department of Defense for
military applications
C (Successor to B)
Designed by Dennis Ritchie during 1969 to 1971
One of the most powerful languages at all times which is very
well structured, powerful, portable, and flexible
Smalltalk
Developed at Xerox Palo Alto Research Center in 1972
An extreme object oriented language
High – level Programming Languages
C++(C + 1 in the C language)
Developed in 1985 at AT&T Bell Laboratory by Bjarne
Stroustrup
One of the most popular object-oriented languages
Java
Developed in 1994 by James Gosling at Sun Microsystems
Combination of C++ and Smalltalk, developed to be as
portable as possible
Fourth Generation Language
It aims to make programming easier even to non-
technical people
Three categories of Fourth Generation Language:
Database and Query Languages
Natural Languages
Intelligent Languages