Managing ports

A port is a distinct interaction point between a class and its environment or between (the behavior of) a class and its internal parts. Use ports to specify classes that are independent of the environment in which they are embedded. The internal parts of the class can be isolated from the environment and vice versa.

A port can have the following interfaces:

The following figure shows the AbsHardware class with a port (the small square at the bottom edge of the class element) that has a provided interface (lollipop or ball) and a required interface (socket).

Class with port that has a provided interface (lollipop or ball) and a required interface (socket)

These interfaces are specified using a contract, which by itself is a provided interface. For more information, see Specifying the port contract.

If a port is behavioral, the messages of the provided interface are forwarded to the owner class; if it is non-behavioral, the messages are sent to one of the internal parts of the class. Classes can distinguish between events of the same type if they are received from different ports.

Note: The product provides a C++ sample project (HomeAlarmWithPorts) that shows a home alarm security system that illustrates the usage of UML 2 ports to specify part interaction points. See <product installation folder>\Samples\CppSamples\.

Feedback