Punctual Action Design Pattern

Intent

Offer a solution to the problem of encapsulating, performing, and managing generic punctual actions.

Based On

This pattern is based on the principle of abstract coupling.

Motivation

The term punctual action is used to described a one-shot action, namely an action that nominally should start and complete immediately. A punctual action is in contrast to an extended action that is started at a certain point in time and that is due to be executed over a period of time. The OBS Environment offers the manoeuvre management design pattern to handle extended action. The present pattern instead helps manage punctual actions.

Punctual actions are very common in embedded control systems in general. Examples include:

This design pattern offers a unified way of handling these types of actions.

Dictionary Entries

The following abstractions or domain-wide concepts are defined to support the implementation of this design pattern:

Structure

The class diagram below shows the very basic type of punctual action. A punctual action is characterized by an abstract interface defining a generic execute methods. Concrete subclasses define the concrete action to be performed by encoding it in their version of the execute method.

Such a basic implementation is useful to decouple a client who will normally be responsible for managing a set of punctual actions from the implementation of the punctual actions. More useful versions of punctual actions can be obtained by turning PunctualAction into an abstract class which, in addition to defining an abstract execute method, also defines some invariant functionalities that are useful to all concrete punctual actions. Some examples are discussed in the "implementation" section below.

Participants

Collaborations

A typical operational scenario for this design pattern is:

Consequences

Applicability

An application must manage a large number of punctual actions and there is a need to decouple their management from their implementation (for instance to allow flexibility in changing the implementation at run time or because their exact definition is only known late in the software development process).

Implementation Issues

The usefulness of the punctual action concept can be increased by turning PunctualAction into a base abstract class that implements application-independent functionalities such as management of enable/disable status of management of conditional execution checks. An example is shown in the class diagram below. The base class PunctualAction implements a punctual action that can be disabled or enabled and whose execution is subject to passing an exectuion check. The implementation of the execution check is left to concrete subclasses. Its management is instead performed by the base class and is thus reusable.

The punctual action concept can be useful to implement many of the concepts proposed by other patterns in the OBS Environment. Telecommands (see the Telecommand Management Design Pattern), recovery actions (see recovery action design pattern) and FsmEvents (see finite state machine pattern) are examples of actions that must be executed in one shot in response to the occurrence of some external circumstance. As such, all three could be implemented as instances of punctual actions resulting in the class diagram shown below.

OBS Framework Mapping

The implementation of this design pattern in the OBS Framework is supported by the following classes:

Sample Code

As already noted, telecommands (see the Telecommand Management Design Pattern), recovery actions (see recovery action design pattern) and FsmEvents (see finite state machine pattern) are examples of punctual actions. The sample code sections of their design patterns give examples of how punctual actions can be implemented.

Remarks

None

Author

A. Pasetti (P&P Software)

Last Modified

2003-07-30

Contact Us | The OBS Framework Project