5. Procedural concepts
With procedural languages, you code specific instructions for the computer to carry out - it is all about the 'do-this, then-this, then-this' style of programming.
This is one of the commonest programming paradigms in use.
The main points to know about procedural programming languages are:
Imperative Languages
They are sometimes called imperative languages. Imperative means 'to give orders, or instructions' and so procedural languages are all about telling the computer what to do, step by step.
Sequential instructions
All imperative languages lay out their instructions in sequence.
3rd generation languages
Procedural languages are examples of 3rd generation languages.
It is now many decades since the first computer language was created. Third generation languages make it easier for people to read and understand the code. This is done by using ideas such as naming variables and using functions or subroutines to partition the code into manageable chunks.
Examples of Procedural languages are
C, Pascal, C++, FORTRAN, Java, COBOL
A typical clip of source code written in a procedural language:-
y = 1224; for (x = 0; x < 100; x++) { z = y + x; } |
---|
In this clip, a variable y is being set, then the code enters a loop. So the procedural language is precisely defining what the computer should be doing step by step.
As a comparison, SQL database language is a 'non-procedural' language. A simple SQL query is shown below.
CREATE TABLE Parts SELECT * From Customer |
---|
Here, the first instruction tells the database management software to create a table called Parts, then it makes a request for all records from the Customer table.
The SQL programmer does not need to know the precise detail of how a table is made or the details behind pulling down all records from a table.
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: Procedural Languages
Pros
- Excellent for general purpose programming
- Many books and references available on well-tried and tested coding algorithms - no need to re-invent the wheel.
- Good level of control without having to know precise target CPU details - unlike low level languages
- Portable source code - use a different compiler to target a different CPU
Cons
- As there are so many procedural languages, a programmer tends to have to specialise in a particular language in order to get work. A COBOL specialist has a different clientele to a 'C' specialist.
- Need to be very precise and knowledgeable about programming instructions, and so a fully de-bugged working program takes more time to put together compared to fourth generation languages such as Simulink.
- Not as efficient as hand-crafted source code written in a low level language
- Poor at handling fuzzy conditions as found in Artificial Intelligence applications - unlike declarative languages such as PROLOG.
Copyright © www.teach-ict.com