Tuesday 11 June 2013

Generations of Programming Languages

Programming languages have been classified into several programming language generations. Historically, this classification was used to indicate increasing power of programming styles. Later writers have somewhat redefined the meanings as distinctions previously seen as important became less significant to current practice.

First genaration

A first-generation programming language is a machine-level programming language.
Originally, no translator was used to compile or assemble the first-generation language. The first-generation programming instructions were entered through the front panel switches of the computer system.
A first generation (programming) language (1GL) is a grouping of programming languages that are machine level languages used to program first-generation computers. The instructions were given through the front panel switches of these computers, directly to the CPU. There was originally no compiler or assembler to process the instructions in 1GL.
The instructions in 1GL are made of binary numbers, represented by 1s and 0s. This makes the language suitable for the understanding of the machine but very much more difficult to interpret and learn by the human programmer.
Also known as a 1st generation language.
The main advantage of programming in 1GL is that the code can run very fast and very efficiently, precisely because the instructions are executed directly by the CPU. One of the main disadvantages of programming in a low level language is that when an error occurs, the code is not as easy to fix.
The program is written as binary instructions, consisting of zeros and ones. This language is very much adapted to a specific computer and CPU, and code portability is therefore significantly reduced in comparison to higher level languages.
Modern day programmers still occasionally use machine level code, especially when programming lower level functions of the system, such as drivers, interfaces with firmware and hardware devices. Modern tools, such as native-code compilers are used to produce machine level from a higher-level language.

Second generation

Second-generation programming languages, originally just called low level programming languages, were created to simplify the burden of programming by making its expression more like the normal mode of expression for thoughts used by the programmer. They were introduced in the late 1950s, with FORTAN reflecting the needs of scientific programmers, ALGOL reflecting an attempt to produce a European/American standard view.
The most important issue faced by the developers of second-level languages was convincing customers that the code produced by the compilers performed well-enough to justify abandonment of assembly programming. In view of the widespread skepticism about the possibility of producing efficient programs with an automatic programming system and the fact that inefficiencies could no longer be hidden, the developers were convinced that the kind of system they had in mind would be widely used only if they could demonstrate that it would produce programs almost as efficient as hand coded ones and do so on virtually every job. The FORTRAN compiler was seen as a tour-de-force in the production of high-quality code, even including "… a Monte Carlo simulation of its execution … so as to minimize the transfers of items between the store and the index registers."

Third generation

The introduction of a third generation of computer technology coincided with the creation of a new generation of programming languages. The essential feature of third-generation languages is their hardware-independence, i.e. expression of an algorithm in a way that was independent of the characteristics of the machine on which the algorithm would run.
Some or all of a number of other developments that occurred at the same time were included in 3GLs.
Interpretation was introduced. Some 3GLs were compiled, a process analogous to the creation of a complete machine code executable from assembly code, the difference being that in higher-level languages there is no longer a one-to-one, or even linear, relationship between source code instructions and machine code instructions. Compilers are able to target different hardware by producing different translations of the same source code commands.
Interpreters, on the other hand, essentially execute the source code instructions themselves — if one encounters an "add" instruction, it performs an addition itself, rather than outputting an addition instruction to be executed later. Machine-independence is achieved by having different interpreters in the machine codes of the targeted platforms, i.e. the interpreter itself generally has to be compiled. Interpretation was not a linear "advance", but an alternative model to compilation, which continues to exist alongside it, and other, more recently developed, hybrids. Lisp is an early interpreted language.
The earliest 3GLs, such as Fortran and COBOL, were spaghetti coded, i.e. they had the same style of flow of control as assembler and machine code, making heavy use of the goto statement.Structured programming introduced a model where a program was seen as a hierarchy of nested blocks rather than a linear list of instructions. For instance, structured programmers were to conceive of a loop as a block of code that is repeated, rather than so many commands followed by a backwards jump or goto. Structured programming is less about power — in the sense of one higher-level command expanding into many lower-level ones — than safety. Programmers following it were much less prone to make mistakes. The division of code into blocks, subroutines and other modules with clearly-defined interfaces also had productivity benefits in allowing many programmers to work on one project. Once introduced (in the ALGOL language), structured programming was incorporated into almost all languages, and retrofitted to languages that did not originally have it, such as Fortran, etc.
Block structure was also associated with deprecation of global variables, a similar source of error to goto. Instead, the structured languages introduced lexical scoping and automated management of storage with a stack.
Another high-level feature was the development of type systems that went beyond the data types of the underlying machine code, such as strings, arrays and records.
Where early 3GLs were special-purpose, (e.g. science or commerce) an attempt was made to create general-purpose languages, such as C and Pascal. While these enjoyed great success,domain specific languages did not disappear.

No comments:

Post a Comment