UML Tutorial --Class Diagrams

 

      Class diagrams describe the static structure to a part of a system.
Classes      
A class describe a set of objects with similar structure,behavior and relationships.The class is shown as a rectange with tree compartments.Both the attribute and operation compartments can be suppressed.
Attribute
An attribute describes a range of values that instances of the class may hold.It's defined by a name and a type.Additionally,an attribute can have properties like visibility(to other classes),multiplicity,and initial value and a property-string that indicates property values.
      visibility name[multiplicity]:type-expression = initial-value{property-string}
Operation
Operations are specified by a name and a optional list of arguments.
      visibility name(parameterlist):return-type-expression{property-string}.
Stereotype
A stereotype is a classfication element and is used to indicate a difference in meaning or use between two elements with the same structure.
Object
An object is an instance of a class.In UML an object is represented by a rectangle with one or more compartments(up to four compartments).The top compartment shows the name of the object and the name of the class.
Object sets
Sets of objects can only be displayed through cardinalities of associations.Cardinality an association ends only tells how many instances that may be associated with a given number of source intances across the given association.
Relationship types:
In UML many kinds of relationships can be modeled .The main types are shown below:
Association:
An association defines a relationship between two or more classes.The association may indicate that the classes communicate ,but this is not necessarily true.
Aggregation:
In UML there are two kinds of aggregations:aggregation and composition.An aggregation ,also called relation aggregation is a specialised association.It is specified by an aggregation association with a hollow diamond.A part in thie type of aggregation can participate in several aggregates.
Composition,or "real aggregation",is a stronger form of aggregation where the parts can not exist without the whole.The parts can only participate in one composite.Composition is shown as an association with a filled solid diamond nearest the class constituting the whole,or alternatively using the graphically nested form.
Dependency:
A dependency is a relationship that indicates that a model element is in some way dependent of another model element.All model elements must exist on the same level of abstraction or realisation.
Generalisation:
A generalisation is a relationship between a more general element and a more specific element.Generalisation is a mechanism for structuring sets of classes with similar properties into general and specialised classes.





posted on 2009-09-14 20:59  Joshua Leung  阅读(248)  评论(0编辑  收藏  举报

导航