23.08.2013 Views

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.6 Dynamic Behaviour 207<br />

with the problem-domain-orientation that object-oriented analysis methods promise to<br />

have. In object-oriented analysis there is a lot <strong>of</strong> emphasis on finding objects that model<br />

the real world. The objects are required to have names according to the problem field.<br />

For the notion <strong>of</strong> state the same requirement should hold. It should be possible to<br />

identify states by giving them distinct and recognisable names. The traditional objectoriented<br />

definition <strong>of</strong> state makes this impractical. Designers require distinguishable<br />

states during test and verification.<br />

We recommend to use the concept <strong>of</strong> variables partial state in situations where explicit<br />

information about an object’s state must be stored. Accessors can make this information<br />

available for other objects. By using a variable that stores the named behaviour state<br />

and that is updated when some form <strong>of</strong> behaviour is entered we can easily make state<br />

explicit. Especially for controllers this approach gives additional information that can<br />

be used for verification, test and maintenance.<br />

6.6.3.5 Global State<br />

The individual notions <strong>of</strong> variables state and behaviour state cannot give a full state description.<br />

The variables state does not describe what the system is actually doing, during the<br />

state. The behaviour state does not distinguish between situations where a (sub-)system<br />

may produce different results based on the values <strong>of</strong> its internal variables. We define<br />

the global state <strong>of</strong> a (sub-)system as an element from the state space that is the Cartesian<br />

product <strong>of</strong> the behaviour state space and the variables state space.<br />

Besides observable behaviour and observable changes <strong>of</strong> variables via <strong>of</strong>fered services,<br />

there are usually many detailed invisible state transitions in objects. Operations <strong>of</strong> an<br />

object <strong>of</strong>ten specify context-dependent actions. Their effects depend on the object’s variables<br />

state. An object’s operation may have inner side effects. These are inner changes <strong>of</strong><br />

variables, that happen as an additional effect <strong>of</strong> an operation. A transformer will usually<br />

cause a side effect (see Subsection 4.15.4). Besides side effects on instance variables,<br />

there are effects on local variables. However the latter should not be considered as side<br />

effects. When an operation is finished the lifetime <strong>of</strong> the local variables is over. So the<br />

effect is not stored in the variables state. When looking at the finest grain <strong>of</strong> behaviour<br />

description local variables do live some time and form a temporary local variables state<br />

that is in general modelled by a temporary stack.<br />

Side effects are not necessarily harmful. An efficient computation <strong>of</strong> an accessor function<br />

may require changing the internal state <strong>of</strong> an object (concrete state) to which the function<br />

is applied, without changing the abstract state <strong>of</strong> this object [Mey88]. Meyer gives an<br />

example <strong>of</strong> a class Complex, whose instances have two possible internal representations<br />

<strong>of</strong> a complex number: Cartesian or Polar. Depending on the last operation an object will<br />

be left behind with its internal variables represented as Polar or Cartesian. This depends<br />

on what was most efficient for the last operation performed. The concrete internal state<br />

(Polar or Cartesian) does not effect the abstract state which is isomorphic to the complex<br />

number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!