Login | Register
My pages Projects Community openCollabNet

18.8. Operation

An operation is a service that can be requested from an object to effect behavior. In the UML metamodel it is a sub-class of BehavioralFeature which is itself a sub-class of Feature.

In the diagram, an operation is represented on a single line within the operation compartment of the class. Its syntax is as follows:

visibility name (parameter list) : return-type-expression {property-string}

You can edit this line directly in the diagram, by double-clicking on it. All elements are optional and, if left unspecified, the old values will be preserved.

A stereotype can be given between any two elements in the line in the format: <<stereotype>>.

The following properties are recognized to have special meaning: abstract, concurrency, concurrent, guarded, leaf, query, root and sequential.

The visibility is +, #, - or ~ corresponding to public, protected, private visibility, or package visibility respectively.

static and final optionally appear if the operation has those modifiers. Any operation declared static will have its whole entry underlined on the diagram.

There may be zero or more entries in the parameter list separated by commas. Every entry is a pair of the form:

name : type

The return-type-expression is the type (UML datatype, class or interface) of the result returned.

Finally the whole entry is shown in italics if the operation is declared abstract.

18.8.1. Operation Details Tabs

The details tabs that are active for operations are as follows.

ToDoItem

Standard tab.

Properties

See Section 18.8.2, “Operation Property Toolbar” and Section 18.8.3, “Property Fields For Operation” below.

Documentation

Standard tab. See Section 13.4, “Documentation Tab”.

Presentation

Standard tab. The Bounds: field does allow editing, but the changes have no effect.

Source

Standard tab. This contains a declaration for the operation.

Constraints

Standard tab. There are no standard constraints defined for Operation within the UML metamodel.

Tagged Values

Standard tab. In the UML metamodel, Operation has the following standard tagged values defined.

  • semantics. The value is a specification of the semantics of the operation.

  • derived (from the superclass, ModelElement). Values true, meaning the operation is redundant—it can be formally derived from other elements, or false meaning it cannot.

    [Note]Note

    Derived operations still have their value in analysis to introduce useful names or concepts, and in design to avoid re-computation.

[Note]Note

The UML Element metaclass from which all other model elements are derived includes the tagged element documentation which is handled by the documentation tab under ArgoUML

Checklist

Standard tab for an Operation.

18.8.2. Operation Property Toolbar

Go up

Navigate up through the package structure.

New operation

This creates a new operation within the owning class of the current operation, navigating immediately to the properties tab for that operation.

[Tip]Tip

This is a very convenient way to add a number of operations, one after the other, to a class.

New parameter

This creates a new parameter for the operation, navigating immediately to the properties tab for that parameter.

New raised signal

This creates a new raised signal for the operation, navigating immediately to the properties tab for that raised signal.

New Datatype

This creates a new Datatype (see Section 16.3, “Datatype”) in the namespace of the owner of the operation, navigating immediately to the properties tab for that datatype.

New Stereotype

This creates a new Stereotype (see Section 16.6, “Stereotype”) for the selected operation, navigating immediately to the properties tab for that stereotype.

Delete

This deletes the operation from the model

[Warning]Warning

This is a deletion from the model not just the diagram. If desired the whole operation compartment can be hidden on the diagram using the presentation tab (see Section 18.8.2, “Operation Property Toolbar”) or the button 2 pop up menu for the class on the diagram.

18.8.3. Property Fields For Operation

Name

Text box. The name of the operation. The name of an operation has a leading lower case letter, with words separated by “bumpy caps”.

[Note]Note

The ArgoUML critics will complain about operation names that do not have an initial lower case letter.

[Tip]Tip

If you wish to follow the Java convention of constructors having the same name as the class, you will violate this rule. Silence the critic by setting the stereotype create for the constructor operation.

Stereotype

Drop down selector. There are two UML standard stereotypes for Operation (from the parent metaclass, BehavioralFeature), create and destroy.

[Tip]Tip

You should use create as the stereotype for constructors, and destroy for destructors (which are called “finalize” methods under Java).

Navigate Stereotype

icon. If a stereotype has been selected, clicking button 1 will navigate to the stereotype property panel (see Section 18.5, “Stereotype”).

Owner

Text box. Records the class which contains this operation.

Button 1 double click on the entry will navigate to the class.

Visibility

Radio box, with entries public, private, protected and package.

  • public. The operation is available to any model element that can see the owning class.

  • private. The operation is available only to the owning class (and any inner classes).

  • protected. The operation is available only to the owning class, or model elements that are subclasses of the owning class.

  • package. The operation is available only model elements contained in the same package.

Modifiers

Check box, with entries abstract, leaf, root, query, and static.

  • abstract. This operation has no implementation with this class. The implementation must be provided by a subclass.

    [Important]Important

    Any class with an abstract operation must itself be declared abstract.

  • leaf. The implementation of this operation must not be overridden by any subclass.

  • root. The declaration of this operation must not override a declaration of the operation from a superclass.

  • query. This indicates that the operation must have no side effects (i.e. it must not change the state of the system). It can only return a value.

    [Caution]Caution

    Operations for user defined datatypes must always check this modifier.

  • static. There is only one instance of this operation associated with the class (as opposed to one for each instance of the class). This is the OwnerScope attribute of a Feature metaclass within UML. Any operation declared static is shown underlined on the class diagram.

Concurrency

Radio box, with entries guarded, sequential, and concurrent.

  • guarded. Multiple calls from concurrent threads may occur simultaneously to one instance (on any guarded operation), but only one is allowed to commence. The others are blocked until the performance of the first operation is complete.

    [Caution]Caution

    It is up to the system designer to ensure that deadlock cannot occur. It is the responsibility of the operation to implement the blocking behavior (as opposed to the system).

  • sequential. Only one call to an instance (of the class with the operation) may be outstanding at any one time. There is no protection, and no guarantee of behavior if the system violates this rule.

  • concurrent. Multiple calls to one instance may execute at the same time. The operation is responsible for ensuring correct behavior. This must be managed even if there are other sequential or synchronized (guarded) operations executing at the time.

Parameter

Text area, with entries for all the parameters of the operation (see Section 18.9, “Parameter”). A new operation is always created with one new parameter, return to define the return type of the operation.

Button 1 double click on any of the parameters navigates to that parameter. Button 2 click brings up a pop up menu with two entries.

  • Move Up. Only available where there are two or more parameters, and the parameter selected is not at the top. It is moved up one position.

  • Move Down. Only available where there are two or more parameters listed, and the parameter selected is not at the bottom. It is moved down one position.

Raised Signals

Text area, with entries for all the signals (see Section 18.10, “Signal”) that can be raised by the operation.

[Caution]Caution

ArgoUML at present (V0.18) has limited support for signals. In particular they are not linked to signal events that could drive state machines.

Button 1 double click on any of the signals navigates to that parameter.