Generations of Programming Languages

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 35

Introduction to Programming

Programming Languages
Programming
This is the art of writing the solution to a
problem using a language that the computer
can understand.
A programmer actually instructs the
computer how to solve a problem since it
cannot come up with a solution to the
problem itself.
Computer Program
These are a set of instructions that tells the
computer what to do and how to do it.
These instructions are usually converted into
a sequence of numeric code (0’s and 1’s)
called machine code which are stored in
memory.
The processor interprets this code in order
to carry out the instructions of the program
Programming Languages
There are many different types of
programming languages that can be used to
write program or create all kinds of software.
These languages are grouped into two main
categories.
• Low level languages
• High level languages
Low level languages
Low level languages are machine
dependent. That is the code written can
only be understood by the particular
computer or processor that was used to
write the code.
Advantage of Low level languages
• It has a faster execution time. ( code runs
very fast and efficiently because it is
directly executed by the CPU.
Disadvantages of Low level
languages
• It machine dependent.
• It is difficult to understand.
• It is time consuming to write
High level languages
High level languages are different from low
level languages in that they are not machine
dependent. Therefore programs written on
one computer can generally be used on
another similar computer. They also use
keywords similar to English and are easier
to write.
Advantage of high level languages
• They are easier to understand
• They are easier to write
• They are not machine dependent
Disadvantages of high level
languages
• It has a longer execution time. ( This is
because the codes has to be converted to
machine language before the instructions
can be carried out)
• Programs can be too wordy.
Generations of Programming
Languages
Generations of Programming
Languages
There are five generations of programming
languages:
• First generation language
• Second generation language
• Third generation language (3GLs)
• Fourth generation language (4GLs)
• Fifth generation language (5GLs)
Generations of Programming
Languages
First and second generations of
programming languages are classified as
low level languages.
While third, fourth and fifth generations of
languages are classified as high level
languages
First generation Languages
First generations programming languages
uses digits 0 and 1 that make up the binary
code. An instruction written in first
generation language might look like this:
10110000 01100001
An example of first generation of language is
machine language.
Advantage of first generation
languages
• It has a faster execution time. ( code runs
very fast and efficiently because it is directly
executed by the CPU.
Disadvantage of first generation
languages
• It machine dependent.
•It is difficult to understand.
•It is time consuming to write

Programmer may become confused with the


massive amount of 0s and 1s in the
program.
Second generation Languages
Second generations programming
languages have the same structure and
commands as machine language but allows
the programmer to use abbreviated words,
called mnemonics, instead of binary codes.
Second generation Languages
cont’d
For example:- Instead of writing the code as
10110000 01100001 the equivalent second
generation code may be:
Add A, B (meaning add the contents of A
and the contents of B)
An example of second generation of
language is assembly language.
Advantage of second generation
languages
Has a faster execution time the high level
languages (can be easily converted to
machine code by a program called and
assembler.
Disadvantage of second generation
languages
• It machine dependent.
• It is difficult to understand when compared
with high level languages.
Third generation Languages
Third generation Languages are designed to be
easier for you to understand. These languages
are converted to machine code, rather like
translating from one language to another, so that
the computer can carry out the instructions in the
CPU.
This generation supports procedural languages,
which means the program will execute a sequence
of instruction in a specific order.
Third generation Languages cont’d
Some examples of third generation of
languages are:
• FORTRAN
• BASIC
•C
• Pascal
FORTRAN (Formula-Translator)
First high-level language, used to express
mathematical formulae, scientific problems
and engineering problems.
BASIC (Beginner’s All-purpose
Symbolic Instruction Code)
A very easy to learn language that was
created to teach programming. There are
many versions of this language the most
popular being Visual BASIC.
Pascal

Named after the 17th century mathematician


Blaise Pascal.
A language that uses structured
programming mostly used for teaching
purposes. Pascal is an easy to learn
language that is an alternative to BASIC.
C

A language used mostly to write operating


systems, database management software
and scientific applications. C is a general
purpose language that can be used in many
computer
C++
An object-oriented programming language
that was originally an extension of C but has
now become very powerful
Advantage and disadvantage of
third generation languages
Advantage:- can use English- type words to
write program code, making it easier to
create.

Disadvantage:- programs also have to be


converted to machine language.
Fourth generation Languages
Fourth generation Languages are non –
procedural programs written to provide easy
ways of designing screens and reports, and
using databases. They contain commands
to read and process the data and place the
results in report-form on the page.
An example of fourth generation of language
is COBOL
COBOL
A language used in commercial and
business applications. The program
consists of four sections called the
identification, environment, data and
procedure divisions.
Advantage and disadvantage of
fourth generation languages
Advantage:- useful for generating reports.

Disadvantage:- can become very wordy.


Fifth generation Languages
Fifth generation Languages are sometimes
regarded as very high level languages. In
theory, fifth generation Languages are non-
procedural languages, meaning that the
programmer states the goal to be achieved,
but not the steps required in order to
achieve the goal
An example of fifth generation of language is
Prolog
Prolog (Programming Logic)
A language used to develop artificial
intelligence application programs like natural
language and expert systems. It
accomplishes its tasks by declaring facts,
asking questions and defining rules about a
specific area of knowledge.
Advantage and disadvantage of
fifth generation languages
Advantage:- computers will be able to
communicate in natural spoken language
with their users.

Disadvantage:- very complex to design,


programmer must be highly trained.
Class Work
• Explain the difference between low-level
and high level languages.
• State the generations of computer
languages
• State the programming language that is
associated with:
a) artificial intelligence applications
b) business applications
c) operating systems
d) scientific problems

You might also like