I would say that in an OO language such as Java, the concept of a port used by composite structural diagrams is usually implemented as a call to a method of an object-containing object after calling the method of the containing object.
This is a bit like Facade or Delegation , except that the containing object must actually βownβ the member object.
See the Delegation WikiPedia article for examples of multi-language implementations.
To answer the first part of the question, from the UML user guide (second edition) (admittedly, regarding components):
The port is a clear window to the encapsulated component . In an encapsulated component, all interactions in and out of the component pass through the ports. The outwardly visible behavior of a component is the sum of its ports, no more and no less. In addition, the port has an identifier.
... and from UML distilled (3rd Edition):
Ports allow you to group the required and provided interfaces into the logical interactions that the component has with the outside world.
Mike g
source share