Unit 4
Programming Concepts

Low level languages - e.g. assembly language

High level languages

Procedural (imperative) languages - e.g. Pascal, C, COBOL, BASIC


  • developed to teach structured programming


  • developed for use in scientific, engineering and mathematical applications
  • inbuilt mathematical functions
  • library of statistical, engineering and scientific routines readily available
  • double precision arithmetic -> more accurate calculations
  • good array handling -> suitable for solving large sets of simultaneous equations


  • suitable for data processing applications
  • facility to access databases from within a COBOL program
  • excellent file handling capabilities
  • 'sort' verb to allow files to be sorted into sequence
  • good report-formatting facilities
  • good validation facilities


  • developed for systems programming for UNIX OS
  • relatively low-level -> efficient programs for OS and compilers
  • also easy to learn and portable

Object-oriented (imperative) languages - e.g. Java, C++, Delphi

Declarative languages - e.g. Prolog

Embedded systems - where the computer is just one component within a larger engineering system

Real-time system - system whose processing time is within that of the problem so that it can influence the source of the data

Criteria for selecting a programming language:

Object-Oriented Programming

Object class - collection of characteristics and procedures that an object within the classification can have or perform

Class - set of objects which share a common behaviour

Object - e.g. form, dialogue box, command button

Encapsulation - process of bundling together procedures and data

Inheritance - a relationship among classes wherein one class shares the structure and behaviour of another class

Polymorphism - two or more classes derived from the same base class but with some unique features of their own

Inherited polymorphism - objects of different classes process same message because they inherit it from common ancestor

Independent polymorphism - different classes use same field or method name for different values or activities

Containment - objects can contain other objects

Prolog (PROgramming LOGic)

Expert systems - e.g. NHS direct

Natural language processing

Iteration - a statement in a program that causes the program to repeat one or more statements

Recursively defined - an object which is defined in terms of itself. It calls itself and is therefore re-entrant

When a subroutine is called the return address and the values of any parameters in the subroutine are stored in a stack.

Advantages of recursion

Disadvantages of recursion

List - dynamic 1D array

A list may be implemented using an array. Two extra variables are used to hold the current size of the list and the size of the array. An empty list is denoted by [ ]

Linked list - dynamic structure used to hold a sequence

Queue - e.g. print queue, keyboard buffer

Uses of queues


Uses of stacks

Binary tree

Linear search

Binary search

Bubble sort


Insertion sort