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:- The exection of a fault detection check
- The propagation of the state of digital filer
- The reconfiguration of internal resources
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.
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
Client
:The component that is in charge of managing the punctual actions. PunctualAction
:Abstract interface characterizing a generic punctual action. ConcretePunctualAction
:The component encapsulating a specific punctual action.
Collaborations
A typical operational scenario for this design pattern is:
- During the initialization phase, client component is loaded with several
punctual action components which it sees only through the generic
PunctualAction
interface. - During the operational phase, the client component executes the punctual actions
by calling their
execute
method. The client is shielded from the knowledge of how the punctual actions are implemented. - During the operational phase, the client may be dynamically reconfigured with additional punctual actions or some of its punctual actions may be replaced.
Consequences
- It is easier to design a reusable component that is responsible for managing a set of punctual actions.
- It is easier to change punctual actions at run-time with minimal disruptions to the normal flow of control.
- There is a risk of proliferations of small classes as every punctual action requires definition and implementation of a dedicated class.
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:
- PunctualActionabstract interface -->
PunctualAction
,ConditionalPunctualAction
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