next up previous contents index
Next: The abstraction `while' Up: Discovering the Power of Previous: Test output part 2   Contents   Index


Imperative Programming in A++

A++ supports not only functional and object-oriented programming but allows also to apply the imperative programming style.
\fbox{
\parbox{14.5cm}{
The trademark of {\bf imperative programming} is {\em e...
...ts} opposed to {\em evaluating expressions} in
{\bf functional programming}.}
}
Executing statements has in most cases the effect that somewhere in memory the stored information is modified. This modification of the contents of memory cells is called `side effect' and can have disastrous results including program aborts or even system crashes.

An evaluation of expressions on the contrary does not change the status of the program or the system. This is the reason, why functional programming is preferred by many computer scientists because it leads to safer and more robust programs, which on top of that are easier to rigorously verify on a mathematical basis.

The decision which programming style to apply in a specific case has to be made by the programmer. A++ supports all three paradigms. In the following three examples for object-oriented programming all three programming styles are used.

The imperative programming style is unavoidable in object-oriented programming because an object has specific state which has to be maintained executing assignment statements.



Subsections
next up previous contents index
Next: The abstraction `while' Up: Discovering the Power of Previous: Test output part 2   Contents   Index
domain access counter Georg P. Loczewski 2004-03-05