INTRODUCTION TO PROGRTAMMING PARADIGMS

CONTENTS:

  1. Classification of languages.
  2. Program structure and programming languages as communications media.
  3. Complexity and program processing.



1. CLASSIFICATION OF PROGRAMMING LANGUAGES

To facilitate discussion of any subject it is desirable and convenient to group together similar facets of the subject according to some grouping notation. Computer programming are not an exception to this, however, there3 are many categorisations that we can adopt. The most common are as follows:


1.1 MACHINE, ASSEMBLER AND HIGH LEVEL LANGUAGES

Before discussing this classification it is appropriate to remined ourselves of the operationb of a computer program. A computer program resides in the primary memory where it is represented as a set of machine instructions which in turn are represented as sequences of binary digits. At any point in time the computer is said to be in a particular state. A central feature of the state is the instruction pointer which points to the next machine instruction to be executed. The execution sequence of a group of machine instructions is known as the flow of control.

MACHINE CODE Thus, a program running on a computer is simply a sequence of bits. A program in this format is said to be in machine code. We can write programs in machine code:

23fc 0000 0001 0000 0040
0cb9 0000 000a 0000 0040
6e0c
06b9 0000 0001 0000 0040
60e8

ASSEMBLY LANGUAGE Assembly language (or assembler code) was our first attempt at producing a mechanism for writing programs that was more palatable to our selves. Of course a program wriiten in machine code, ibn order to "run", must first be translated (assembled) into nachine code.

movl  		#0x1,n
compare:
  	cmpl 	#oxa,n
  	cgt 	end_of_loop
  	acddl 	#0x1,n
  	bra 	compare
end_of_loop: 

HIGH LEVEL LANGUAGE From the foregoing we can see that assembler language is not much of an improvement on machine code! A more problem oriented (rather than machine oriented) mechanism for creating computer programs would also be desirable. Hence the advent of high(er) level languages commencing with the introduction of "Autocodes", and going on to Algol, Fortran, Pascal, Basic, Ada, C, Etc.


1.2. CHRONOLOGICAL CLASSIFICATION OF PROGRAMMING LANGUAGES

1940s
Prelingual phase: Machine code
1950s
Exploiting machine power: Assembler code, Autocodes, first version of Fortran 1960s
Increasing expressive power: Cobol, Lisp, Algol 60, Basic, PL/1 --- but most "proper" programming still done in assembly language.
1970s
Fighting the "software crisis":
  • Reducing machine dependency - portability.
  • Increasing program correctness - Structured Programming, modular programming and information hiding.
Examples include Pascal, Algol 68 and C.
1980s
reducing complexity - object orientation, functional programming.
1990s
exploiting parallel and distributed hardware (going faster!), e.g. various parallel extensions to existing languages and dedicated parallel languages such as occam.
2000s
Genetic programming languages, DNA computing, bio-computing?

THE SOFTWARE CRISIS The phrase software crisis alludes to a set of problems encountered in the development of computer software during the 1960s when attempting to build larger and larger software systems using existing development techniques. As a result:

  1. Schedule and cost estimates were often grossly inaccurate.
  2. Productivity of programmers could not keep up with demand.
  3. Poor quality software was produced.

To address these problems the discipline of software engineering came into being.

STRUCTURED PROGRAMMING

The concept of structured programming devised in late 1960s (Dijkstra and others). Emphasizes programming using sequences, conditions and repetition (no jumps and "goto" statements). Constructs which have a predictable logic, i.e. they are entered at the top and exited at the bottom. Structured programming enhances readability and hence maintainability.

MODULAR PROGRAMMING The concept of modular programming was first taken seriously in the early 1970s. Modular programming is concerned with sub-division of programs into manageable "chunks". The concept also encompasses ideas about levels of abstraction - modules are usually arranged in a hierarchy of abstraction. •Modularity also espouses the concept of information hiding.

INFORMATION HIDING Information hiding espouses the idea that the attention of programmers should not be distracted by details not central to their current programming task, i.e. programmers should not be required to be concerned with unnecessary details. In terms of modular programming modules should be designed so that information contained within those modules is "hidden" from other modules, e.g. implementational details of functions.


1.3. LANGUAGE GENERATIONS

GENERATIONCLASSIFICATION
1stMachine languages
2ndAssembly languages
3rdProcedural languages
4thApplication languages (4GLs)
5thAI techniques, inference languages
6thNeural networks


1.4. LANGUAGE LEVELS OF ABSTRACTION

.
LEVELINSTRUCTIONSMEMORY HANDLING
Low level languagesSimple machine-like instructions Direct memory access and allocation
High level languagesExpressions and explicit flow of control Memory access and allocation through operators
Very high level languagesFully abstract machine Fully hidden memory access and automatic allocation


1.5. DECLARATIVE v NON-DECLARATIVE PROGRAMMING

Languages can also be classified by the emphasis they put on "what is to be achieved" against "how it is to be achieved". The first are said to be declarative (e.g. functional and logic languages). The second is said to be non-declarative (e.g. imperative languages).


1.6. PROGRAMMING PARADIGMS?

In science a paradigm describes a set of techniques that have been found to be effective for a given problem domain (i.e somebody somewhere must believe in it). A paradigm can typically be expressed in terms of a single principle (even if this is in fact an over simplification). This principle must be supported by a set of techniques. In the context of programming languages we say that a paradigm induces a particular way of thinking about the programming task. We can identify four principal programming paradigms:

PROGRAMMING MODELS The 4 main programming paradigms aim at solving general programming problems, but sometimes there are additional aspects to a problem which require us to "tweak" a paradigm. The result is not a new paradigm but a programming model founded on a particular paradigm. •An example is parallel or distributed programming.




Return to introduction home page or continue.




Created and maintained by Frans Coenen. Last updated 03 July 2001