With advances in various disciplines of science and engineering the requirement of the more advanced computational models for solving a problem that need large computational and storage environments. Procedural and nonprocedural languages are the computations models for specifying most programming today. The major difference between these computational models is that the procedural language is command-driven whereas non-procedural language is function oriented.
Furthermore, procedural programming languages perform computation as a sequence of statements that manipulate stored data until the desired result is achieved. In contrast, the nonprocedural language represents programs as relationships between mathematical expressions which are based on dependencies.
Content: Procedural Language Vs Nonprocedural Language
|Basis for comparison
|State of the machine
|Only restricted data types and values are allowed
|Any data type or value
|Programming languages based on the model
|C, C++, ALGOL, FORTRAN, Smalltalk, etcetera.
|LISP and ML
|Size of the program
Definition of Procedural Language
As mentioned above the procedural language is command-oriented, or we can say alternatively statement-oriented language. The fundamental unit of procedural programming is an action which is further divided into three parts – computational actions (for example arithmetic operations), control-flow actions (like comparison and looping statements), and input-output actions (such as read and write operations).
All the procedural actions can access common storage, containing an arbitrary number of memory locations. These memory locations can be classified in the states like occupied, undefined or unused. So, here the primary concept is the machine state, which is the group of all values for all memory locations in the computer.
The programs constructed using procedural language comprised of a sequence of statements, where the memory location values change according to the execution of the different statements in order to enter a new state. The procedural language syntax is given below:
The programming languages come under this model are – C, C++, FORTRAN, ALGOL, PL/I, Pascal, Ada, Smalltalk and COBOL.
Definition of Nonprocedural Language
Nonprocedural language also known as applicative or functional language involves the development of the functions from other functions to construct more complex functions. These functions work in levels where the initial set of data is manipulated then the final functions are used to find the outcome from the initial data.
Now, since we have the final result, it can be applied to the initial data to arrive at the final result. Nonprocedural language syntax is shown below:
functionn(…. function2 (fucntion1 (data) ))
LISP and ML are the nonprocedural languages.
Features of a nonprocedural programming language:
- Here each procedure is a function that differentiates incoming values (parameters) from outgoing values (results).
- In pure non-procedural programming (i.e, functional programming), the variable is not assigned with any variable, it behaves as a constant once it is bound to a value.
- It does not employ any loops alternatively recursive calls are used.
- The function value only depends on the value of the parameter rather than the order of execution.
Key Differences Between Procedural and Nonprocedural Language
- The semantics of the procedural language is quite tough as compared to the non-procedural language.
- The functions in a nonprocedural programming language can return any type of data (data type) and value. On the other hand, procedural language functions are not able to return all type of data and value only restricted datatype and values are allowed.
- For the time critical application the non-procedural language performs effectively while in case of less time-critical application the procedural language produces better results and is more efficient.
- Among the programs constructed in the procedural and nonprocedural language, the procedural language program are of larger size while non-procedural language programs have a small size.
The procedural and nonprocedural language can be distinguished by the fact that procedural language emphasis on the what procedure must be followed for completing the specific tasks. Conversely, non-procedural language directs the program for accomplishing tasks needed to be done rather than how it is going to be accomplished.