The composite
structure diagram allows the modeller to describe the relationships
between elements that work together within a classifier. It is
similar to the class diagram, but shows parts and connectors. The
parts are not necessarily classes in the model and they do not
represent particular instances, but they may be roles that
classifiers may play.
The parts are shown in
a similar manner to objects. The composite structure diagram is
used to show the runtime architectures of any kind of
classifier.
Example:
In the following example, under UML1.x the
modeller may have shown in a class diagram a typical invoice with a
header and detail as follows:
Although it is useful to be able to depict it as
shown above, the significance of the invoice header and detail may
not have warranted separate class descriptions (Disclaimer. Only
for example purposes). The composite structure diagram lends
itself to describing, in this instance, the invoice as
follows:
From this we see the invoice modelled as a class
and the header and detail modelled as parts. The connector and its
multiplicity indicate that a header will be a structural part of
the invoice and that one ore more detail parts will be present in
an invoice.
The Composite Structure Diagram is also useful in
displaying collaborations of classes as they, for example will
realize a use case. The notations used can be as
follows:
Example: Collaboration with classes
inside
Example: Collaboration connected to
classes
An example of how the collaboration may be
used:
For the use case:Capture customer, the Clerk will
capture the customer, the customer address and the related customer
account. The composite structure diagram for this collaboration may
look like this:
To explicitly show the realization, the following
diagram may be used: