Computer programs are collections of instructions that tell a computer how to interact with the user, interact with the computer hardware and process data. The first programmable computers required the programmers to write explicit instructions to directly manipulate the hardware of the computer. This “machine language” was very tedious to write by hand since even simple tasks such as printing some output on the screen require 10 or 20 machine language commands. Machine language is often referred to as a “low level language” since the code directly manipulates the hardware of the computer.
By contrast, higher level languages such as “C”, C++, Pascal, Cobol, Fortran, ADA and Java are called “compiled languages”. In a compiled language, the programmer writes more general instructions and a compiler (a special piece of software) automatically translates these high level instructions into machine language. The machine language is then executed by the computer. A large portion of software in use today is programmed in this fashion.
We can contrast compiled programming languages with interpreted programming languages. In an interpreted programming language, the statements that the programmer writes are interpreted as the program is running. This means they are translated into machine language on the fly and then execute as the program is running. Some popular interpreted languages include Basic, Visual Basic, Perl, Python, and shell scripting languages such as those found in the UNIX, Linux and MacOS X environment.
We can make another comparison between two different models of programming. In structured programming, blocks of programming statements (code) are executed one after another. Control statements (described later on) change which blocks of code are executed next.
In object oriented programming, data are contained in objects and are accessed using special methods (blocks of code) specific to the type of object. There is no single “flow” of the program as objects can freely interact with one another by passing messages.
In this tutorial, we focus only on structured programming.