Composite structure diagram explained

Composite structure diagram[1] in the Unified Modeling Language (UML) is a type of static structure diagram that shows the internal structure of a class and the collaborations that this structure makes possible.

This diagram can include internal parts, ports through which the parts interact with each other or through which instances of the class interact with the parts and with the outside world, and connectors between parts or ports. A composite structure is a set of interconnected elements that collaborate at runtime to achieve some purpose. Each element has some defined role in the collaboration.

Concepts

The key composite structure entities identified in the UML 2.0 specification are structured classifiers, parts, ports, connectors, and collaborations.[2]

Ports can either delegate received requests to internal parts, or they can deliver these directly to the behavior of the structured classifier that the port is contained within. Public ports that are visible in the environment are shown straddling the boundary, while protected ports that are not visible in the environment are shown inside the boundary. All the ports in the diagram are public, except for the view port along the right boundary of FibonacciSystem.

Examples

As an example, consider one possible way of modeling production of the Fibonacci sequence.

This UML 2.0 composite structure diagram specifies that instances of the 'FibonacciSystem' class are composed of a number of parts. The topmost of these parts is identified as having the classifier 'FibonacciFunction'. Three of the parts are identified by the role they play within instances of FibonacciSystem - the NMinus2 role, the NMinus1 role, and the N role. The fifth part, identified by its classifier Viewer, includes a multiplicity specification. At runtime there can be 0 or more instances of Viewer or some concrete subclass of Viewer.

At runtime the class instances that implement these three roles must provide the services specified by the IVar interface through their var ports. One such class is Variable, shown on the diagram with a port named var of type Var that realizes the IVar interface.

The port named "view" is a non-public port that can be used by an instance of FibonacciSystem to access the optional instance(s) of Viewer.

External links

Notes and References

  1. Book: Composite Structure Diagram. Unified Modeling Language 2.5.1. OMG Document Number formal/2017-12-05. December 2017. Object Management Group Standards Development Organization (OMG SDO). 728.
  2. OMG (2008). OMG Unified Modeling Language (OMG UML), Superstructure, V2.1.2 p.161-192.