In UML models, a composite structure diagram depicts the internal structure of structured classifiers by using parts, ports, and connectors. A structured classifier defines the implementation of a classifier and can include a class, a component, or a deployment node. You can use the composite structure diagram to show the internal details of a classifier and to describe the objects and roles that work together to perform the behavior of the containing classifier.
A composite structure diagram is similar to a class diagram, but it depicts individual parts instead of whole classes. Before you can define the internal structure of a classifier, you must either show its structure compartment or open a composite structure diagram. You can then model the parts that represent the instances that the containing classifier owns. You can add connectors to link two or more parts in an association or dependency relationship.
In composite structure diagrams, ports define the interaction point between a classifier and its environment or between a classifier and its internal parts. You can use a port to specify the services that a classifier provides to and requires from its environment.
You can also model collaborations and collaboration occurrences in composite structure diagrams. A collaboration describes the roles and attributes that define a specific behavior of the classifier. A collaboration occurrence represents one particular use of the collaboration to explain the relationships between the properties of a classifier. To identify the roles of the parts in the collaboration occurrence, you attach a collaboration occurrence to a collaboration and then add the collaboration occurrence to a composite structure diagram.
As the following figure illustrates, a composite structure diagram is displayed in the diagram editor as a frame that has the name of the containing classifier. The composite parts of the classifier and their communication connections are displayed in the diagram frame.
The example in the figure shows a model that contains two classes: Car and Wheel. The composite structure diagram identifies the containing classifier, Car. The diagram frame shows four internal composite parts of the containing classifier, which represent the four wheels of the car and are of the type Wheel. A communication link connects the front wheels and the rear wheels with connectors named frontaxle and rearaxle.
Whenever you create a composite structure diagram from the Car classifier, four instances of the Wheel class are created. These parts are held by composition within the Car instance and the front wheels and the rear wheels are linked by connectors.
The following topics describe model elements in composite structure diagrams: