Part of the ObjectBasedProgramming pattern language. Discussion occurs on OperationVapourwareDiscussion?.
Intent
Reduce the overhead to access protected object attributes.
Motivation
A well designed class protects its attributes from direct access. Access to such attributes are often channelled through operations that provide no additional functionality. Although the protection is valuable for maintainability and robustness, the additional cost of calling an operation to retrieve and set an attribute is often unjustifiable in the context of embedded software.
Applicability
Applicability should be decided on an operation by operation basis. Some operations in a class family may benefit from this pattern while others would not. The OperationVapourware pattern is applicable to an operation if:
The operation is eliminated. Any call to this operation is replaced by a direct access to the attribute in the instance data.
Consequences
The OperationVapourware pattern has three important consequences:
Consider the following Condition class:
- BrokenLink as of 2003-10-19
The operation getChangeCount() provides read-only access to the protected attribute ChangeCount?.
If the Operation Vapourware pattern is not applied, the operation will have the following interface:
int ConditionFamilyGetChangeCount?( void *pvInstanceData )Another object attempting to retrieve the change count from an instance of the Condition class will implement a code fragment such as:
nChangeCount = ConditionFamilyGetChangeCount?( pvCondition )If the Operation Vapourware pattern is applied, another object attempting to retrieve to change count from an instance of the Condition class will instead implement a code fragment such as:
nChangeCount = ( (tsCONDITION*) pvCondition )->nChangeCount;Known Uses
The Condition Manager in Network Management Unit Software (NUS) developed by MAS Technology applies the OperationVapourware pattern to the getChangeCount and getDescendentChangeCount operations. The example above comes from the Condition Manager.
Related Patterns
Operations that do not get eliminated by the application of this pattern should be implemented with the PolymorphicFunction pattern.