UML Class Diagrams
Terms
undefined, object
copy deck
- Name 4 guidelines for naming a class
-
*Start with a capital letter
*Be centered in the top compartment
*Be written in a boldface font
*Be written in italics if the class is abstract - How many compartments may a class have?
- As many compartments as required to describe the class
- How is an instance of an object shown
- Object name followed by the class, i.e., Ford : Car. It is also underlined.
- What are attributes?
- Attributes are used to represent the details of a class. They describe the properties of an instance.
- How is an attribute shown (diagrammed)?
- Either inline or by a relationship.
- How is the visibility of an attribute represented?
- Use the following symbols: +, -, #, or ~ for public, private, protected, or package, respectively
- How is the name of an attribute normally capitalized?
- Typically the first letter is lowercase, and the first letter of each subsequent word is capitalized.
- What is the type of an attribute?
- another classifier, typically a class, interface, or built-in type like int.
- How is the multiplicity of an attribute represented?
- multiplicity ::= [lower..upper] use * to represent 0 or more. [1 .. *] indicates one or more an integer [3] represents exactly 3
- What are the property strings of an attribute?
- denote such things as ordering or uniqueness. They are surrounded by {} and separated by commas.
- What are attribute constraints?
- one or more restrictions placed on an attribute. They may be natural language or use a formal grammar such as the OCL.
- How is an optional attribute diagrammed?
- The attribute name is preceeded by a "/".
- How do you represent a set of ordered attributes?
- -orderedAttrib[4]{ordered}
- If the uniqueness constraint of an attribute is not specified what is the default value?
- {unique}
- How do denote that an attribute is not unique?
- -orderedAttrib[4]{ordered, no unique}
- Name some common attribute properties.
- readOnly, union, subsets <attribute-name>, composite
- What are constraints?
- restrictions placed on an element
- What common property must all constraints have?
- They must evaluate to a boolean value.
- What are static attributes?
- attributes of the class rather than of an instance of the class
- How are static attributes designated?
- They are underlined.
- What are operations?
- Operations are features of classes that specify how to invoke a particular behavior.
- Write the general syntax expression for an operation.
- visibility name ( parameters ) : return-type {properties}
- Write the general syntax expression for an operation parameter.
-
direction parameter_name : type [ multiplicity ]
= default_value { properties } - What are the 4 possible parameter directions. Indicate how each type is used by the operation.
- in, out, inout, return
- What is the purpose of an operation constraint?
- A constraint defines a contract that indicates how an operation interacts with the rest of the system.
- What is a precondition?
- A precondition is a constraint that specifies the state of the system that must exist before an operation is invoked.
- Show an example of a precondition.
-

use "precondition: foo must equal bar" for example - What is a postcondition?
- A post condition establishes the post operation state of the system that must be met.
- What is a bodyCondition?
- A constraint that restricts the possible values of the return values.
- What is a query operation?
- A query operation is a constraint that indicates that the operation does not change the system state in any way.
- Is an exception a constraint?
- No, but an exception may be expressed in a similar manner.
- How is an exception to an operation indicated?
- Use a note attached by a dotted line.
- What is a static operation?
- A static operation is an operation that is invoked on the class itself rather than an instance of a class.
- How is a static operation indicated?
- The signature is underlined.
- What is a method?
- A method is the actual implementation of an operation.
- How is a method noted?
- There is no specific notation for an operation.
- What is an abstract class?
- A class that has one or more operations without signatures.