Book a Demo

Author Topic: Why use UML ports?  (Read 3783 times)

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Why use UML ports?
« on: February 26, 2020, 02:09:36 am »
I've been using ports for many diagrams because a profile requires it. However, I noticed that ports in of themselves are classes that also have notes, attributes, and other things just like any other element. This of course adds some effort in maintaining these elements. Why would I use ports instead of just exposing an interface? What do I gain? Reading the standard only mentions that a port is an interaction with the outside world. Some have used the metaphor of a "front office" that dispatches requests because it has an interface. However, before ports, I could do the same, I knew that a class offered services of an interface without knowing much of the internal structure of that class. I must be missing something here in my understanding. Here is the original text from version 2.5 of the UML standard:
Quote
A Port is a property of an EncapsulatedClassifier that specifies a distinct interaction point between that
EncapsulatedClassifier and its environment or between the (behavior of the) EncapsulatedClassifier and its internal
parts. Ports are connected to Properties of the EncapsulatedClassifier by Connectors through which requests can be
made to invoke BehavioralFeatures. A Port may specify the services an EncapsulatedClassifier provides (offers) to its
environment as well as the services that an EncapsulatedClassifier expects (requires) of its environment. A Port may
have an associated ProtocolStateMachine.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Why use UML ports?
« Reply #1 on: February 26, 2020, 09:45:15 am »
However, I noticed that ports in of themselves are classes that also have notes, attributes, and other things just like any other element.
A port is not a class itself. It's closer to an attribute, but with some added functionality. The only way it gets attributes is by having a type assigned to it.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Why use UML ports?
« Reply #2 on: February 26, 2020, 10:12:07 am »
Ports allow to group interfaces. It's like a complex plug offering power and different data connectors (speaking in mechanical terms).

q.