UML 2.0 provides the graphical notation and semantics for component design modeling. Key constructs and diagrams are
briefly described below.
Component
The black-box view of a component is represented in UML 2.0 as a rectangle with the name of the component inside. It
has a stereotype of <<component>> and can include a tabbed rectangle icon. It can include compartments for
interfaces as well as artifacts.
Figure 1: Black Box Component Representations
White-box component realizations can be represented a few ways depending on the complexity of the component or the
amount of documentation required.
The simplest approach is to add a compartment stereotyped <<realizations>> to the black-box component and
list the classifiers that realize it.
Figure 2: White Box Component – Simple Representation
Another approach shows each classifier with a dependency to the component it realizes.
Figure 3: White Box Component – Representation Showing Dependencies
When a detailed view of component internals is required, place the component’s classifiers inside of the black-box
component rectangle. Ports specify a point of interaction between the component and its environment and between
the component and its internal classifiers. Connectors map a port to the internal classifier that realizes the
functionality. A connector is described by a solid line with a filled arrow from the port (a small square symbol)
to the classifier.
Figure 4: White Box Component – Detailed Representation
For white-box views of very complex components you can create a separate class diagram that links to its component.
Note that components can be nested inside other components.
Representing Static and Dynamic Aspects of a Component
Class Diagram
The static aspects of a component’s internal design are described by UML class diagrams. The class diagram is a
structural representation of objects and their static relationships described using the following structuring
constructs:
-
Classes
-
Attributes (representing the knowledge responsibilities or data)
-
Methods (representing operational responsibilities or functions)
-
Association relationships between classes
-
Aggregation relationships between aggregate and component classes
-
Inheritance relationships between superclasses and subclasses
-
Formal or informal constraint descriptions
Figure 5: Class Diagram
Interaction Diagram
The dynamic aspects of a component’s internal design are described by UML interaction diagrams (sequence or
communication diagrams). These diagrams show how the sequence of interactions between the component’s internal
classifiers realizes its specified interfaces.
Sequence diagrams are better for displaying and understanding the trace of messages or communication patterns.
Collaboration diagrams are better for displaying the relationships between the objects involved in the interaction.
Sequence diagrams tend to be the most common form of interaction diagram, because the goal of most
interaction diagrams is to describe communications rather than relationships.
Figure 6: Collaboration Diagram
Figure 7: Sequence Diagram
For
more notation information, see Guideline: Component Design Modeling
|