Not great display/layout of arrow linking two methods of a same class. And aliases appearing.

0 votes
asked Jan 2 in Question / help by Filippo
Hi,

I have the following class diagram where I want to show that method aliased as f2 calls the method aliased as f1, both methods being in a same class.

@startuml
class A {
    - F foo(...) as f1
    ..
    + F foo(...) as f2
}
A::f2 --> A::f1
@enduml

The arrow for the above is not great. 
It would be better to have a shorter and clearer arrow that starts from the side of the member rectangle and goes to the target rectangle on the same side in the same way it is done for members of different classes.
Is it possible ?
(I know this is a beta feature).
commented Jan 2 by Filippo
edited Jan 2
The display between members of a same class is especially terrible when there is a chain of calls in the same class : a chain of arrows between members of the same class.
class A {
  + F f()
  + G g()
  + H h()
}
A::f --> A::g
A::g --> A::h
In this case the arrows overlap and we don't understand them clearly enough.
commented Jan 2 by Filippo
And also the aliases are appearing in the diagram.
I was thinking that aliases were helpful to distinguish two members with a same name for example, like two methods that have the same name but a different signature. But we don't care much about having them displayed.
The aliases that we give to packages are not displayed for example.

1 Answer

0 votes
answered Jan 5 by The-Lu (76,660 points)
 
Best answer

Hello F.,

From:

@startuml
class A {
    - F foo(...) as f1
    ..
    + F foo(...) as f2
}
A::f2 --> A::f1
@enduml

Here is a first workaround changing direction as:

@startuml
left to right direction
class A {
    - F foo(...) as f1
    ..
    + F foo(...) as f2
}
A::f2 --> A::f1
@enduml

And

@startuml
left to right direction
class A {
  + F f()
  + G g()
  + H h()
}
A::f --> A::g
A::g --> A::h
@enduml

Enjoy,
Regards,
Th.

commented Jan 6 by Filippo
edited Jan 6

Thank you for this first workaround.
I tried in polyline and ortho as well to try to shorten those arrows that can do a long trip if the members are not close to one another. And it can be hard to follow the lines. Also some depart from the rectangle side and others from the inside. Strange.


Polyline is not applied and in ortho arrows are not departing and arriving in the right place.
But since it is a beta feature I guess there is still some work to do for it to work.

...