Chapter 3 - Computer Programming Languages
Chapter 3 - Computer Programming Languages
3.1. Introduction
What is a Programming Language
There are many definitions of what constitutes a programming language, and none of these is the
‘correct’ answer. Programming languages are needed to allow human beings and computers to
talk to each other. Computers, as yet, are unable to understand our everyday language or, in fact,
the way we talk about the world. Computers understand logic expressed mathematically through
what is known as machine code. Computer language consists of 1s and 0s or the binary system,
which the majority of human beings would find very difficult to communicate in. Computer
languages enable humans to write in a form that is more compatible with a human system of
communication. This is then translated into a form that the computer can understand. Here are
some different ideas on what constitutes a programming language.
1) A programming language has been defined as a tool to help the programmer.
2) A way of writing that can be read by both a human being and a machine.
3) A sequence of instructions for the machine to carry out.
4) A way for a human being to communicate with a machine that is unable to understand
natural language.
5) A computer language offers a means of writing algorithms that can be understood by
both human being and machine. Machines are unable to understand natural language, so
a human being uses algorithms that are translated into machine code by the programming
language. Machine code is difficult for humans to use, so a language ‘translates’ human
readable language into machine readable form.
6) A computer program offers humans a standard way of expressing algorithms to solve
particular problems. As languages offer a convention it allows other humans to read the
program, and change it if they need to.
High level languages are more abstract, easier to use and more portable across platforms as
compared to low-level programming languages. Source programs are written in statements akin
to English. A high level language code is executed by translating it into the corresponding
machine language code with the help of a compiler or interpreter. High level languages can be
classified into the following categories;
1) Procedure-oriented languages (third generation)
2) Problem-oriented languages (fourth generation)
3) Natural languages (fifth generation).
Procedure languages.
High-level languages designed to solve general-purpose problems, example BASIC, COBOL,
FORTRAN, C, C++ and JAVA. They are designed to express the logic and procedure of a
problem. Though the syntax of the languages may be different, they use English-like commands
that are easy to follow. They are portable.
Natural Languages
Natural languages widely known as fifth generation languages, are designed to make a computer
to behave like an expert and solve problems. The programmer just needs to specify the problem
and the constraints for problem solving. Natural languages such as LISP and PROLOG are
mainly used to develop artificial intelligence and expert systems.
3.4.1. Compiler
A compiler is a manufacturer specifically written computer program which translates (or
compiles) a source code computer program that translates the source code written in a high level
language into the corresponding object code of the low level language.
Characteristics of a Compiler:
1) Translates the source program code into machine code
2) Includes linkages for closed sub-routine
3.4.2. Interpreter:
The interpreter is a translation program that converts each high-level language statement into the
corresponding machine code. The translation process is carried out just before the program
statement is executed. Instead of the entire program, one program statement at a time is
translated and executed immediately. When using an interpreter, the source code translated
every time the program is executed
The commonly interpreted languages include BASIC and PERL. Though interpreters are easier
to create as compared to compilers, the compiled languages can be executed more efficiently
and are faster. Interpreters are appropriate in;
1) Handling user commands in an interactive system
2) Debugging programs as they run (removing program faults).
3) Handling software produced for or by a different computer.
There are a number of different ways that the programmer can think about the design of the
system, from the top-down of structured programming to object oriented design issues. Some
languages are geared towards one particular style of design, whilst others incorporate many
types. Each of these language paradigms enables the programmer to consider the problem from a
different viewpoint. There are a few basic questions that can be asked to help when making
these decisions:
1. How readable is the language, to humans? If parts of the program are going to be read or
altered separately from the entire program is might be worth considering how legible they
are going to be. It is also useful to consider the length of names allowed in the language.
Statements such as GO TO, FOR, WHILE and LOOP have increased the readability of
programs, and lead to neater programs. These statements also affect the syntax or grammar.
2. When it comes to writing the program, how easy is it to write the program in this particular
language? A programming language that is easy to write in can make the process easier and
faster. It may help to reduce mistakes. FOR loops and other types of statement allow the
programmer to write much simpler code. This will save time and money, and also make the
program smaller.
3. How reliable is the language? Not all languages create robust programs, and some help the
programmer to avoid making errors. A program that is not robust can cause errors, and code
can ‘decay’. Any language that helps the programmer to avoid mistakes will make it easier
to use.
4. How much would it cost to develop using a given language? Is the language expensive to
use and to maintain? Programs may need to be updated or redeveloped, and an expensive
language may make this prohibitive.
5. How complicated is the syntax going to be? Syntax is an important consideration. Clarity
and ease of understanding are important, as is a syntax that seems logical and sensible.
C was developed in the 1970s at Bell Labs. It was originally designed for and used on the DEC PDP-
11—whose operating system, C compiler, and UNIX application programs were all written in C. In
1988, an ANSI standard was issued to codify C, which was revised in 1999. C was the de facto
standard for microcomputer and workstation programming in the 1980s and 1990s.
4) C++
C++, an object-oriented language founded on C, was developed at Bell Laboratories in the 1980s. In
addition to being compatible with C, C++ provides classes, polymorphism, exception handling,
templates, and it provides more robust type checking than C does. It also provides an extensive and
powerful standard library.
5) C#
C# is a general-purpose, object-oriented language and programming environment developed by
Microsoft with syntax similar to C, C++, and Java, and it provides extensive tools that aid
development on Microsoft platforms.
6) Cobol
Cobol is an English-like programming language that was originally developed in 1959–1961 for use
by the Department of Defense. Cobol is used primarily for business applications and is still one of
the most widely used languages today, second only to Visual Basic in popularity (Feiman and Driver
2002). Cobol has been updated over the years to include mathematical functions and object-oriented
capabilities. The acronym “Cobol” stands for COmmon Business-Oriented Language.
7) Fortran
Fortran was the first high-level computer language, introducing the ideas of variables and high-level
loops. “Fortran” stands for FORmula TRANslation. Fortran was originally developed in the 1950s
and has seen several significant revisions, including Fortran 77 in 1977, which added block-
structured if-then-else statements and character string manipulations. Fortran 90 added user-defined
data types, pointers, classes, and a rich set of operations on arrays. Fortran is used mainly in scientific
and engineering applications.
8) Java
Java is an object-oriented language with syntax similar to C and C++ that was developed by Sun
Microsystems, Inc. Java was designed to run on any platform by converting Java source code to byte
code, which is then run in each platform within an environment known as a virtual machine. Java is
in widespread use for programming Web applications.
9) JavaScript
JavaScript is an interpreted scripting language that was originally loosely related to Java. It is used
primarily for client-side programming such as adding simple functions and online applications to
Web pages.
10) Perl
Perl is a string-handling language that is based on C and several UNIX utilities. Perl is often used for
system administration tasks, such as creating build scripts, as well as for report generation and