[ Team LiB ] Previous Section Next Section

Read-Only and Frozen

On page 37, I described the {readOnly} keyword. You use this keyword to mark a property that can only be read by clients and that cannot be updated. Similar yet different is the {frozen} keyword from UML 1. A property is frozen if it cannot change during the lifetime of an object; such properties are often called immutable. Although it was dropped from UML 2, {frozen} is a very useful concept, so I would continue to use it. As well as marking individual properties as frozen, you can apply the keyword to a class to indicate that all properties of all instances are frozen. (I have heard that frozen may well be reinstated shortly.)

    [ Team LiB ] Previous Section Next Section