ColdFrame: Event motivation

In ColdFrame, events are used for two purposes:

Domain isolation

Many systems use the Layered approach to architecture, and it's likely that a ColdFrame-based system will do the same. In any case, there has to be support for interactions between different Domains (subject matters).

Classes in domains near the system's devices will need to have tasks to help them support the devices, probably on at least a "one task per device" basis.

When you're designing a higher-level domain, you'll probably want to use the «callback» facility (ColdFrame's version of the Observer pattern) to isolate yourself from the workings of the device domains. However, if you're using more than one device, your callbacks will be being called from more than one thread of execution, which you must provide protection against.

ColdFrame's Event support allows you to do this by converting the callback message into a class event (with a data payload) to be handled later in the context of a thread in your domain.

State modelling

State modelling is a very useful technique when objects have lifecycles, and especially when they react differently depending on the state they've reached. Another indicator is when times and intervals are involved.

Transitions between states happen as a result of instance events.


See also: