Language Categories
Programming languages are often categories as follows: Imperative PL Object Oriented PL Functional PL Logic PL
Imperative Programming Languages
The imperative (or procedural) paradigm is the closest to the structure of actual computers. It is a model that is based on moving bits around and changing machine state. Programming languages based on the imperative paradigm have the following characteristics: The basic unit of abstraction is the PROCEDURE, whose basic structure is a sequence of statements that are executed in series, abstracting the way that the program counter is incremented so as to proceed through a series of machine instructions residing in sequential hardware memory cells.
Imperative Programming Languages-I
. The sequential flow of execution can be modified by conditional and looping statements (as well as by the very low-level goto statement found in many imperative languages), which abstract the conditional and unconditional branch instructions found in machine instruction set. . Variables play a key role, and serve as abstractions of hardware memory cells. Typically, a given variable may assume many different values of the course of the execution of a program, just as a hardware memory cell may contain many different values. Thus, the assignment statement is a very important and frequently used statement. Examples of imperative languages: FORTRAN, Algol, COBOL, Pascal, C (and to some extent C++), BASIC, Ada - and many more.
Functional Programming Languages
Functional programming languages are a class of languages designed to reflect the way programmers think mathematically, not reflecting the underlying machine. Functional languages are based on the lambda calculus, a simple model of computation, and have a solid theoretical foundation that allows one to reason formally about the programs written in them. The most commonly used functional languages are Standard ML, Haskell, and pure Scheme
Logic Programming Language
A logic programming language is an example of a rule based language. In an imperative language an algorithm is specified in great detail and specific order of instructions or statements must be included. In a rule based language however rules are specified in no particular order and language implementation system must choose an execution order that produce the desire result. Example: Prolog
Object Oriented Programming Language
OOP not consider the separate category of the PL. OOP naturally develop from imperative languages. Included OOP in imperative languages not overwhelming. For example the expressions, assignment statements and control statements of C and Java are nearly identical. On the other hand the arrays and subprograms of Java are very different from C.
Visual Language is the subcategory of IPL. Some authors refer to scripting languages as the separate category of programming languages. Examples: Perl, JavaScript and Ruby are IPL in every sense.
In recent years a new catergory of languages the markup programming hybrid languages. Markup languages are not programming languages. XHTML the most widely used markup language is used to specify the layout of information in web documents. Some programming capability has crept into same extensions to XHTML and XML.
Language Design Trade-offs
There are so many important but conflicting criteria, that their reconciliation and satisfaction is a major engineering task. Conflict bet Reliability and Cost of Execution Java language definition demands that all references to array elements be checked to ensure that index or indices are in their legal ranges. This step adds the cost of execution of Java program that contain the large number of references to array elements. C does not require index range checking so C program execute faster.
APL is very writeable and very poor readability. Pointer in C++ not in Java It is therefore clear that the task of choosing constructs and features when designing a programming language require many compromises and trade-offs.
Influences on Language Design
The most important factors are: Computer Architecture; and Program Design Methodology
Computer Architecture
The execution of a machine code program on a von Neumann architecture computer occurs in a process called the fetch-execute-cycle. Program reside in memory but are executed in the CPU. Each instruction to be executed must be moved from memory to the processor. The address of the next instruction to be executed is maintained in a register called the program counter.
The fetch-execute cycle can be simply described by the following algorithm: Initalize the program counter Repeat forever
fetch the instruction pointed to by the program counter
increment the program counter to point to the next instruction Decode the instruction Execute the instruction
End Repeat
Structure of IPL matches with Computer architecture so IPL is more natural than logic programming languages.
Programming Methodology
Late 1960s and early 1970s structural programming Primary Deficiencies: incompleteness of type checking and poor control statement. Data Abstraction: SIMULA 67 OOP: 1980s