6.
8 PROGRAMMING
Generations of programming
language
Qn. Identify and explain the
generations of computer
programming languages.
First generation
Low Level languages such as assembly language and machine code are first generation
languages.
They are executed directly without translation.
Machine code is the actual pattern of 0s and 1s used in computer memory.
Programs written in machine code are time consuming, laborious and error prone when
entering into the computer.
Second generation
Assembly code is second generation languages.
They allow programmers to use mnemonics (abbreviations that represent an instruction
in a memorable way) and denary numbers (1-9) instead of 0s and 1s.
E.g. ADD or ADX to add two numbers, SUB or SBX an instruction to subtract.
Programs written in assembly language need to be translated into machine code before
execution.
The program called Assembler is used to do the translation.
Third generation
Imperative high level languages such as Pascal, COBOL, FORTRAN, BASIC and Algol are
third generation languages.
It is a refinement of the second generation language that makes the language more
programmers friendly.
It includes features like data types and expressing concepts in a way that favours the
programmer not the computer.
Fourth generation
They are languages with the all powerful commands like SQL.
They use command such as SORT which are easier than writing your own sort
procedures using third generation languages.
Fifth generation
Are languages like Prolog.
They are often regarded as very high level languages.
Experts systems are often written in Prolog.
They based on solving problems using constraints given to the program rather using an
algorithm written by a programmer.
Are mostly used in artificial intelligence.
Programming languages
Qn. Identify and describe
computer programming
languages.
Outline the strengths and
shortfalls of each and every
computer
programming language.
They can be divided into two types:
These are:
Low Level Languages: which are closer to machine language
High Level Languages: which are closer to human language.
Low Level Languages:
It is a language of a particular processor.
It is the code for a particular machine (computer) and is given the name machine code.
They are machine oriented because they refer to hardware such as processor’s register,
input and output ports and specific locations in internal memory.
Advantages
Skilful programmer has complete freedom of the choice of instructions.
Programmers have direct control over the processor’s communication with its
peripherals.
The programmers can write very efficient programs that:
Fits into limited storage space
Require limited RAM.
Run rapidly
Disadvantages
They are difficult for a programmer to read since they lack human relationship.
They are machine oriented making them hard to learn for the programmer.
Programs written in low level language are not portable that means they are not
transferable between families of processors.
Machine language
It consists of a string of zeros and ones and because of this is the lowest level of
language.
It is difficult for programmers to read and write.
Programs written in machine language can be converted to machine code without using
a compiler or interpreter.
Machine language instruction consists of an operation code known as an ‘opcode’.
Example of an opcode 110000.
Assembly language.
It is a low level language for a computer or other programmable device.
It is developed for a family of processors.
Assembly language is considerably easier to read or write than machine language.
It consists of mnemonic- a short word or abbreviation that acts as a memory aid.
Example of instruction in the PIC16F627 microcontroller’s assembly language is:
MOVLW 0x5A.
It need to be converted into executed machine code by a program called assembler.
The conversion processing is referred o as assembly, or assembly the code.
High level languages
They are similar to human language or mathematical notations.
They are easy to read and write, test debug and maintain.
They are problem oriented rather than machine oriented.
Different languages are designed to solve different types of problems.
They are independence of the instruction set of any particular family of processor.
Types of high level programming languages
Language Use
COBOL (Common Business Oriented Business application
Language)
FOTRAN (FORmula TRANslation) Scientific applications
General purpose and educational use
BASIC (Beginners All-purpose Symbolic
Instruction Code)
Visual BASIC
Pascal
Delphi
LISP
LOGO
C
C++
Java
A comparison of translation programs.
Qn. Compare and contrast the
translation programs.
Assembler Compiler Interpreter
Translates processor-specific Translate HLL code into Translate HLL statements
assembly code into machine machine code for specific and executes them on a
code for a specific processor processor and operating specific processor and
system operating system
Translate an entire program Translate an entire program Translate and executes a
but does not run it but does not run it program on the target
processor, usually one
statement at a time, but
does not run it.
Translate one source code Translate one source code Executes one source code
instruction to one machine statement to one or more statement as one of more
machine code instructions. instructions.
code instruction
Comparison of features of LLL and HLL
Qn. Contrast the LLL and HLL.
High Level Languages Low Level Language
Program statements are problem oriented Program instructions are machine oriented
Programs are portable between different Programs are not portable between different
types of computer types of computer.
Programs must be translated to run on a Machine language need no translation
processor
Translation to a machine language is Translation from assembly language to
relatively complex machine language is relatively simple
Programs are relatively easy to read and Programs are relatively hard to read and
write write
Programs are relatively easy to test, debug Programs are relatively hard to test, debug
and maintain and maintain.