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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.14 Attributes and Variables 109<br />

4.14.2.1 Instance Variables<br />

POOSL <strong>of</strong>fers two sorts <strong>of</strong> variables: instance variables and local variables. Instance<br />

variables are specified in class definitions. At run-time, every instance (object) has<br />

a collection <strong>of</strong> variables as specified in its class. These variables can take on values<br />

thereby determining the state (<strong>of</strong> the variables) <strong>of</strong> the object. Attributes from the Object<br />

Class Model become instance variables in class definitions. Instance variables serve also<br />

to store references to other objects. The instance variables form the data contents <strong>of</strong> the<br />

object. These contents live in principle as long as the object itself, but may be modified<br />

during the lifetime <strong>of</strong> the object.<br />

4.14.2.2 Local Variables<br />

Besides data that is stored as instance variables, there is temporary data that is stored<br />

in local variables in methods. Local variables originate from the chosen algorithm or<br />

expression that ’implements’ a method in POOSL. A different implementation may<br />

require different types <strong>of</strong> local variables. Therefore local variables do not play any role<br />

during object modelling.<br />

4.14.2.3 Data Objects<br />

Classes describe data objects or process objects in POOSL. Both can have instance variables<br />

and local variables. These variables refer to data objects. Data objects are created<br />

from their classes and get instance variables, as specified in their classes. These variables<br />

store references to other data objects. Initially they are all set to nil. Nil is a data object<br />

that can be considered to belong to no class at all. User defined data objects may have a<br />

user defined service initialise to give their instance variables an initial value, other than<br />

nil.<br />

References can also arise very implicitly from data object creation. A data (or process)<br />

object can for instance contract out some calculation or action. The object therefore<br />

creates a temporary data object <strong>of</strong> an appropriate class, and both can be considered to<br />

have a temporary link to each other for passing parameters and results. These identities<br />

have a very temporary and implicitly created knowledge <strong>of</strong> each others identifiers.<br />

There is no need for explicit references. After the completion <strong>of</strong> service, say m, the<br />

lifetime <strong>of</strong> the created object ends. An example is given by the following expression:<br />

x : new(C) m<br />

This expression leads to the following behaviour. An object <strong>of</strong> class C is created, receives<br />

a message m, performs the corresponding method and returns the object that results from<br />

the method evaluation. The final result is that x refers to the resulting object.<br />

4.14.2.4 Process Objects<br />

Process objects in POOSL are quite different from data objects. Data objects are sequential<br />

entities. Process objects <strong>of</strong>fer concurrency. The internal behaviour <strong>of</strong> process objects is

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

Saved successfully!

Ooh no, something went wrong!