Search Your Topic

config
Friday, 01 September 2017 07:14

Generations of programming language

Written by
Rate this item
(0 votes)

There are many types of programming languages out there and you might already have heard of a few of them, for example: C++, VB.NET, Java, Python, Assembly. We will now look at the history of how these languages came about and what they are still useful for. In all cases keep in mind that the only thing a computer will execute is machine code or object code when it has been converted from a language to run on a processor.

Generation First Second Third Fourth
Code example

10101010011000101
10011010100000010
11111111101000101

LDA 34
ADD #1
STO 34
x = x + 1
body.top { color : red;
           font-style : italic
}
Language (LOW) Machine Code (LOW) Assembly Code (HIGH) Visual Basic, C, python etc. (HIGH) SQL, CSS, Haskell etc.
Relation to Object Code
(generally)
-- one to one one to many one to many

First generation

 
The Colossus Mark 2 was the world's first electronic digital programmable computer. Operators had to write the machine code directly by setting switches.

The first generation program language is pure machine code, that is just ones and zeros, e.g.{\displaystyle 0010010010101111101010110}. Programmers have to design their code by hand then transfer it to a computer by using a punch card, punch tape or flicking switches. There is no need to translate the code and it will run straight away. This may sound rather archaic, but there are benefits:

plus pointCode can be fast and efficient
plus pointCode can make use of specific processor features such as special registers


And of course drawbacks

minus point Code cannot be ported to other systems and has to be rewritten

 

minus point Code is difficult to edit and update
 

Second generation programming

Second-generation programming languages are a way of describing Assembly code which you may have already met.

By using codes resembling English, programming becomes much easier. The usage of these mnemonic codes such as LDA for load and STA for store means the code is easier to read and write. To convert an assembly code program into object code to run on a computer requires an Assembler and each line of assembly can be replaced by the equivalent one line of object (machine) code:

Assembly Code   Object Code
LDA A
ADD #5
STA A
JMP #3

-> Assembler ->

000100110100
001000000101
001100110100
010000000011

Assembly code has similar benefits to writing in machine code, it is a one to one relationship after all. This means that assembly code is often used when writing low level fast code for specific hardware. Until recently machine code was used to program things such as mobile phones, but with the speed and performance of languages such as C being very close to Assembly, and with C's ability to talk to processor registers, Assembly's use is declining.

As you can hopefully see there are benefits to using Second-Generation Languages over First-Generation, plus a few other things that makes Assembly great:

plus pointCode can be fast and efficient
plus pointCode can make use of specific processor features such as special registers
plus pointAs it is closer to plain English, it is easier to read and write when compared to machine code


And of course drawbacks

 

minus point Code cannot be ported to other systems and has to be rewritten
 

Third generation (High Level Languages)

Even though Assembly code is easier to read than machine code, it is still not straight forward to perform loops and conditionals and writing large programs can be a slow process creating a mish-mash of goto statements and jumps. Third-generation programming languages brought many programmer-friendly features to code such as loops, conditionals, classes etc. This means that one line of third generation code can produce many lines of object (machine) code, saving a lot of time when writing programs.

Imperative languages - code is executed line by line, in a programmer defined sequence


Third generation (High Level Languages) codes are imperative. Imperative means that code is executed line by line, in sequence. For example:

1 dim x as integer
2 x = 3
3 dim y as integer
4 y = 5
5 x = x + y
6 console.writeline(x)

Would output: 8

Third generation languages can be platform independent, meaning that code written for one system will work on another. To convert a 3rd generation program into object code requires a Compiler or an Interpreter.

To summarise:

plus pointHardware independence, can be easily ported to other systems and processors
plus pointTime saving programmer friendly, one line of 3rd gen is the equivalent of many lines of 1st and 2nd gen


However

minus point Code produced might not make the best use of processor specific features unlike 1st and 2nd gen

 

Extension: Programming Paradigms

There are several types of Third-generation languages that you will cover in more detail at A2. They include:

  • Object Orientated
  • Event driven

Fourth generation

Fourth-generation languages are designed to reduce programming effort and the time it takes to develop software, resulting in a reduction in the cost of software development. They are not always successful in this task, sometimes resulting in inelegant and hard to maintain code. Languages have been designed with a specific purpose in mind and this might include languages to query databases (SQL), languages to make reports (Oracle Reports) and languages to construct user interface (XUL). An example of 4th generation programming type is the declarative language.

--an example of a Structured Query Language (SQL) to select criminal details from a database
SELECT name, height, DoB FROM criminals WHERE numScars = 7;

Declarative languages - describe what computation should be performed and not how to perform it. Not imperative!

 

An example of a declarative language is CSS which you might learn more about when completing any web design unit

 

/*code to change the headings on a page to green and the paragraphs to red and italic*/
h1 { color : #00FF00; }
p { color : #FF0000; font-style : italic }
Read 222 times
Anish Sir

"I am delighted once again to pen the welcome note to the Tosh!Yas Technologies ."

 Call +91 74 88 34 7779  | Email : anishsingh@live.com

toshiyas.in

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.