Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define the concept of a "port" in an UML Composite Structure Diagram

Tags:

java

uml

In a UML Composite Structure Diagram: What is a "port"? And how would I implement one in, say Java?

like image 539
Erik Avatar asked Feb 04 '11 23:02

Erik


People also ask

What does a composite structure diagram show?

A composite structure diagram is a diagram that shows the internal structure of a classifier, including its interaction points to other parts of the system. It shows the configuration and relationship of parts, that together, perform the behavior of the containing classifier.

How do you define interface in UML?

In UML modeling, interfaces are model elements that define sets of operations that other model elements, such as classes, or components must implement. An implementing model element realizes an interface by overriding each of the operations that the interface declares.

What are the parts of a UML diagram?

The current UML standards call for 13 different types of diagrams: class, activity, object, use case, sequence, package, state, component, communication, composite structure, interaction overview, timing, and deployment.

What are composite structures good for UML?

As UML diagrams, both composite structure diagrams and class diagrams are used to visualize and organize the actors, interactions, and artifacts within a system.


1 Answers

I would put forward that, in an OO language like Java, the port concept utilised by composite structure diagrams is (usually) actually implemented as the calling of a method of a member object by the containing object after a call is made on a method of the containing object.

This is a bit like the Facade or Delegation patterns, except that the containing object actually must "own" the member object.

See the Delegation WikiPedia article for sample implementations in a number of languages.

To answer the first part of the question, from the UML User Manual (2nd Edition) (admittedly in relation to components):

A port is an explicit window into an encapsulated component. In an encapsulated component, all of the interactions into and out of the component pass through ports. The externally visible behavior of the component is the sum of its ports, no more and no less. In addition, a port has identity.

...and from UML distilled (3rd Edition):

Ports allow you to group the required and provided interfaces into logical interactions that a component has with the outside world.

like image 189
Mike G Avatar answered Sep 20 '22 17:09

Mike G