Chapter 1
Programming Paradigms

Kurt Nørmark
Department of Computer Science, Aalborg University, Denmark


Abstract
Next lecture
Index References Contents
In this introductory part of the material we will introduce the concept of programming paradigms.


Programming Paradigms

Paradigm
Slide Annotated slide Contents Index
References Textbook 
The word programming paradigm is used in several different, although related meanings in computer science.

It is interesting and useful to investigate the meaning of the word 'paradigm'

"An example that serves as pattern or model."

The dictionary meaning of the word 'paradigm' comes from 'The American Heritage Dictionary of the English Language, Third Edition'.

"A philosophical and theoretical framework of a scientific school or discipline within which theories, laws, and generalizations and the experiments performed in support of them are formulated"

This dictionary meaning of the word paradigm comes from 'The Merriam-Webster's Collegiate dictionary' - meaning 3 out of 3.

  • Programming paradigm (in this course)

    • A pattern that serves as a school of thoughts for programming of computers

  • Programming technique

    • Related to an algorithmic idea for solving a particular class of problems

    • Examples: 'Divide and conquer' and 'program development by stepwise refinement'

  • Programming style

    • The way we express ourselves in a computer program

    • Related to elegance or lack of elegance

  • Programming culture

    • The totality of programming behavior, which often is tightly related to a family of programming languages

    • The sum of a main paradigm, programming styles, and certain programming techniques.

The main programming paradigms
Slide Annotated slide Contents Index
References Textbook 

We identify four main programming paradigms and a number of minor programming paradigms

The concept Main paradigm: A main programming paradigm stems an idea within some basic discipline which is relevant for performing computations

  • Main programming paradigms

    • The imperative paradigm

    • The functional paradigm

    • The logical paradigm

    • The object-oriented paradigm

  • Other possible programming paradigms

    • The visual paradigm

    • One of the parallel paradigms

    • The constraint based paradigm

Reference


Overview of the four main programming paradigms

Overview of the imperative paradigm
Slide Annotated slide Contents Index
References Textbook 
The word 'imperative' can be used both as an adjective and as a noun. As an adjective it means 'expressing a command or plea'. In other words, asking for something to be done. As a noun, an imperative is a command or an order. Some programming languages, such as the object oriented language Beta, uses the word 'imperative' for commands in the language.

First do this and next do that

  • Characteristics:

    • Discipline and idea

      • Digital hardware technology and the ideas of Von Neumann

    • Incremental change of the program state as a function of time.

    • Execution of computational steps in an order governed by control structures

      • We call the steps for commands

    • Straightforward abstractions of the way a traditional Von Neumann computer works

    • Similar to descriptions of everyday routines, such as food recipes and car repair

    • Typical commands offered by imperative languages

      • Assignment, IO, procedure calls

    • Language representatives

      • Fortran, Algol, Pascal, Basic, C

    • The natural abstraction is the procedure

      • Abstracts one or more actions to a procedure, which can be called as a single command.

      • "Procedural programming"

We use several names for the computational steps in an imperative language. The word statement is often used with the special computer science meaning 'a elementary instruction in a source language'. The word instruction is another possibility; We prefer to devote this word the computational steps performed at the machine level. We will use the word 'command' for the imperatives in a high level imperative programming language.

A procedure abstracts one or more actions to a procedure, which can be activated as a single action.

Reference

Overview of the functional paradigm
Slide Annotated slide Contents Index
References Textbook 

Evaluate an expression and use the resulting value for something

  • Characteristics:

    • Discipline and idea

      • Mathematics and the theory of functions

    • The values produced are non-mutable

      • Impossible to change any constituent of a composite value

      • As a remedy, it is possible to make a revised copy of composite value

    • Atemporal

      • Time only plays a minor role compared to the imperative paradigm

    • Applicative

      • All computations are done by applying (calling) functions

    • The natural abstraction is the function

      • Abstracts a single expression to a function which can be evaluated as an expression

    • Functions are first class values

      • Functions are full-fledged data just like numbers, lists, ...

    • Fits well with computations driven by needs

      • Opens a new world of possibilities

Reference

Overview of the logic paradigm
Slide Annotated slide Contents Index
References Textbook 

Answer a question via search for a solution

  • Characteristics:

    • Discipline and idea

      • Automatic proofs within artificial intelligence

    • Based on axioms, inference rules, and queries.

    • Program execution becomes a systematic search in a set of facts, making use of a set of inference rules

Reference

Overview of the object-oriented paradigm
Slide Annotated slide Contents Index
References Textbook 

Send messages between objects to simulate the temporal evolution of a set of real world phenomena

  • Characteristics:

    • Discipline and idea

      • The theory of concepts, and models of human interaction with real world phenomena

    • Data as well as operations are encapsulated in objects

    • Information hiding is used to protect internal properties of an object

    • Objects interact by means of message passing

      • A metaphor for applying an operation on an object

    • In most object-oriented languages objects are grouped in classes

      • Objects in classes are similar enough to allow programming of the classes, as opposed to programming of the individual objects

      • Classes represent concepts whereas objects represent phenomena

    • Classes are organized in inheritance hierarchies

      • Provides for class extension or specialization

Reference


Collected references
Contents Index
Foldoc: visual programming
Foldoc: imperative
Foldoc: functional programming
Foldoc: logic programming
Foldoc: object-oriented programming

 

Chapter 1: Programming Paradigms
Course home     Author home     About producing this web     Previous lecture (top)     Next lecture (top)     Previous lecture (bund)     Next lecture (bund)     
Generated: July 2, 2013, 09:27:14