Procedural Language
A procedural
language also known as imperative language is a type of computer programming
language that specifies a series of well-structured steps and procedures within
its programming context to compose a program. It contains a systematic order of
statements, functions and commands to complete a computational task or program.
The procedural language segregates a program within variables, functions, statements and conditional operators. Procedures or functions are implemented on the data and variables to execute a task. These procedures can be called/invoked anywhere between the program hierarchy, and by other methods as well. A program written in procedural language contains one or more procedures.
We now have a brief concept of what procedural language actually means... Great!
Let’s move ahead to grasp at what makes procedural language different from non-procedural language
PROCEDURAL |
NON-PROCEDURAL |
Command driven language |
Function driven language |
Both iterative and recursive calls are prominent |
Recursive calls are only used here |
Usually the size of the program becomes large due to complex semantics |
On the other in non-procedural languages, usage of simpler semantics
minimizes the size of the program |
Data type restriction is visible |
Can return any data type or value |
Due to larger size of the programs this approach is not very much
suitable of time critical applications |
Due to reduced complexity and smaller programs, this approach is very
much appreciated for time critical applications |
Awesome! We now have a good knowledge of Procedural Language!
Have you ever wondered how many types of programming languages there are?
Let’s take a look
The different
types of programming languages are depicted below.
What about the various types of Procedural Languages?
The procedural
programming language is used to execute a sequence of statements which lead to
a result. Typically, this type of programming language uses multiple variables,
heavy loops and other elements, which separates them from functional
programming languages. There are more than 145 Procedural languages. Procedural
Programming includes different programming languages which are listed as
following-
- C
- FORTRAN
- PASCAL
- ADA
- COBOL
- BASIC
There are many more
Procedural Programming languages in the world like ALGOL, PL/I, CHILL, CLIST,
etc.
Great going!
Let’s take a quick look on a brief about these languages
C:
C programming is a general-purpose,
procedural, imperative computer programming language developed in 1972 by
Dennis M. Ritchie. C is the most widely used computer language. It keeps
fluctuating at number one scale of popularity along with Java programming
language, which is also equally popular and most widely used among modern
software programmers. An example of C programming language is shown below,
FORTRAN: FORTRAN is a computer programming language that is extensively used in numerical, scientific computing. It still has a strong user base with scientific programmers, and is also used in organisations such as weather forecasters, financial trading, and in engineering simulations. FORTRAN programs can be highly optimized to run-on high-performance computers, and in general the language is suited to producing code where performance is important. An example of FORTRAN programming language is shown below,
PASCAL: Pascal is a general-purpose, high-level language that was originally developed by Niklaus Wirth in the early 1970's. Pascal is Algol-based language and includes many constructs of Algol. Algol 60 is a subset of Pascal. Pascal offers several data types and programming structures. It is easy to understand and maintain the Pascal programs. An example of Pascal programming language is shown below,
ADA: The Ada language is the result of the most extensive and most expensive language design effort ever undertaken. Up until 1974 half of the applications at The Department of Defense were embedded systems. Ada is unique among languages in how it helps you detect and eliminate bugs early in the software life cycle, when they are least expensive to correct. An example of Ada programming language is shown below,
COBOL: COBOL stands for Common Business Oriented Language. COBOL is used for writing application programs and we cannot use it to write system software. The applications like those in Defense domain, insurance domain, etc. which require huge data processing make extensive use of COBOL. An example of COBOL programming language is shown below,
BASIC: One of the simplest high-level languages, with commands similar to English, it can be learned with relative ease even by schoolchildren and novice programmers. Since 1980, BASIC has been popular for use on personal computers. An example of BASIC programming language is shown below,
But how exactly did the procedural languages come into existence?
Procedural
languages are computer languages used to define the actions that a computer has
to follow to solve a problem. The first major procedural programming languages
appeared circa 1957-1964, including FORTRAN, ALGOL,
COBOL, PL/I and BASIC. PASCAL and C were published circa
1970-1972.
Let’s take a quick look at the brief history of some procedural languages
FORTRAN:
- The first FORTRAN compiler took about twenty-five person-years to complete and proved to be as efficient as the then-current assemblers, making it a striking achievement in the history of programming languages. FORTRAN I was released in 1957 and was followed in the spring of 1958 by FORTRAN II. It included function statements and better diagnostic messages. A more advanced version, FORTRAN III, depended heavily on the architecture of the IBM 704, and was not made into a commercial product. However, many of its features were incorporated into FORTRAN IV, which was released in 1962 and had a life of almost fifteen years. It added COMMON storage, double-precision and logical data types, and relational expressions as well as the DATA statements, which provided a simple facility to initialize variables. Programs written using versions subsequent to FORTRAN III were machine independent, which meant that they could be run on any scientific machine. For the first time one single language was used by many manufacturers for many different machines.
- By the mid-1970's FORTRAN IV was no longer a modern language, and although the investment in FORTRAN programs was immense it was time to bring it up to speed. In 1967 work began on what was later called FORTRAN 77, which became the official standard in April of 1978. By 1981 the demand for FORTRAN 77 compilers was very high, making it clear that it was a success. However, it did not have all the features needed to implement modern control structures, so work on its successor began in 1978. It was to include if-then-else control structures, case selection, do-end-do structure, and recursion, among other things. Work on this project ended in 1990 and FORTRAN 90 was published in 1991. FORTRAN 95, an extension of FORTRAN 90, was published in December 1997, and work on FORTRAN 200x was underway in 2001. It is an upward compatible extension of FORTRAN 95 adding support for exception handling, object-oriented programming, and improved interoperability with C.
ALGOL:
- ALGOL 58 was really a group effort. It was the first formal attempt to address issues of portability and integrated the best features of programming languages available at the time. It introduced new terms such as: type, formal versus actual parameter, for statement, the begin end delimiters, and three levels of language description. This effort was considered as a draft and was not commercially implemented. However, many recommendations for its improvement were considered at a Paris meeting in June 1959.
- In January 1960 seven representatives of European countries, including Peter Naur and Fritz Bauer, and six from the United States, including Backus and Perlis, met in Paris to develop ALGOL 60, which was expected to become a universal tool. ALGOL 60 became the standard for the publication of algorithms and was a great influence on future language developments. In 1962 a new international committee of computer scientists was formed to develop an enhanced version of ALGOL 60. The meetings began in 1965 and lasted until 1968 when ALGOL 68 was released.
COBOL:
- A meeting of forty representatives from the government, users, consultants, and manufacturers met at the Pentagon on May 1959 to discuss the need of a common business language. By December of 1959 the group had completed the specifications for COBOL, which were made public in 1960. The 1961 revision of COBOL included the Report Writer and Sort features and was the first to be widely implemented. COBOL was revised again in 1965 and 1968, the latter was the first American National Standards Institute (ANSI) standard compiler.
- COBOL 74 improved indexed file handling, specifically, ISAM (Indexed Sequential Access Method). During the growth of the microcomputer market, several versions of microcomputer COBOL became available and were used in the business community as well as in universities and colleges. COBOL 85 reflected the efforts of making it more compatible with structured programming by providing END IF, END PERFORM, a direct case structure, and an in-line PERFORM. Publication of the next revision was expected in 2002 and was to include object-oriented features.
BASIC:
- In 1963 a group of 3 people built a time-sharing system and developed the Beginners All-purpose Symbolic Instruction Code (BASIC).
- The original version was revised and expanded by Kemeny and Kurtz to include graphic statements in 1975. The following year, in order to comply with the requirements of structured programming, they dropped the GOTO statement; this version was called SBASIC and was taught to Dartmouth undergraduates. In 1983 they developed "true BASIC," a more powerful and versatile form that follows the proposed ANSI standards. Some of its features were optional line numbers, long variable names, array-handling statements, Do loops, a SELECT case structure, and independent subprograms. BASIC was widely accepted in the educational community because it was an easy language to teach and learn.
PASCAL:
- Pascal was developed by Niklaus Wirth, a Swiss computer scientist who was part of the ALGOL 68 committee. He felt that ALGOL was too complex and wanted to design a computer language that could easily be taught to college students. The new language, which is a derivative of ALGOL, was published in 1971 and was later called Pascal.
- Pascal was developed by Niklaus Wirth, a Swiss computer scientist who was part of the ALGOL 68 committee. He felt that ALGOL was too complex and wanted to design a computer language that could easily be taught to college students. The new language, which is a derivative of ALGOL, was published in 1971 and was later called Pascal. He went on to develop an entire system containing a compiler, text editor, an assembler, a linker, a file-handling utility, and a set of utility programs. This package, ready for distribution by 1977, was known as UCSD Pascal. By 1978 it began to receive national attention.
C:
- C is one of the descendants of ALGOL 60. It was developed in 1972 by Ken Thompson and Dennis Ritchie, both of Bell Laboratories. C compilers can basically run on all machines, and since a standard for C was defined in 1988, most C programs are portable.
- When compared to other programming languages such as FORTRAN or Pascal, C has remained quite stable. Its success in the early 1980's was due in part to its close ties with UNIX and its availability on personal computers. Additionally, it satisfied the needs of both system and application programmers alike. Several languages such as C, Perl, and Java script are based on C's syntax.
PL/I:
- PL/I began life as part of an attempt to unify business and scientific computing. In the early 1960s, business computing was being done mostly in COBOL, while developers in science, math, and academia were mostly using Fortran. Even the hardware used by the two communities was different. IBM wanted move everyone onto a common hardware platform (the System/360) and wanted a common programming language to go along with it.
- The team tasked with creating this common language initially attempted to begin with Fortran and extend it to add the required features from COBOL. This proved unsuccessful, and they began work on a new language altogether, based loosely on ALGOL. The new language was briefly named NPL (“new programming language”), and then MPPL (“Multi-purpose programming language”), and then finally PL/I.
- The first description of the language (still called NPL) was released in 1964. The first compiler came out in 1966. In 1967 work began writing a complete specification of the language.
Well, we now have some idea about the history of procedural language as well, but is that enough? No, right?
Let’s continue to explore more about the features of procedural language
The features can
be broadly classified into two categories: Basic features and Key features.
BASIC FEATURES:
KEY FEATURES:
Predefined functions - A predefined function is typically an instruction identified by a
name. Usually, the predefined functions are built into higher-level programming
languages, but they are derived from the library or the registry, rather than
the program. One example of a pre-defined function is ‘charAt()’, which
searches for a character position in a string.
Local Variable - A local variable is a variable that is declared in the main
structure of a method and is limited to the local scope it is given. The local
variable can only be used in the method it is defined in, and if it were to be
used outside the defined method, the code will cease to work.
Global Variable - A global variable is a variable which is declared outside every
other function defined in the code. Due to this, global variables can be used
in all functions, unlike a local variable.
Modularity - Modularity is when two dissimilar systems have two different tasks
at hand but are grouped together to conclude a larger task first. Every group
of systems then would have its own tasks finished one after the other until all
tasks are complete.
Parameter passing - Parameter Passing is a mechanism used to pass parameters to
functions, subroutines or procedures. Parameter Passing can be done through
‘pass by value’, ‘pass by reference’, ‘pass by result’, ‘pass by value-result’
and ‘pass by the name’.
We are doing great!
There we go!
Non-Procedural
Oriented programming language, removes some of the flaws encountered in the Procedural
programming language. It treats the data as a critical element of the program
and doesn’t allow to flow freely around the system. It dumpsites problem in an
object and then builds data and functions around these objects. Data of an
object can be accessed only by the functions associated with that object.
However, one object can communicate with functions of different objects.
Excellent!
Let’s continue to explore more about the non-procedural language
FEATURES:
Emphasis is on data rather than procedure.
- Programs are divided into what are known as object. That’s why it is known as Object Oriented Programming Language or OOP.
- Data structures are designed such that they are characterized as object.
- Functions that operate on the data of an object are tied together in the data structure.
- Data is hidden and can’t be accessed by external functions.
- Objects may communicate through the functions.
- New data and objects can be easily added whenever necessary.
- Follows bottom-up approach in program design.
KEY CONCEPTS OF OOP:
Some examples of
non-procedural languages are as follows: - Java, C++, SQL (Structured Query
Language), RPG (Report Program Generator), etc.
Wonderful!
Hope you like this blog. Stay tuned for our upcoming blog.. 🤞😊
References:
Different
types of procedural language - https://www.tutorialspoint.com/index.htm
Online IDE used to produce the examples - https://www.jdoodle.com/execute-pascal-online/
Key concepts of OOPs - https://www.javatpoint.com/java-oops-concepts
Non-Procedural language and it’s Features –
Book: Object-Oriented Programming with C++ by E Balagurusamy, Edition:7E