Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

A UML Class diagram is a type of diagram in the Unified Modeling Language (UML) that represents the structure and relationships of classes in a software system. It provides a static view of the system by illustrating the classes, their attributes, methods, and associations.

In a UML Class diagram, classes are represented as rectangles divided into three compartments:

...

Relationship Type

Graphical Representation

Inheritance (or Generalization):

  • Represents an "is-a" relationship.

  • An abstract class name is shown in italics.

  • SubClass1 and SubCass2 are specializations of Super Class.

  • A solid line with a hollow arrowhead that point from the child to the parent class

Inheritance

Simple Association:

  • A structural link between two peer classes.

  • There is an association between Class1 and Class2

  • A solid line connecting two classes

Aggregation:

A special type of association. It represents a "part of" relationship.

  • Class2 is part of Class1.

  • Many instances (denoted by the *) of Class2 can be associated with Class1.

  • Objects of Class1 and Class2 have separate lifetimes.

  • A solid line with an unfilled diamond at the association end connected to the class of composite

Image RemovedImage Added

Composition:

A special type of aggregation where parts are destroyed when the whole is destroyed.

  • Objects of Class2 live and die with Class1.

  • Class2 cannot stand by itself.

  • A solid line with a filled diamond at the association connected to the class of composite

Dependency:

  • Exists between two classes if the changes to the definition of one may cause changes to the other (but not the other way around).

  • Class1 depends on Class2

  • A dashed line with an open arrow

...

Names of relationships are written in the middle of the association line.Good relation names make sense when you read them out loud:"Every spreadsheet contains some number of cells","an expression evaluates to a value"They often have a small arrowhead to show the direction in which direction to read the relationship, e.g., expressions evaluate to values, but values do not evaluate to expressions.

Image RemovedImage Added

Relationship - Roles

...