Programming Languages


Here we start a series of posts on programming languages. This website has posted information on several languages already, such as HTML, CSS, JavaScript and C#. This first post is on procedural languages. The next post is on procedural vs. object-oriented languages.

Key Characteristics Shared by All Procedural Programming Languages

The book Programming Languages for MIS – Concepts and Practice written by Hai Wang and Shouhong Wang published by CRC Press discusses, in part, characteristics of all procedural programming languages. This post is based on that information.

All computer programming languages essentially boil down to:

  • assignment statements
  • if statements
  • while loops

A procedural programming language is used to carry out arithmetic or logical operations. The knowledge of the key characteristics learned from one procedural programming language can be applied to other procedural programming
languages.

Syntax, Sentence, and Word

A computer programming language has its syntax—the rules that govern the structure of sentences of the programs written in the language. In a procedural programming language, a sentence consists of words, numbers, and punctuation. There are two types of words in a procedural programming language: keyword (or reserved word) and user-defined word. A keyword represents a specific meaning of the language (e.g., a specific instruction). A user-defined word is defined by the programmer to name a variable or a module. A word used in a procedural programming language must not contain a space and is usually case sensitive.

Variable

A variable is the name of a piece of CPU memory that holds data. A variable name is defined by the programmer and must be a user-defined word. Clearly, variable names are case sensitive; that is, AVariable is different from avariable. In addition, a name of a variable must be a single user-defined word without a space. A variable has its data type, such as integer, character, etc. The data held by the variable are called the value of the variable.

Arithmetic Operation

Arithmetic operations in procedural programming are similar to day-to-day arithmetic calculations, but use reverse expression. For instance, instead of A+B=C, C=A+B is used in programming; this means: “Let C equal to A plus B.” Multiplication is denoted by the asterisk symbol “*”, and division is denoted by the slash symbol “/”.

Execution Sequence

A computer program consists of a set of instructions. During the execution of the procedure of a program, instructions are executed one after another in a sequence (so-called execution sequence) in which they are encountered, but not in the order in which they are listed in the program. Logical instructions (e.g., if-statement and loops) can control the execution sequence of the program, as explained next.

If-Then-Else Logic

An if-then-else statement controls the computer execution sequence based on a condition that is defined by the current value of a particular variable(s). There are other flow-control statements. C# enables you to label lines of code and then jump straight to them using the goto statement. Goto has its dangers however. There are three branching techniques available in C#: the ternary operator, the if statement and the switch statement. In C# the switch statement is used with other keywords such as case, break and default.

Loop

A loop is a group of instructions that are specified once but are executed several times in succession. The common loops include for-loop and do-loop. The C# language has the while loop which is simply a variation of the do loop.

Module

A large program must be divided into modules to make the program easy to debug. Also, a module can be reused. Here, a module could be a paragraph of instructions, an independent function, or a class, depending upon the specific language in discussion. An instruction in a module can call another module to accomplish a specific task carried out by the called module.

Level

Programming languages fall under a particular level. Assembly language is a “low-level” language. C is a “mid-level” language. VB.NET is a “high-level” language. The lower the language the closer it is to the bits and bytes (and zeros and ones) of the computer.

Wikipedia’s Comparison

On the Internet, Wikipedia compares programming languages with several descriptors. Imperative, Object Oriented, Functional, Procedural, Generic, Reflective and Event Driven.

Programming paradigms are a way to classify programming languages according to the style of computer programming.