plantuml-stdlib / C4-PlantUML

C4-PlantUML combines the benefits of PlantUML and the C4 model for providing a simple way of describing and communicate software architectures
MIT License
6.41k stars 1.1k forks source link

Update Rel_Back() are layout neutral with [norank] #277

Closed kirchsth closed 1 year ago

kirchsth commented 1 year ago

Hi all users,

I found that PlantUML offers relations (arrow with '[norank') which does not influence the layout.

I think this would be a good option that we get better layouts if Rel_Back() calls uses [norank].

E.g. if we have simple diagram with 3 components and layout like a L (down, right)

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

Person(user, "Customer")
Container(spa, "SPA")
Container(api, "API")

Rel(user, spa, "Uses")
Rel_R(spa, api, "Uses via message calls")

' uncomment produces b)
' Rel_Back(spa, api, "returns message response")

' uncomment produces c)
' [spa] <<-[norank]- [api] : "**returns message response (with norank)**"
@enduml

a) then it works without any back relation

b) but with current Rel_Back() the layout is lost

c) with new [norank] Rel_Back() implementation the layout would remain

best regards Helmut

kirchsth commented 1 year ago

Another sample of new "layout neutral" REL_BACK implementation

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml

HIDE_STEREOTYPE()

Person(x, "X")
System(s1, "S1")
System(s2, "S2")
System(s3, "S3")
System(s4, "S4")

Rel_U(x, s1, "uses U")
Rel_R(x, s2, "uses R")
Rel_D(x, s3, "uses D")
Rel_L(x, s4, "uses L")

x <-[norank]- s1: "**new back U**"
x <-[norank]- s2: "**new back R**"
x <-[norank]- s3: "**new back D**"
x <-[norank]- s4: "**new back L**"

Person(ox, "old X")
System(os1, "old S1")
System(os2, "old S2")
System(os3, "old S3")
System(os4, "old S4")

Rel_U(ox, os1, "uses U")
Rel_R(ox, os2, "uses R")
Rel_D(ox, os3, "uses D")
Rel_L(ox, os4, "uses L")

' Rel_Back(ox, os1, "current back U")
ox <-- os1: "**current back U**"
ox <-- os2: "**current back R**"
ox <-- os3: "**current back D**"
ox <-- os4: "**current back L**"
@enduml
kirchsth commented 1 year ago

@Potherca: I was too optimistic and thought that Rel_Back was only used as additional response message, but now I found samples which use this call without any Rel() call like here

with orig implementation

with new layout neutral implementation (includes my extended branch)

Should I

What do you think?

Thank you and BR Helmut

Potherca commented 1 year ago

I think we should opt for a new layout option. It feels more like an option to the existing functions, rather than a new funtion.

kirchsth commented 1 year ago

@Potherca: Tried some ideas, but at the end I think a new layout option introduces only complexity. My last remaining solution would be a new Rel_xxxx() call, but I don't want to introduce a new call atm therefore I closed it BR Helmut PS.: If somebody requests it, we can reopen it