Language Paradigms Compared 

In this project Block structured Procedural paradigm is compared with three other programming paradigms namely: Functional, Object based and Logic, under the following subheadings:

1. Handling Sequence Control

2. Handling Subprograms and Storage Management. 

(a)  Block Structured, Procedural Vs Object Based:  

Handling Sequence Control:

Block structured procedural languages execute programs in a step-by-step, top-to-bottom manner, in addition they allow for interrupts in the sequence of execution so that blocks of code can be executed even if they are outside the main program.

Object based paradigm focuses on objects rather than on strict step-by-step execution. The focus is on objects and their associated methods and properties.  

Blocks form an in important part of sequence control in block-structured languages, blocks also play a great role in object based sequence control. Blocks in block structured languages are usually explicitly declared as in Ada's declare, in object based they are a group of compound statement sequence surrounded by matched braces as in C++ { }.

Blocks add extra flexibility to both programming languages. 

Communication between blocks and subprograms in block structured procedural include procedure as well as function calls, in object based communication is achieved using objects and their associated methods and instances. 

Both paradigms support control statements including if-then-else, for, while , and multiple selection statements like Pascal's case and C++'s switch.  

Both paradigms support restricted unconditional branching like Goto in block structured, and break and continue in object based. 

Handling of Subprograms and Memory Management

Subprograms are supported by both object based and block structured procedural languages. Block structured procedural supports both procedures and functions which are the components of subprograms, object based supports functions only. 

Block structured procedural supports pass-by-value and pass-by-name methods of parameter passing, object based paradigms support pass-by-value and pass-by-reference methods of parameter passing. 

Unlike the functions in block structured procedural languages, which can be called by their names, functions in object-based paradigms are encapsulated within objects and access to these functions is through their objects. 

Block structured procedural languages and object based support independent and separate compilation of their programs. Block structured languages support generic subprograms, while object based programming languages support generic functions. 

Memory usage is conserved in both language groups because of the use of pointers, both paradigms allow the use of pointers in memory management.

Both language groups provide the programmer with storage manipulation capabilities that allow for the reclamation and recycling of memory. In contrast object based languages provide extra flexibility in memory control by providing the programmer with handles to objects in memory. 

(b)  Block Structured, Procedural Vs Functional: 

Handling Sequence Control:

Functional programming paradigm is based upon the notion of a program as a function contained in expressions in a similar sense to its usage in mathematics. Programs are designed by the composition of functions. 

Block structured procedural paradigm supports a step-by-step, top-to-bottom execution of programs. Functional paradigm is not order dependent.

Block structured supports the use of control statements like if-the-else, and iteration. Functional paradigm uses if, goto, switch, else statements and recursion.  

Functional and block procedural languages support mathematical precedence rules in expressions as well as the override of parenthesis. 

Handling of Subprograms and Memory Management

Block structured procedural and Functional languages support subprograms. Block structured procedural allow the use of pointers to access memory, Functional languages do not allow direct access to memory by programmers. Functional paradigm features automatic memory management for the allocation and de allocation and automatic garbage collection.

Parameter passing is by value in Functional paradigm, but it is by value and by name in block structured.   

Purely functional programming languages do not use variables or assignment statements, so the memory of the computer on which a program is run is not of any particular use. Block structured procedural is very strong on the use of variables and assignment statements. In functional languages parameters, functions and results of computations are stored in structures like list structures. 

(b)  Block Structured, Procedural Vs Logic: 

Handling Sequence Control:

Logic programming languages express programs in a form of  symbolic logic and use a logical inference process to produce results. Logic programs are declarative rather than procedural, which means that only the specifications of the desired results are stated rather than the detailed procedures of producing them. This is a direct contrast to the methodology of  block structured procedural paradigm. 

Control of flow in logic languages is not left to the programmer, except in some very limited area of ordering of pattern matching during resolution. In contrast, programmers have much power in controlling sequence of execution in block structured procedural language. 

Logic languages have no if-else-then statements like block structured procedural does. Statements for logic programs are generally a sequence of queries by the programmer. 

Handling of Subprograms and Memory Management

Logic languages do not support subprograms as does block structured procedural.  In block-structured procedural, programmers have access to by the use of pointers; Logic programmers are isolated from memory access. 

Since Logic programming languages do not support subprograms, they do not support modularization. Block structured procedural supports modularization. Logic programming languages store programs and data in structures like tree and list.

Block structured allows dynamic storage management at run-time, this is not allowed in logic programming. Memory usage is quite high in logic programming compared to block structured because logic does not use pointers.