Lecture overview -- Keyboard shortcut: 'u'  Previous page: Overview of the four main programming paradigms [Section] -- Keyboard shortcut: 'p'  Next page: Overview of the functional paradigm -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Lecture 1 - Page 5 : 8
Functional Programming in Scheme
Programming Paradigms
Overview of the imperative paradigm

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.