Lecture # 01
A
programming language paradigm
is the systems of ideas that have been used to guide the design of
programming languages. These paradigms are realised to a greater or lesser
extent in various computer languages, although the design of a given language
may reflect the influence of more than one paradigm.
Imperative: The language provides statements, such as assignment
statements , which explicitly change the state of the memory of the
computer.
Functional: In this paradigm we express computations as the evaluation
of mathematical functions.
Logic: In this paradigm we express computation in exclusively in
terms of mathematical logic
Object-Oriented: In this paradigm we associate behaviour with data-structures
called " objects " which belong to classes which are
usually structured into a hierarchy.
Most practical imperative,
functional and object-oriented languages embody features of more than one paradigm.
Functional Paradigm:
In this we emphasise the idea of
computation as being about evaluating mathematical functions combined in expressions . While all languages try to provide a
representation of basic functions like addition, functional languages support a
functional way of expressing computations on large and complex structures. In a
pure functional language a mathematical identity like:
fred(x) + fred(x) = 2*fred(x)
Imperative
Design:
Languages which reflect this
paradigm recognise the fact computers have re-usable memory that can change
state. So they are characterised by statements, which affect the state
of the machine, for example.
x := x+1
Logic
Paradigm:
While the
functional paradigm emphasises the idea of a mathematical function, the logic
paradigm focusses on predicate logic, in which the basic concept is a relation.
Logic languages are useful for expressing problems where it is not obvious what
the functions should be. Thus, for example where people are concerned, it is
natural to use relations.
Object
Oriented Paradigm:
The Object Oriented paradigm (often written O-O) focusses on
the objects that a program is representing, and on allowing them to exhibit
"behaviour"
Procedural Languages:
Computer program size:
1970s and 1980s
Mathematical modeling
Modeling for computer
programming