RAD Property Attributes

A RAD attribute is metaphorically a property of the object. Attributes have the following characteristics:

  • A name

  • A type

  • A definition as read-only, read-write, or write-only

Reading a read-only or read-write attribute returns the value of that attribute. Writing a write-only or read-write attribute sets the value of that attribute. Reading a write-only attribute or writing a read-only attribute is invalid. Clients may treat attempts to write to a read-only attribute as a write to an attribute that does not exist. Likewise, attempts to read from a write-only attribute may be treated as an attempt to read from an attribute that does not exist.

An attribute's type value may be nullable. An attribute may optionally declare that it returns an error, with the same semantics as declaring (or not declaring) an error for a method. Unlike a method, an attribute may have different error declarations for reading the attribute and writing the attribute.

Attribute names may not be overloaded. Defining a read-only attribute and a write-only attribute with the same name is not valid.

Because methods exist in RAD, attributes are arguably a superfluous interface feature. Writing an attribute of type X can be implemented with a method that takes one argument of type X and returns nothing, and reading an attribute of type X can be implemented with a method that takes no arguments and returns a value of type X. Attributes are included because they offer a simpler interface.

The attribute mechanism has the following characteristics:

  • Enforces symmetric access for reading and writing read-write attributes.

  • Is easily and automatically translated to a form that is natural to the client language-environment.

  • Communicates the nature of the interaction. Reading an attribute ideally should not affect system state. The value written to a read-write attribute should be the value returned on subsequent reads unless an intervening change to the system effectively writes a new value.