Java Reference
In-Depth Information
Architecture
Event-driven simulation
Context
Event-driven control systems are special kinds of reactive
system, where the interaction with the external world
(stimuli and feedback) takes place through events. The
external world may assume two distinct forms in a control
program: it may be either a reference to an external
object, or a wrapper of a physical device.
Problem
Any complex control system requires prototyping and
simulation. Simulating the external world can make
testing and debugging of the application much easier.
A complex control system is characterized by the presence
of many different activities being executed concurrently.
The behaviour of the whole system emerges from the
interaction among independent activities. Interaction
requires synchronization.
Forces or tradeoffs
A prototype of the external world and its physical
implementation are two distinct aspects of the same
concept. Often both are present at the same time during
development. A seamless evolution from the simulation to
the final implementation should be ensured.
Solution
The control system is made up of a collection of control
modules that map external entities. A control module's
behaviour is modelled as a finite state automaton. Its
dynamic is modelled as a sequence of states, which the
control module visits during a period of observation.
Control modules interact through event exchange.
Events are triggered when a state transition occurs and
indicates the start or end of a control module's activities.
A centralized event clock manages synchronization. It is
the bookkeeper of the current time and of the scheduled
events. It knows what event is next to be raised and when.
Force resolution
The interaction between control modules is limited to
events exchange. Every control module behaves as a
reactive event-driven system. It is easy to substitute the
prototype of an external component with the wrapper of
its physical implementation.
Design rationale
Prototype and reality have the same event-based interface.
Idiom
Broadcaster-listener
Context
Asynchronous communication between objects.
Problem
A set of dependant objects (“listeners”) should be
informed of state changes in one or more observed
(“broadcaster”) objects.
Search WWH ::




Custom Search