0% found this document useful (0 votes)
3 views19 pages

Introduction To Programming

The document provides an overview of programming, detailing the categories of programming languages, including machine, assembly, high-level, fourth, and fifth generation languages. It outlines the steps in program implementation, advantages of high-level languages, and types of programming errors such as syntax, runtime, and logic errors. Additionally, it emphasizes the importance of debugging in the programming process.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views19 pages

Introduction To Programming

The document provides an overview of programming, detailing the categories of programming languages, including machine, assembly, high-level, fourth, and fifth generation languages. It outlines the steps in program implementation, advantages of high-level languages, and types of programming errors such as syntax, runtime, and logic errors. Additionally, it emphasizes the importance of debugging in the programming process.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction To

Programming

PREPARED BY: D. SMALL


Categories of Programming
● A program is a sequence of
instructions to the computer

● The instructions are written in


programming language
Steps in Programme
Implementation
1. create source code;
2. translate and/or link
3. execute/run program
4. maintain program and
documentation.
Difference between high level
and low level language
● Low level languages uses 1s and 0s
and mnemonics . Machine
languages and Assemble are two
types of low level languages .
● High level languages uses English
like statements for coding. Eg
pascal,c++, java etc.
Advantages of High Level Language Over
Machine Language

1. easier to learn and code programs in high level


languages since programmer does not need
detailed knowledge of the computer or its
internal operation

1. Errors are easier to avoid and detect

1. Many high level languages are machine


independent, making them portable
Categories of
Programming cont…
Programming languages fall into the following
categories:

1. Machine Language
2. Assembly Language
3. High Level Languages
4. Fourth Generation Languages
5. Fifth Generation Languages
6. Natural Languages
First Generation (Machine
Language)
consist of strings made up of 1s and 0s. The only programming
language the computer can understand. (it is understood by the
computer without any interpretation.) eg 1011 1001

Advantages
1. Fast execution speed
2. Efficient use of main memory.

Disadvantages
1. Writing of machine language is tedious and time
consuming. Why is this so?
2. Programming errors are difficult to find and correct
(‘debug’)
Second Generation (Assembly
Language)
● uses special code called mnemonic to
represent machine language instructions.
e.g., programmer might use the mnemonic
AD.

● before a computer can use an assembly


language, it must be translated into a
machine language. This conversion is made
with a language translator program called
an assembler.

● Remember Machine Language is the only


language the computer can understand.
Source Code and Object Code

The Source code is the original The object code is the output
code written by the after the source is compiled.
programmer
Relationship between source code,
translator and object code

SOURCE TRANSLATORS OBJECT


CODE CODE
Third Generation Programming
Languages
Third Generation Programming Languages or High Level
Languages have a grammar and syntax that closely resemble
human languages and mathematical notations.

Example

Some languages such as C, C++ and Pascal


Advantages third generation
languages

[Link] program faster.


[Link] programs cheaper. The cost of writing a program
is nearly constant
[Link] it easier to avoid and detect errors in code.

Disadvantages third generation languages

[Link] execution is slower.


[Link] CPU time because of the re-translating of codes
each time it is encountered.
Fourth Generation

Fourth Generation Programming Languages use


statements similar to those used in human
language. Most 4GLs are used to access
databases. A typical 4GL command might be:

LIST ALL RECORDS WHERE GENDER =


“FEMALE" AND AGE > 18

This is SQl Lanaguge


Fifth Generation Language (SGL)

A Fifth Generation Language (SGL) is


programming using a visual or graphical
development interface to create source
languages that are usually compiled with a 4GL
language compiler.

An example of SGL language is Visual Basics


Types of errors
• Syntax error
• Run time error
• Logic error
Syntax error
Syntax is the rules and regulations of programming
language, much like a grammar system.

Syntax error occur when you have violated the rule


of a programming language.

Eg. Not ending a pascal program with END.


Or missing the semi-colon ; at the end of line of code
in pascal
Logic error

When the program does not produce the


required results due to the incorrect logic of
the program this is called logic error
Eg
C= 0
Sum=c/5
total = price - qty

This will not product a result


Run time error

A run time error occur when the


program has to terminate before
its completion or not ending a
loop
Debugging

The process of looking for errors,


locating them and correcting them
is known as debugging

You might also like