An idiom specifies a mapping of a responsibility into one of several predefined implementations as message specifications. For a given responsibility, you can choose one of four idioms:
For example a Customer thing might have the following
responsibilities:
Idiom | Responsibility |
---|---|
Action | pay bill |
Reference | sales rep |
Value | account balance |
Identifier | customer number |
An idiom provides guidance to UML Designer regarding how the responsibility should be transformed into protocol message specifications and attributes. For each idiom, there is a corresponding set of messages that would typically be used to implement the responsibility. (Essentially, these are simple patterns: designs for implementing common programming requirements.) Each idiom results in a different combination of messages and attributes in the generated protocol, based on what would typically be used for such a responsibility.
|
Action is the simplest idiom, and describes an arbitrary, user-defined responsibility. It is the default idiom for a new responsibility.
The Action idiom specifies a simple, one-to-one transform from a responsibility to a protocol message specification. For each Action responsibility, UML Designer generates a single message. The name of the message is the responsibility's implementation name, which by default is derived from the responsibility name; for example, pay bill becomes payBill. (You can change the implementation name if you prefer a different name.)
Participants are optional for an Action responsibility. If there are any participating things in a responsibility, each participant becomes a message parameter whose type is the default type derived from the participant. Message parameters must be specified as protocols, so if a protocol does not yet exist for a participant, UML Designer automatically generates an empty protocol for it.
You can specify a maximum cardinality of Many or 1. If you specify Many, the default generated message name will be plural.
Question for Nick: | Does cardinality have any other effect on an Action responsibility? |
No attributes or associations are generated for an Action responsibility.
A Reference responsibility specifies a value that the thing knows that is itself another thing. In effect, this specifies an association for the implementing protocol.
At least one participant is required for a Reference responsibility; the participant identifies the thing the responsibility refers to. In the generated protocol, UML Designer generates an attribute to hold the reference; its type is that of the implementing protocol for the participating thing. (If you specify more than one participant, any of the specified types are permitted.)
In addition to the attribute, UML Designer generates a set of messages to get and set the attribute's value. The specific behavior varies depending upon the maximum cardinality you specify (Many or 1):
In addition, for a Reference responsibility, UML Designer creates an association between the generated protocol and any participating protocols. This is only an association between protocols; it does not automatically become an association between classes during the design phase.
A Value responsibility describes a value that the thing knows. In some ways, this is similar to a Reference, but in this case the thing being pointed to is not necessarily interesting in its own right.
For each Value responsibility, UML Designer generates a protocol attribute to hold the value, as well as a set of message specifications to get and set the attribute's value.
Specifying a participant is optional for a Value responsibility. If you specify a participant, the corresponding protocol is used as the type of the generated attribute and of the message parameters and return values. If no protocol exists for the participant, UML Designer automatically generates one.
If you do not specify a participant, UML Designer checks for an existing thing with a similar name to that of the responsibility. If it finds a match, it uses the corresponding protocol as the type of the attribute. If it does not find a match, it assumes <Object>. (See Finding protocols for participants for more information.)
In addition to the attribute, UML Designer generates a set of messages to get and set the attribute's value. The specific behavior varies depending upon the maximum cardinality you specify (Many or 1):
No associations are generated for a Value responsibility.
An Identifier responsibility describes a value that the thing knows, and by which it can be uniquely identified.
For each Identifier responsibility, UML Designer generates a protocol attribute to hold the identifier, as well as getter and setter messages to access the attribute's value.
Specifying a participant is optional for an Identifier responsibility. If you specify a participant, the corresponding protocol is used as the type of the generated attribute and of the message parameters and return values. If no protocol exists for the participant, UML Designer automatically generates one.
If you do not specify a participant, UML Designer checks for an existing thing with a similar name to that of the responsibility. If it finds a match, it uses the corresponding protocol as the type of the attribute. If it does not find a match, it assumes <Object>. (See Finding protocols for participants for more information.)
Note: | An identifier is, by definition, of a single specified type; if you specify more than one participant for an Identifier responsibility, only the first is used when transforming to a protocol. |
No associations are generated for an Identifier responsibility.