Behaviour

Translated to C++ from the paper by Bertrand Meyer:


class Process {
    virtual void setup() = 0;
    virtual bool over() const = 0;
    virtual void step() = 0;
    virtual void finalize() = 0;
  public:
    void live() {
      setup();
      while (!over()) { step(); }
      finalize();
    }
    virtual ~Process() = 0;
};
...is this imperative or declarative? To me, this is code. And it is a behaviour specification.

Table of contents


Marc Girod
Last modified: Sat Feb 28 14:26:46 EET 1998