Great debates ensue about the efficiency of the array declaration in C++ versus the array declaration in JAVA or the value of interpreting versus compiling a program. In truth, however, the array declarations and translation issues have very little to do with distinguishing between the languages. There are often minor syntactic variations that simply reflect the wishes of language designers, which have little concrete effect upon the programs written in those languages. We need to look deeper to understand how languages are constructed???
A Programming Paradigm is a fundamental style of computer programming regarding how solutions to problems are to be formulated in a programming language. It gives some basic idea for performing programming computation. There are many programming paradigms as following:
- The imperative paradigm
- The functional paradigm
- The logical paradigm
- The Object Oriented paradigm
- The visual paradigm
- The applicative paradigm
- The multi-programming paradigm and many more.
Imperative Programming Paradigm:-
Imperative programming paradigm describes computation in terms of statements that changes a program state. It describes HOW to compute a solution. The basic concept is the machine state, the set of all values for all memory locations in the computer. The basic unit of abstraction is PROCEDURE, whose basic structure is sequence of statements that are executed in succession, abstracting the way that the program counter is incremented so as to proceed through series of machine instructions residing in sequential memory cells. Thus, the execution of imperative program can be viewed as execution of sequence of statements:
The sequential flow of an execution can be modified by conditional and looping statements which abstract the conditional and unconditional branch instructions found in the underlying machine instruction set. Variables play a key role & serve as abstractions of hardware memory cells. Typically, a given variable may assume many different values of the course of execution of a program, just as a hardware memory cell has many different values. Thus, the assignment statement is a very important and frequently used statement
Imperative Language Characteristics:
- Variable and storage
- Procedure calls
- Sequential commands
- Collateral commands
- Conditional commands
- Iterative commands
- Block commands
Examples of Imperative Languages:
- FORTRAN The IBM Mathematical FORmula TRANslating system.
- ALGOL 60 ALGOrithmic Language 1960.
- COBOL COmmon Business Oriented Language.
- Pascal, C language, BASIC, Ada and many more.
Example Program: Finding a Factorial
Public int factorial (int n)
for( int i=2; i<=n; i++)
ans= ans * i;
As shown in the program, it gives step by step process to find the solution for the problem i.e. finding factorial for any given number. Imperative programming language is also called as Procedural language.