UML Class Diagram

From Training Material
Revision as of 09:46, 23 March 2016 by Filip Stachecki (talk | contribs) (→‎Property⌘)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Class Diagram⌘

ClassDiagramExample.png

Describes the structure of a system by showing the system's classes, their attributes, and the relationships among the classes.

Classifier⌘

ClipCapIt-141022-121434.PNG

  • an abstract base class
  • describes a set of instances that have features in common

Feature⌘

Feature.png

  • declares a behavioral or structural characteristic of instances of classifiers
  • structural feature describes a structure of an instance of a classifier (e.g. property)
  • behavioral feature specifies an aspect of the behavior of classifier's instances (e.g. operation)

Property⌘

ClipCapIt-141022-114925.PNG

  • Properties are Structural Features that represent:
    • the attributes of Classifiers (when a property is owned by a Classifier other than an Association)
    • the member Ends of Associations
    • the parts of Structured Classifiers.

Operation⌘

  • a behavioral feature of a classifier, which specifies name, type, parameters, and constraints
  • can have preconditions and postconditions
  • can have a type (the type of the return parameter)
  • example:
+ createWindow (location: Coordinates): Window

Class⌘

UMLClass.png

  • describes a set of objects that share the same specifications of features (attributes and operations)
  • is a special classifier
  • an object is an instance of a class

Generalization⌘

GeneralizationExample.png

  • relationship between a more general classifier and a more specific classifier
  • each instance of the specific classifier is also an indirect instance of the general classifier
  • the specific classifier inherits the features of the more general classifier

Generalization Example⌘

GenExample.png

Association⌘

AssociationWithMarks.png

  • specifies a relationship between instances
  • describes a set of tuples whose values refer to typed instances
  • declares that there can be links between instances of the associated types

Multiplicity⌘

  • specifies how many objects of the opposite class an object can be associated with
  • is a range of the minimum and maximum values
  • syntax: number or min..max
Multiplicity Notation
zero 0 or 0..0
exactly one 1
zero or one 0..1
zero or more 0..* or *
one or more 1..*

Multiplicity example⌘

MultiplicityExample.png

Multiplicity - order and uniqueness⌘

  • Multiplicity defines a specification of order and uniqueness of the collection elements.
  • This option can specify whether the values should be unique and/or ordered.
    • ordered: the collection of values is sequentially ordered (default: not ordered)
    • unique: each value in the collection of values must be unique (default: is unique)

Property = End or Attribute⌘

Attribute.png

Navigability⌘

Navigability.png

  • specifies whether one object can be accessed directly from another

Aggregation⌘

Aggregation.png

  • shows how something (whole) is composed of parts
  • parts can exist separately - can be shared
  • precise semantics of aggregation varies by application area and modeler :)

Composition⌘

UMLComposition.png

  • a strict form of aggregation
  • the whole is the owner of its parts
  • parts can not be shared
  • the existence of its parts depends on the whole

Aggregation / Composition Example⌘

AggregationBoatCarExample.png

N-ary association⌘

TernaryAssociation.png

  • if an association has more than two end points (here: ternary association)
  • Notation: a rhombus is used as a connection point

Association Class ⌘

ClipCapIt-141106-132606.PNG

  • Association Class ia a model element that has both Association and Class properties.
  • It not only connects a set of Classifiers but also defines a set of Features that belong to the Association itself.

Dependency ⌘

Dependency.png

  • a relationship that signifies that a model element(s) requires other model element(s) for their specification or implementation
  • the complete semantics of the depending elements is dependent on the definition of the supplier element(s)
  • the modification of the supplier may impact the client model elements
  • the semantics of the client is not complete without the supplier
  • the type of dependency can be specified by using a keyword or stereotype

Interface⌘

  • is a kind of classifier that represents a declaration of a set of coherent public features and obligations
  • an interface specifies a contract; any instance of a classifier that realizes the interface must satisfy that contract
  • it is just declaration - so it is not instantiable


Provided Interface⌘

ProvidedInterface.png

  • an interface realized by a classifier is its provided interface
  • represent the obligations that instances of that classifier have to satisfy

Required Interface⌘

RequiredInterface.png

  • specify services that a classifier needs in order to perform its function

Interface Example⌘

InterfaceExample.png

Named Element⌘

  • represents an element that may have a name and a visibility
Visibility Kind Notation
public +
private -
protected #
package ~

Package⌘

UMLPackage.png

  • used to group elements, and provides a namespace for the grouped elements
  • qualified name:
package name::element name

Package Import, Access⌘

PackageImportAccess.png

A package import is defined as a directed relationship that identifies a package whose members are to be imported by a namespace.

Two types:

  • «import» for a public package import
    • transitive: if A imports B and B imports C then A indirectly imports C
  • «access» for a private package import
    • intransitive

Package Import Example⌘

PackageImportExample.png

  • elements in Types are imported to ShoppingCart, and then further imported to WebShop
  • elements of Auxiliary are only accessed from ShoppingCart, and cannot be referenced from WebShop

Instance ⌘

InstanceSpecification.png

  • is a concrete instance in the modeled system
  • instance = object

Comment⌘

UMLCommentExample.png

  • a textual annotation that can be attached to an element
  • may contain information that is useful to a modeler
  • can be attached to more than one element

Constraint⌘

Constraint.png

  • condition or restriction related to an element
  • it must always be true
  • can be in a formal (OCL) or in a human language
  • syntax:
{ [name :] boolean expression }