next up previous contents index
Next: Limitations of protocols and Up: Interface Structure Previous: Signatures   Contents   Index


Protocols

In short protocols have been mentioned above. A protocol is a set of calling sequences. In case of a protocol of an interface playing the role of a provides interfaces, the protocol denotes the set of valid calling sequences. If associated to a requires interface, the protocol denotes the set of possible required sequences.

Figure 3.2 shows an example of protocols visualized as finite state machines. The PCM does not limit protocols to one type like finite state machines or petri-nets, but leaves the number and kinds of types open. An interfaces does not necessarily need to define a protocol.

Example 3.2 (Protocol)   In Figure 3.2 all valid calling sequences of IReaderWriter start with open(..). Then read(..) and write(..) can follow in an arbitrary sequence. In any casae finally close() has to be called. Further more sequences that immediately stop are valid (after the initialization the protocol is in a valid final state). The edges of the finite state machine are labeled with the signatures of the interface, that is described by the protocol.

Protocols offer an ability to define dependencies among services of one interface. This allows components to express parts of their internal state in the PCM. Service calls are able to change the state of a component. Depending on the current state, only a limited number of further service calls is possible. Only those calling sequences, that lead from a start to an end state are valid. One can expect a defined behaviour of components only if their interface protocols are fulfilled.

Protocols are tied to interfaces. Anyhow the protocol state depends on the component that implements and provides an interface. Interfaces itself are stateless. This is the same principle as in object-oriented programming where interfaces are stateless, too. Just runtime-instances (objects) of classes which implement an interface have a state.


next up previous contents index
Next: Limitations of protocols and Up: Interface Structure Previous: Signatures   Contents   Index
Snowball 2007-03-16