prelims handouts
TRANSCRIPT
-
8/3/2019 Prelims Handouts
1/99
PROGRAM
A set of instructions given to a
computer which the computer will
do or follow Also called as Software
-
8/3/2019 Prelims Handouts
2/99
Note:
Software is not just theprograms but also all
associated documentation andconfiguration data which is
needed to make theseprograms operate correctly.
-
8/3/2019 Prelims Handouts
3/99
Programming
The act of preparing
or writing a program
using a particularlanguage called aprogramming
language.
-
8/3/2019 Prelims Handouts
4/99
Programmer
Someone who does the
programming or the act
of creating a program. It could be you or
someone who already
knows how to programa computer.
-
8/3/2019 Prelims Handouts
5/99
Types of Software
-
8/3/2019 Prelims Handouts
6/99
System Software
The kind of software that controls and
takes care of the working computer
and overall functioning of the system. The best example of system software
is the operating system
Ex. Windows XP, Windows ME,Windows XP, Linux, Unix,Apples OS
-
8/3/2019 Prelims Handouts
7/99
Application Software
Software that generally suited to
perform a particular task or
function Ex. Word Processor,
Spreadsheet, Computer Games,
Desktop Publishing Software andGraphics Program
-
8/3/2019 Prelims Handouts
8/99
Types of Productionof Software
-
8/3/2019 Prelims Handouts
9/99
Commercial Software
These are created and marketedby big software companies
Usually made by a team of expertsand computer professionals andare sold for quite a big price
Ex. Microsoft Windows OS, MSOffice
-
8/3/2019 Prelims Handouts
10/99
Shareware
Because of the high cost of
software, many individual
programmers made shareware Shareware, however is not really
shared but is lent or allowed to be
tested for a time before a fee isrequested
-
8/3/2019 Prelims Handouts
11/99
Freeware
Given for free or allowed to be
downloaded from the Internet.
Programmers who createfreeware do it as a service to
users who cannot afford
programs
-
8/3/2019 Prelims Handouts
12/99
Designing a Program
-
8/3/2019 Prelims Handouts
13/99
1. Determine Your
Objectives Reason why you need to createthe program
Define what the problem is
-
8/3/2019 Prelims Handouts
14/99
2. Devise a Method to
Achieve your Objective Break the problem into logical
steps to achieve the solution You can use the flowcharts
Type of approach
-
8/3/2019 Prelims Handouts
15/99
3. Write your Solution orMethod as a Computer
Program
Use a particularlanguage to
code yourprogram
-
8/3/2019 Prelims Handouts
16/99
4. Run and Test the
Program Debugging the process of
checking and correcting theerrors
Bug (Error in the computertermed by Grace Murray Hopper)
-
8/3/2019 Prelims Handouts
17/99
Lady Augusta Ada
First programmer
Countess of Lovelace, Daughter
of Lord Byron, Credited with innovating the loop,
or repetition in Analytical Engine
-
8/3/2019 Prelims Handouts
18/99
Types of Test
Unit Tests each program istested individually
Integration Tests checks unitshave been combined correctly
System Tests to see whetherthe overall system functionscorrectly
-
8/3/2019 Prelims Handouts
19/99
Types of Errors Syntax Errors caused by incorrect
punctuation, misspelled reserved wordsand so on.
Run-Time Errors division by zeroand integer overflow that occurs during
execution. Logical Errors difficult to detect coz
the program executes but does not
produce correct results.
-
8/3/2019 Prelims Handouts
20/99
Programming Language
A notation for expressing instructions to becarried out by a computer.
A medium of communication between thehuman and the machine and often,between one human being and another.
-
8/3/2019 Prelims Handouts
21/99
Reasons for Studying
Increased capacity to express ideas
Learning new data structures, algorithms,
and other language features will allow aprogrammer to create more efficientprograms
Example: after learning object-oriented
programming in Java, a C programmer couldsimulate objects using structures and functions
-
8/3/2019 Prelims Handouts
22/99
Reasons for Studying
Improved background for choosingappropriate languages
Without having studied several different
languages, programmers will tend to stickwith the first language they learned
Example: A C programmer might implement abinary tree with arrays, instead of using theobject-oriented capabilities of Java
-
8/3/2019 Prelims Handouts
23/99
Reasons for Studying
Increased ability to learn new language
Knowing the basic concepts of programming
languages allows one to learn a newlanguage easier
Example: C++ or Ada programmers, who alreadyunderstand the concept of object-oriented
programming, will have an easier time of learningJava then programmers have never used theseconcepts
-
8/3/2019 Prelims Handouts
24/99
Reasons for Studying
Better understanding of the significanceof implementation
Knowledge of the basic concepts ofprogramming languages enables theprogrammer to make more efficient choiceswith implementation and to find bugs easierin a program
Example: A C programmer who understandspointers can create the binary tree usingstructures and pointers, instead of with arrays,and will have an easier time debugging programsthat use pointers
-
8/3/2019 Prelims Handouts
25/99
Reasons for Studying
Overall advancement of computing
Knowing the advantages & disadvantages
of different languages helps those incharge to choose better languages over
poorer ones
Example: In the early 1960s, Fortran was used
much more than ALGOL 60, even thoughALGOL 60 had much better control statementsthan Fortran
-
8/3/2019 Prelims Handouts
26/99
Classification ofProgramming
Language
-
8/3/2019 Prelims Handouts
27/99
Machine Language Language of every computer
The lowest level since it is machine-specific and is not designed for aspecific structure of a problem
Equivalent to the instructions foroperating the home appliances butcomputers are usually written incodes of a sequences of 1s and 0s
-
8/3/2019 Prelims Handouts
28/99
Assembly Languages
Structurally similar to machinelanguage except that the sequences
of 0s and 1s are replaced bymnemonic names for the operatorpart of the instruction and numeric
and alphabetic symbols are used forthe operands but still low-level
-
8/3/2019 Prelims Handouts
29/99
High-Level Languages Higher than machine and assembly
Have program structure divorced from
the structure of the machine that executethem
Designed to facilitate the writing of
solutions to problems they are designedto solve
Ex. Pascal, COBOL, BASIC, Fortran
-
8/3/2019 Prelims Handouts
30/99
Declarative Language
The most English-like programminglanguage in its most expressive
power and functionality The highest level of language to its
counterparts and focuses more on
Object-Oriented Programming Ex. VB, Java, C++, Smalltalk
-
8/3/2019 Prelims Handouts
31/99
Most UsedProgrammingLanguages
-
8/3/2019 Prelims Handouts
32/99
Assembler Languages
Uses: detailed control of
hardware, used for internal
computer control and operations Description: fast, efficient but
require considerate effort and
skill; has small program size
-
8/3/2019 Prelims Handouts
33/99
BASIC BeginnersAll-purpose Symbolic Code
Used mainly in education, business
and at home Description: Easy to learn, but being
nonstructured led to spaghetti style
code, but later versions have updatedto structured style
-
8/3/2019 Prelims Handouts
34/99
C
Uses: for systems and general
programming
Description: fast, efficient, andwidely used, and popular among
professional programmers
-
8/3/2019 Prelims Handouts
35/99
C++
Uses: for systems and generalprogramming; commercialsoftware development
Description: developed from C,adding the advantages of object-
oriented programming and morefeatures such as streams
-
8/3/2019 Prelims Handouts
36/99
COBOL
COmmon Business OrientedLanguage
Used for business programming
Description: Oriented towardsbusiness and commercial applications
not so easy to learn as it is quitewordy; widely used on mainframes
-
8/3/2019 Prelims Handouts
37/99
FORTRAN
FORmula TRANslation
Used for scientific, mathematical
and computational work Based on mathematical formulas;
popular among engineers,scientists and mathematicians
-
8/3/2019 Prelims Handouts
38/99
Java
Developed for consumerelectronics; used mainly for many
interactive Web sites Multipurpose object-oriented
language similar to C++ but is
simpler; may also be used inother platforms
-
8/3/2019 Prelims Handouts
39/99
LISP
LISt Processing
Used for artificial intelligence
Symbolic language that is difficultto learn; widely used in
universities and scientificresearch
-
8/3/2019 Prelims Handouts
40/99
PASCAL
General-purpose language
Highly structured; easy to learn
and widely used for teaching inprogramming in universities
-
8/3/2019 Prelims Handouts
41/99
PERL
Practical Extraction and Report
Language
Used for systems programmingand web development
Text and files are easily handled
-
8/3/2019 Prelims Handouts
42/99
PROLOG
PROgramming in LOGic Used in artificial intelligence
Symbolic logic programmingsystem
It was intended for theorem
solving but it is now used inartificial intelligence
-
8/3/2019 Prelims Handouts
43/99
Generations of PLs
-
8/3/2019 Prelims Handouts
44/99
First Generation
In 1940s and early 1950s, all codingwas done in machine language
Every machine has its own built-in
code and this first generation ofsoftware every task was coded fromscratch.
It includes all low-level languages likemachine and assembly
-
8/3/2019 Prelims Handouts
45/99
Note:
The word wasnt programming then,
but coding and programmers were
coders
The word programmer originated inEngland, and when it finally crossed
Atlantic in early 1950s it becamemore popular than coder
-
8/3/2019 Prelims Handouts
46/99
ACM
Association for Computing
Machinery
First formed for coding communityin1947
-
8/3/2019 Prelims Handouts
47/99
Grace Murray Hopper
First coined the term bugs
computing errors and debugging
removing the errors
While investigating Mark II computerwas not working, discovered small
moth in the machine and removed itwith a tweezer
-
8/3/2019 Prelims Handouts
48/99
Mark III
Developed by Howard Aiken
First to have a coding machine
-
8/3/2019 Prelims Handouts
49/99
Second Generation
The development and distribution of
machine-code subroutines,
interpretive routines, automatic codegenerators and assemblers
Ex. ALGOL-60, BASIC, COBOL and
FORTRAN
-
8/3/2019 Prelims Handouts
50/99
BINAC
Binary Automatic Computer
Developed by Mauchly and Eckert
Short-Order Code a set ofinterpretive subroutines stored inmemory developed by Mauchly for
BINAC
-
8/3/2019 Prelims Handouts
51/99
Third Generation
High level language that came outand perfected in the late 1960s up
to present Ex. Procedural, functional logic and
object oriented languages such as
Pascal, ADA, Lisp, Prolog, C++,Smalltalk and etc.
-
8/3/2019 Prelims Handouts
52/99
Fourth Generation
Domain specific languages
Ex. Visual Basic, Delphi, Visual
Age, C++ Also languages for database
systems like SQL, Access,FoxPro, dBase and etc..
-
8/3/2019 Prelims Handouts
53/99
Evaluation Criteria of
PLs
-
8/3/2019 Prelims Handouts
54/99
General Criteria
Readability is it easy to read
and understand a program or
portion of a program written in thelanguage?
Writability Is it easy to write
programs in the language?
-
8/3/2019 Prelims Handouts
55/99
General Criteria
Reliability does the program
help prevent errors?
Cost how expensive is it todevelop, use and maintain
programs written in the language
-
8/3/2019 Prelims Handouts
56/99
More Extensive Criteria
Simplicity Is there one (or few) wayof expressing a concept?
Orthogonality are there facilitieshighly independent. i.e., if there is afeature for sequence control, then no
additional facility for sequence controlshould be present in the language?
-
8/3/2019 Prelims Handouts
57/99
More Extensive Criteria
Adequacy Is it possible to express thesolutions to all problems to be solved in it?
Syntax is the syntax clear and
understandable? Redundancy Is there facility to guide
programming by detecting and diagnosing
inconsistencies of the programmer
M E i C i i
-
8/3/2019 Prelims Handouts
58/99
More Extensive Criteria
Abstraction Is there a way to take virtuallyany internally consistent theme of a program,describe it, name it and use only the name
subsequently? Assertions Does the language have a
facility to state propositions that should holdregardless of the details of implementation(also called predicates, invariants, orproperties)
-
8/3/2019 Prelims Handouts
59/99
More Extensive Criteria
Hierarchical Decomposition Isthere a facility to express a top-downanalysis of programming task?
Modular Decomposition Is there afacility to express program units that
may be semi-independently written orexecuted?
-
8/3/2019 Prelims Handouts
60/99
More Extensive Criteria
Sequencing Is there a facility tocontrol the sequence of events
during computation, fully or partially? Data Manipulation Is there a
facility to carry out primitive
operations on the data?
-
8/3/2019 Prelims Handouts
61/99
Flowchart
- pictorial representation of the logical
steps it takes to solve a problem
-
8/3/2019 Prelims Handouts
62/99
Algorithm
It is a finite set of instructions that specifya sequence of operations to be carried outin order to solve a specific problem orclass of problems
Pseudocode
-
8/3/2019 Prelims Handouts
63/99
Pseudocode-English-like representation of the same
thing.
-Pseudois a prefix that means false
-Code program is to put in a programminglanguage
-False code or sentences that appear tohave been written in a computer
programming language but dont necessarilyfollow all the syntax rules of that language
-
8/3/2019 Prelims Handouts
64/99
Types of Flowchart
Program Flowchart It describesgraphically in detail the logical operationsand steps within a program and the
sequence in which steps are to be executed System Flowchart a graphic
representation of the procedures involve in
converting data on input media to dataoutput form
-
8/3/2019 Prelims Handouts
65/99
Flowcharting Symbols
and Usage
Input/Output Symbol
-
8/3/2019 Prelims Handouts
66/99
Input/Output Symbol(Parallelogram)
It is used to depict an input/output medium
which is not specific. This is used in a logicflowchart.
Processing Symbol
-
8/3/2019 Prelims Handouts
67/99
Processing Symbol(Rectangle)
It represents a group of instructions thatperform a processing function of aprogram
Decision Symbol
-
8/3/2019 Prelims Handouts
68/99
Decision Symbol(Diamond)
It denotes a point where more than one pathcan be taken. It is based upon conditions, abranch to alternative paths is possible .
Preparation Symbol
-
8/3/2019 Prelims Handouts
69/99
Preparation Symbol(Hexagon)
It is used to represent an instruction orgroup of instructions that will alter ormodify a program.
Terminal Symbol
-
8/3/2019 Prelims Handouts
70/99
Terminal Symbol(Oval)
It is used to designate the beginning andthe end of a program.
Pre Defined Processing Symbol
-
8/3/2019 Prelims Handouts
71/99
Pre-Defined Processing Symbol(Rectangle with two vertical lines)
It is a specialized symbol representing anamed operation not explicitly detailed
On-Page Connector
-
8/3/2019 Prelims Handouts
72/99
On Page Connector(Small Circle)
It is non-processing symbol used to
connect one part of flowchart to anotherwithout drawing flowlines.
Fl li
-
8/3/2019 Prelims Handouts
73/99
Flowlines
Signifies the process that is to beexecuted next
Off-Page Connector
-
8/3/2019 Prelims Handouts
74/99
Off Page Connector(Small Pentagon)
It is used to designate entry to or existfrom a page when a flowchart requiresmore than one page.
Punch Card Symbol
-
8/3/2019 Prelims Handouts
75/99
Punch Card Symbol(Rectangle with Notch)
It denotes for all types of card used.
P i t d D t S b l
-
8/3/2019 Prelims Handouts
76/99
Printed Document Symbol
It denotes any written information on paper.It could be a source of document fromwhich data is collected or final output
Magnetic Tape
-
8/3/2019 Prelims Handouts
77/99
Magnetic Tape(Circle with line)
It is used as an input/output symbol formagnetic tape files
On-Line Storage/
-
8/3/2019 Prelims Handouts
78/99
On Line Storage/Magnetic Disk
It is used if the file is read/recorded on amagnetic disk
V i bl
-
8/3/2019 Prelims Handouts
79/99
Variable
A character or group of characters thatrefers to a value and in the of acomputer program, corresponds to an
address
R l i N i V i bl
-
8/3/2019 Prelims Handouts
80/99
Rules in Naming a Variable
Variable names must be one word
Variable names must have some meaning
T f V i bl
-
8/3/2019 Prelims Handouts
81/99
Types of Variable
Numeric Value
Character, text or String Variables
-
8/3/2019 Prelims Handouts
82/99
Notations Commonly
Used in Flowcharting
A ith ti O ti
-
8/3/2019 Prelims Handouts
83/99
Arithmetic Operations
+ Addition
- Subtraction
* Multiplication/ Division
R l ti l O t
-
8/3/2019 Prelims Handouts
84/99
Relational Operators
= Equal to
> Greater than
< Less than
Not equal to
>= Greater than or Equal to
-
8/3/2019 Prelims Handouts
85/99
Logical Operators
&& AND
II OR
! NOT
Other Operators
-
8/3/2019 Prelims Handouts
86/99
Other Operators
EOF End of File
OAF Open All Files
CAF Close All Files
END End
START Start
Basic Control Structure
-
8/3/2019 Prelims Handouts
87/99
Basic Control Structure
Sequence
Selection or Decision (If-Then-Else)
Repetition Looping) /Do-While
Sequence
-
8/3/2019 Prelims Handouts
88/99
q
Process is executed from one to
another in a straightforward manner
Selection (If-then-else)
-
8/3/2019 Prelims Handouts
89/99
Se ect o ( t e e se)
A choice is provided between two
alternatives
Repetition/Do While
-
8/3/2019 Prelims Handouts
90/99
Repetition/Do While
It provides for the repetitive execution of
an operation or routine while the conditionis true.
Reasons for Structure
-
8/3/2019 Prelims Handouts
91/99
Reasons for Structure
Clarity as Program get bigger, they getmore confusing.
Professionalism all programmers expect
your programs to be structured.
Efficiency most newer computerlanguages are structured.
Modularity it can easily broken intoroutines
E l f S
-
8/3/2019 Prelims Handouts
92/99
Design a flowchart that will acceptand display a number. Write its
equivalent algorithmsAlgorithm
Step 1. Read in the value of N
Step 2. Print the value of N
Example of Sequence
E l f S
-
8/3/2019 Prelims Handouts
93/99
Draw a flowchart that will compute &display the sum of two numbers. Write
its equivalent algorithm. Initialize Sum into 0
Read in the value of A and B
Compute the sum by adding A and B Print the computed value of Sum.
Example of Sequence
-
8/3/2019 Prelims Handouts
94/99
Advantages of
Flowcharts
Advantages
-
8/3/2019 Prelims Handouts
95/99
Advantages
Flowcharts are language-independent, they can be learned and
applied without formal knowledge of a
programming language.
It enforces users to give attention to
significant matters over the lesssignificant ones
Advantages
-
8/3/2019 Prelims Handouts
96/99
Advantages
Being graphically portrayed, itprovides an alternative to the usual
narrative description of a system or a
program
Flowcharts are easier to understand
than a program written in a particularprogramming language
-
8/3/2019 Prelims Handouts
97/99
Limitations ofFlowcharting
Limitations
-
8/3/2019 Prelims Handouts
98/99
Limitations
Flowcharts do not represent aprogramming language and are moreof a person-to-person than a person-
to-computer means of communication. Since thinking in graphic terms is not
normal, flowcharts cannot be viewed
as a natural means of communication.
Limitations
-
8/3/2019 Prelims Handouts
99/99
Certain details often require a long
sequence of interconnected symbolswhich could easily be described in justa few lines of explanation
It does not convey why a given setoperations is made
Do not highlight the important detailssince each steps receives as muchattention