ColdFrame: Attributes

Motivation

An attribute holds a property of an object (either one per instance, for example the Accession Number of a Book in a Library, or per class, for example the next Accession Number to be used).

Identifiers

Instances of a Class must be uniquely identifiable by some attribute or combination of attributes. For example, a Vehicle Excise Disk (a UK thing, up until October 2014: the circular document you displayed on your car's windscreen to show you'd paid the annual road tax) might be identified by the combination of Vehicle Index Mark (the licence plate number) and Validity Start Date. Vehicle Index Mark and Validity Start Date then become "identifying attributes", whereas Date Of Issue and Period Of Validity are just common-or-garden attributes.

In ColdFrame, you must not specify identifiers for

All other classes must have identifiers. In this, ColdFrame doesn't follow Executable UML; it seems risky to apply too many defaults.

For the case where there's no suitable naming attribute, ColdFrame provides the attribute type Autonumber (rather like the Microsoft Access feature it's named after): each newly-created instance gets a new value.

Types

If a «datatype» class has attributes, it corresponds to a C struct or an Ada record.

Modelling

Attributes are, of course, modelled as attributes of a UML class.

In UML, an attribute is expressed as

«stereotype» visibility name [multiplicity] : type-expression = initial-value {property-string}

where the red parts are mandatory.

ColdFrame doesn't support multiplicity; you'll either need to use array types (not yet implemented with ArgoUML) or an association.

The property-string (a tagged value) isn't supported.

Attributes of classes can be class attributes, ie there is a single value shared by all instances. Indicate this by checking the ownerScope checkbox in the modifiers section of the ArgoUML Properties tab.

Stereotypes

«aliased»
The attribute is to be stored in such a way that its address can be taken (in Ada, 'Access).
«atomic»
The attribute must be read from memory or written to memory each time it is accessed, like volatile, but additionally in such a way that it's proof against concurrent access.
The implementation may limit the size of objects that can be treated as atomic.
«id»
The attribute is an identifying attribute.
The tag {formalizes = association-name} indicates that the attribute is a referential attribute.
This is needed when the attribute has to be specified by the analyst (normally, ColdFrame can manage references as required).
Consider R8, Licence is-issued-by Licensing Office. The identifier of Licence consists of the licence number and also the issuing Licensing Office, since the various offices don't use disjoint licence number ranges. In this case, we'd specify the attributes as
«id» Number : Positive
«id» Issuing_Office : Licensing_Office {formalizes=R8}
«volatile»
The attribute must be read from memory or written to memory each time it is accessed.

Translation

Attributes of types are implemented as Ada record components.

Ordinary attributes of classes are implemented in the "instance record", accessed as This.attribute-name.

Class attributes are implemented as variables in the private part of the class package, and are accessed directly by name.