PROGRAMMING LANGUAGES
- A programming language is a set of symbols in computer language that are used in coding
computer programs.
- A programming language is a specially written code used for writing application programs
e.g. C, Pascal, COBOL, BASIC, Visual Basic, C++ and Java (Originally for intelligent
consumer-electronic devices (cell phones), then used for creating Web pages with dynamic
content, now also used for developing large-scale enterprise applications)
- Program: a set of detailed and unambiguous instructions that instructs a computer to perform
a specific task, for example, to add a set of numbers.
- Programming: A process of designing, coding and testing computer programs
- Programmer: A person who specialises in designing, coding and testing computer programs
- Problem: any question or matter involving difficulty or uncertainty and is proposed for a
computer solution.
TYPES OF PROGRAMMING LANGUAGES
1. Low Level Languages (LLL):
- These are programming languages used to write programs in machine code (i.e in 1s and 0s)
or in mnemonic codes.
- Low level languages are machine oriented (machine specific).
- Low level language is in two forms:
(a) Machine Language and
(b) Assembly Language.
a. Machine code (language)
- Is the language used to write programs in binary form (1s and 0s).
- Machine code executes without translation.
- Machine language has the following advantages:
Programs run faster since they are already in computer language. There is no need
for conversion as programs are in machine language.
Programs occupy very small disc storage space by storing just 1s and 0s.
Disadvantages of Machine language:
- They are very difficult to learn.
- They are difficult to understand.
- Very difficult to use and therefore very few programmers use them these days.
- It takes too long to debug and therefore is prone to some errors.
- It takes too long to develop working programs.
- They are machine dependent (they can only work on type of computer designed for and
not work on other computers)
b. Assembly Language:
- These are programming languages that use mnemonic codes in coding programs.
- Mnemonic codes are abbreviations used to represent instructions when coding assembly
language programs, for example, LDA for Load, ADD for Addition, etc.
- One assembly language statement is equivalent to one machine code instruction and
therefore programming lengthy and time consuming.
- However, assembly language programs are efficient.
- Programs also run faster as they are closer to machine language and therefore are used in
designing programs that needs efficient timing, e.g. games like chess, operating systems,
etc.
- Assembly language is used when there is need to access registers and memory addresses
directly.
- Assembly language instructions also occupy very little disc storage space.
- Mnemonic codes are very close to machine code, hence are low level language assembly
language codes.
- They however run on specific computer architecture since they are hardware aligned.
- They also contain different forms of instruction, e.g. jump, control, arithmetic, etc.
- Assembly language allows immediate, direct and other forms of memory addressing.
Application: Assembly language is used in:
- Coding operating systems
- Coding device drivers
- Coding programs for embedded systems like DVD players, decoders, etc.
- Coding encryption software
Advantages of Assembly language:
- One assembly language instruction corresponds to one machine code instruction and
therefore translation is easier and faster to code.
- Programs run faster since they are close to machine code.
- They occupy very small disk storage space hence are economical to use.
- Easier for a programmer to use than machine language.
Disadvantages of Assembly Language
- They are very difficult to learn.
- They are very difficult to understand.
- Takes too long to develop working programs.
- They can be machine dependent (machine oriented) unless the machines use the same
processor chip.
2. High Level Languages (HLL):
- These are programming languages that use English-like statements in coding programs, for
example COBOL, Pascal, BASIC, etc.
- High Level languages are mostly used for developing user applications like stock control
systems, personnel records, etc.
- There are so many high level languages because of competition from designers who want
to outpace each other.
- It can also be due to the fact that we have so many application areas in real life so each high
level language is designed for a specific problem (problem oriented/problem specific) to be
solved in our daily lives, for example BASIC was designed for learning purposes, COBOL
for business applications, FORTRAN for scientific purposes, etc.
- High Level languages are independent of the architecture of the computer.
- One statement is translated into several equivalent machine code instructions before it is
executed.
- Below is an example of a BASIC program that accepts two numbers entered through the
keyboard, adds them and display the result on the screen:
INPUT “ENTER FIRST NUMBER.”, A
INPUT “ENTER SECOND NUMBER.”, B
SUM = A + B
PRINT SUM
END
- Programs written in High Level Language are first converted to machine code before
running.
High level languages have the following features:
- Problem oriented (Machine independent): they are designed to solve an application
problem and therefore runs on any machine
- They are portable: they can be transferred from one machine to another and run without
problem.
- Instructions are written in English statements which are easier to understand.
Facilities of High Level Languages
The following facilities of high level languages are not found in low level languages
- Selection structures
- Iteration structures
- Built-in routines to simplify input and output, e.g. INPUT, PRINT, PRINTLN, etc in
BASIC.
- Built-in functions like sqr, sqrt, val, etc.
- Data structures like strings, arrays, records, etc.
- User-defined functions.
Advantages of High Level Languages:
- They are easier to understand since they are written in English-like statements which
are more readable.
- They are easier to learn.
- It is easier to work with, that is to correct errors (debug) and to test programs.
- They are problem oriented and therefore can be used on any computer (not machine
dependent)
Disadvantages of HLL
- Takes long to run since they need to be first converted to machine code.
- They occupy a lot of disk storage space as compared to low level languages.
Types Of High Level Languages/Programming Paradigms
- Programming paradigm refers to methods used to categorise high level languages in terms
of organising principles used by the designers. It is pattern that serves as a school of thought
for programming of computers.
- Such programming paradigms are as follows:
Imperative/procedural languages
Declarative languages
General purpose languages
Special purpose languages
Object oriented languages (OOP)