Introduction

$\triangleright$
The power of a computer is its versatility: It can be programmed, i.e. its basic commands can be combined to do very different tasks.

$\diamond$
Typical basic commands:

data movement
``get data from memory cell 4228 into register r3''
computation
``add content of registers r1 and r2 and store the sum in r3''
program flow
``get the next command from memory cell 2001, if register r1 contains 0''

$\bullet$
Program: a sequence of commands that can be executed by a computer.

$\bullet$
The set of basic commands that a computer understands, forms a special programming language, the machine language. It is different for different kinds of computers.

$\triangleright$
Programming in machine language requires a thorough understanding of the internal structure of the used computer (registers, built-in arithmetic and logical units etc.). It is hard to write such a program to solve a real problem.

$\diamond$
``Real'' problems could be

-
Compute the approximate value of an integral of a special function between given bounds.
-
Interpret the given human sentence to find out what kind of request is made at the hotel reservation system.
-
Find all the persons in a large set of banking account data, whose account is overdrawn by a certain amount.

$\bullet$
To make the task of programming computers simpler, many programming languages have been invented that use higher abstractions from the particular application area.

$\diamond$
Some specialized programming languages:

-
Mathematical abstractions are the realm of Fortran. It understands a mathematical formula like

\begin{displaymath}
x1 = -p/2 + \sqrt{{\frac{p}{2}}^2 -q}
\end{displaymath}

in the following simple form:

x1 = -p/2 + sqrt(p**2/4 - q)

-
Logical dependencies and relations are the basic commands of Prolog. It allows to formulate things like
Sentence =
(Subject phrase + Verb phrase) OR
(Subject phrase + Verb phrase + Object Phrase)
-
Special database languages like SQL allow direct queries in the data, e.g.
Show all NAME fields
in data set ACCOUNTS
where (AMOUNT < -100 Euro)

$\bullet$
Programms written in such languages have to be translated into machine language, before they can be executed on a computer. This - rather tedious - task can itself be delegated to a computer program.

Compiler: a program that reads a program text as input and translates it into machine language.

$\bullet$
A class of very popular programming languages are the object oriented languages. They allow to construct programs from smaller building blocks (the objects), which contain a certain amount of information and have a given behaviour.

$\bullet$
An object consists of fields that contain the object's data, and of methods, which describe its possible actions.

$\diamond$
An operating system could organize the data on a disk using objects like

    File
      fields:  size, name, data
      methods: getSize, appendData(newData)

    Disk
      fields:  size, listOfFiles
      methods: createNewFile(name), getFreeSpace
  

7655

$\bullet$
A class is the description of all objects that have the same kind of data fields and the same methods.

$\diamond$
The objects file1 and file2 belong to the common class File.

previous    contents     next

Peter Junglas 8.3.2000