Type Attributes

What attributes are

Attributes of an object are pieces of data that are intrinsically associated with an object. For example, a date object might have attributes giving month, day of the month, and year.

The definitions of basic attributes are part of the definition of a type. All objects of a given type have the attributes listed in the type definition.

How attributes are defined

Attribute definitions contain the following information: Attribute descriptions contain the complete definition of an attribute. They can also contain the following additional information:

How attributes are inherited

A type inherits the attributes of all its supertypes. Objects of type T, therefore, must have all the attributes specifically defined for type T, plus all of the attributes defined in T's supertypes, and so on.

A type does not have to redefine the attribute names that are defined in its supertypes. It may do so, however, if it wishes to define the attribute in a more constrained way, or describe the derivation differently. If an attribute is redefined in a subtype, there should be a pointer to the supertype which has the original attribute definition. Constraints imposed by the supertype's definition must still be honored in the subtype's definition, if the attribute name is reused.

It is all right to have two supertypes that define two different attributes under the same name. But any extraction of the attribute must specify not only the proper name, but the name of the type in which the desired attribute is defined. (The name of the type can be omitted if the attribute name alone is unambiguous.)

How attributes differ from methods

See this list.

Basic and derived attributes

The essential attributes of a type are known as "basic" attributes. They have some degree of independence from each other.

In some cases, certain attributes may be labeled as "derived". The values of these attributes are completely dependent on the basic attributes and methods. For instance, from the basic attributes "month", "day_of_month", and "year", one can (assuming a fixed calendar system like the Gregorian) derive the attribute "day_of_week". The semantics for derived attributes should explain how to obtain the derived attribute from the basic attributed.

Derived attributes can be useful. An agent that does not know how to directly extract a derived attribute can figure it out in terms of the basic attributes. Also, derived attributes can be added to a type description without changing its basic definition.

spok@cs.cmu.edu (Last updated 12-Apr-96)