Advanced Classes
|
Classifiers:
A classifier is a mechanism that describes structural and behavioral features
In general, the modeling elements that can have instances are called classifiers
Class, Instance, Component, Node, Use case, Subsystem are classifiers
Class: A set of attributes, operations, relationships and semantics
Use case: Set of a sequence of actions, including variants, that a system performs that yields an observable result or value to a particular actor
Datatype: A type whose values have no identity, including primitive built-in types (such as numbers anti strings), as well as enumeration types (such as Boolean)
Component: Physical and replaceable part of a system that conforms to and provides the realization of a set of interfaces
Node: A physical element that exists at run time and that represents a computational resource, generally having at least some memory anti often processing capability
Subsystem: Grouping of elements of which some constitute a specification of the behavior offered by the other contained elements
Visibility:
Public [+]: All outside classifiers that have visibility to the given classifier, can use this feature
Protected [#]: All descendants of the classifier can use the feature
Private [-]: The classifier alone can use the feature
Scope:
The owner scope of a feature specifies whether the feature appears in each instance of the classifier or whether there is just a single instance of feature for all instances of the classifier.
- Instance: Each instance holds its own value
- Classifier: Just one value for all instances (static)
Multiplicity:
Typically, there may be any number of instances of classes
The number of instances a class may have is called multiplicity
Attributes:
The syntax of an attribute in the UML is:
[visibility] name [multiplicity] [: type] [=initial-value] [{property-string}]
There are three defined properties:
- Changeable: There are no limitations on modifying the value of the attribute
- AddOnly: Additional value may be added for attributes that have a multiplicity > 1. Existing value may not be altered or removed
- Frozen: The value of attribute may not be altered after an object is initialized
Operations:
- The syntax of an operation in UML is
- [visibility] name [(parameter-list)] [: return-type] [{property-string}] [direction] name: type [=default-value]
- There are five defined properties:
Leaf: May not be overridden
isQuery: Leave the state of subsystem unchanged
Sequential: Only one flow is in the object at a time
Guarded: Sequentializing all calls
Concurrent: Treating the operation as atomic
|
Template Classes:
- These are similar to the template classes in C++ and Ada
- Cannot use a template directly; first it should be instantiated
Standard Elements:
The standard stereotypes that apply to classes are:
- Metaclass: A classifier whose objects are all classes
- Powertype: A classifier whose objects are classes, which are the children of a given parent class
- Stereotypes: A stereotype that may be applied to other elements
- Utility: A class whose attributes and operations are all static scoped so that the clients of utility may not necessarily create instances to use the operations and attributes