Transcript
Introduction to Program Logic
FormulationWith Basic C
Chapter 1
Data are raw facts and figures which are meaningless.
Information are useful processed data.
Data and Information
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
Procedure vs. Computer 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.
Computer and 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
Elements of Computer Program
1. Problem Analysis2. Program Design3. Program Coding4. Program Debugging and Testing5. Program Implementation and Maintenance
Program Development Process
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
Problem Analysis
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
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
Program Design Tools
Transaction_program
Input OutputProcess
Data
Sort Compute
Report
Figure 1.1 Example of Structure/hierarchy chart
◦ 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
Program Design Tools
Start
Stop
Print (“Hello”)
Figure 1.2 Example of Flowchart
◦ 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 Design Tools
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 Coding
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
Program 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
Testing and Debugging
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 Documentation
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.
Program Implementation and Maintenance
“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
Evolution of Programming Languages
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
Machine 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
Symbolic 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 Language
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 17th 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
High – level Programming Languages
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
Fourth Generation Language
Sources: NCC Text de la Rosa, Jerald H., Simple Program
Logic Formulation Fully Illustrated
top related