Hi,
Are creating a simple component diagram with some 50 components.
Try to structure the diagram by using packages.
Line up the packages nice and tidy is straight forward, but once adding the components and their relations to the diagram, then packages start float around.
Are there a way to preserve the package layout?
Include simplified illustrations of what happens.
First, the code for the clean package layout:
@startuml
package "Boundary package" as Boundary {
}
package "Domain package" as Domain {
}
package "Backend One package" as One {
}
package "Backend Two package" as Two {
}
package "Backend Three package" as Three {
}
package "PaaS package" as PaaS {
}
package "IaaS package" as IaaS {
}
Boundary -[hidden]- Domain
Domain -[hidden]- One
Domain -[hidden]- Two
Domain -[hidden]- Three
One -[hidden] Two
Two -[hidden] Three
One -[hidden]- PaaS
Two -[hidden]- PaaS
Three -[hidden]- PaaS
PaaS -[hidden]- IaaS
@enduml
Then when I add components the relative location of the packages are lost:
@startuml
package "Boundary package" as Boundary {
[Boundary Service A] as BS_A
[Boundary Service B] as BS_B
[Boundary Service C] as BS_C
Interface "Boundery API A" as BS_API_A
Interface "Boundery API B" as BS_API_B
Interface "Boundery API C" as BS_API_C
BS_API_A -- BS_A
BS_API_B -- BS_B
BS_API_C -- BS_C
}
package "Domain package" as Domain {
[Domain Service A] as DS_A
[Domain Service B] as DS_B
[Domain Service C] as DS_C
[Domain Service D] as DS_D
Interface "Domain API A" as DS_API_A
Interface "Domain API B" as DS_API_B
Interface "Domain API C" as DS_API_C
Interface "Domain API D" as DS_API_D
DS_API_A -- DS_A
DS_API_B -- DS_B
DS_API_C -- DS_C
DS_API_D -- DS_D
}
package "Backend One package" as One {
[Backend Service 1_A] as BaS_1A
[Backend Service 1_B] as BaS_1B
[Backend Service 1_C] as BaS_1C
Interface "Backend API 1_A" as BaS_API_1A
Interface "Backend API 1_B" as BaS_API_1B
Interface "Backend API 1_C" as BaS_API_1C
BaS_API_1A -- BaS_1A
BaS_API_1B -- BaS_1B
BaS_API_1C -- BaS_1C
}
package "Backend Two package" as Two {
[Backend Service 2_A] as BaS_2A
[Backend Service 2_B] as BaS_2B
Interface "Backend API 2_A" as BaS_API_2A
Interface "Backend API 2_B" as BaS_API_2B
BaS_API_2A -- BaS_2A
BaS_API_2B -- BaS_2B
}
package "Backend Three package" as Three {
[Backend Service 3_A] as BaS_3A
[Backend Service 3_B] as BaS_3B
[Backend Service 3_C] as BaS_3C
Interface "Backend API 3_A" as BaS_API_3A
Interface "Backend API 3_B" as BaS_API_3B
Interface "Backend API 3_C" as BaS_API_3C
BaS_API_3A -- BaS_3A
BaS_API_3B -- BaS_3B
BaS_API_3C -- BaS_3C
}
package "PaaS package" as PaaS {
[PaaS Service A] as PaaS_A
[PaaS Service B] as PaaS_B
[PaaS Service C] as PaaS_C
[PaaS Service D] as PaaS_D
Interface "PaaS API A" as PaaS_API_A
Interface "PaaS API B" as PaaS_API_B
Interface "PaaS API C" as PaaS_API_C
Interface "PaaS API D" as PaaS_API_D
PaaS_API_A -- PaaS_A
PaaS_API_B -- PaaS_B
PaaS_API_C -- PaaS_C
PaaS_API_D -- PaaS_D
}
package "IaaS package" as IaaS {
[IaaS Service A] as IaaS_A
[IaaS Service B] as IaaS_B
Interface "IaaS API A" as IaaS_API_A
Interface "IaaS API B" as IaaS_API_B
Interface "IaaS API C" as IaaS_API_C
IaaS_API_A -- IaaS_A
IaaS_API_B -- IaaS_B
IaaS_API_C -- IaaS_B
}
Boundary -[hidden]- Domain
Domain -[hidden]- One
Domain -[hidden]- Two
Domain -[hidden]- Three
One -[hidden] Two
Two -[hidden] Three
One -[hidden]- PaaS
Two -[hidden]- PaaS
Three -[hidden]- PaaS
PaaS -[hidden]- IaaS
@enduml
And then I add also dependencies between the components (in this simplified illustration it falls back to look almost like the clean package, but in the real model things get really messy here). Still this illustrates the relative location of the packages are not static between the three examples.
@startuml
package "Boundary package" as Boundary {
[Boundary Service A] as BS_A
[Boundary Service B] as BS_B
[Boundary Service C] as BS_C
Interface "Boundery API A" as BS_API_A
Interface "Boundery API B" as BS_API_B
Interface "Boundery API C" as BS_API_C
BS_API_A -- BS_A
BS_API_B -- BS_B
BS_API_C -- BS_C
}
package "Domain package" as Domain {
[Domain Service A] as DS_A
[Domain Service B] as DS_B
[Domain Service C] as DS_C
[Domain Service D] as DS_D
Interface "Domain API A" as DS_API_A
Interface "Domain API B" as DS_API_B
Interface "Domain API C" as DS_API_C
Interface "Domain API D" as DS_API_D
DS_API_A -- DS_A
DS_API_B -- DS_B
DS_API_C -- DS_C
DS_API_D -- DS_D
}
package "Backend One package" as One {
[Backend Service 1_A] as BaS_1A
[Backend Service 1_B] as BaS_1B
[Backend Service 1_C] as BaS_1C
Interface "Backend API 1_A" as BaS_API_1A
Interface "Backend API 1_B" as BaS_API_1B
Interface "Backend API 1_C" as BaS_API_1C
BaS_API_1A -- BaS_1A
BaS_API_1B -- BaS_1B
BaS_API_1C -- BaS_1C
}
package "Backend Two package" as Two {
[Backend Service 2_A] as BaS_2A
[Backend Service 2_B] as BaS_2B
Interface "Backend API 2_A" as BaS_API_2A
Interface "Backend API 2_B" as BaS_API_2B
BaS_API_2A -- BaS_2A
BaS_API_2B -- BaS_2B
}
package "Backend Three package" as Three {
[Backend Service 3_A] as BaS_3A
[Backend Service 3_B] as BaS_3B
[Backend Service 3_C] as BaS_3C
Interface "Backend API 3_A" as BaS_API_3A
Interface "Backend API 3_B" as BaS_API_3B
Interface "Backend API 3_C" as BaS_API_3C
BaS_API_3A -- BaS_3A
BaS_API_3B -- BaS_3B
BaS_API_3C -- BaS_3C
}
package "PaaS package" as PaaS {
[PaaS Service A] as PaaS_A
[PaaS Service B] as PaaS_B
[PaaS Service C] as PaaS_C
[PaaS Service D] as PaaS_D
Interface "PaaS API A" as PaaS_API_A
Interface "PaaS API B" as PaaS_API_B
Interface "PaaS API C" as PaaS_API_C
Interface "PaaS API D" as PaaS_API_D
PaaS_API_A -- PaaS_A
PaaS_API_B -- PaaS_B
PaaS_API_C -- PaaS_C
PaaS_API_D -- PaaS_D
}
package "IaaS package" as IaaS {
[IaaS Service A] as IaaS_A
[IaaS Service B] as IaaS_B
Interface "IaaS API A" as IaaS_API_A
Interface "IaaS API B" as IaaS_API_B
Interface "IaaS API C" as IaaS_API_C
IaaS_API_A -- IaaS_A
IaaS_API_B -- IaaS_B
IaaS_API_C -- IaaS_B
}
'Usage relations included
BS_A --( DS_API_A
BS_B --( DS_API_B
BS_C --( DS_API_C
BS_C --( DS_API_D
DS_A --( BaS_API_1A
DS_B --( BaS_API_1B
DS_C --( BaS_API_2A
DS_D --( BaS_API_3C
BaS_2B -( BaS_API_1C
BaS_1B -( BaS_API_2B
BaS_1A -( BaS_API_3A
BaS_2A -( BaS_API_3B
BaS_1A --( PaaS_API_A
BaS_1A --( PaaS_API_B
BaS_1B --( PaaS_API_A
BaS_1B --( PaaS_API_C
BaS_1C --( PaaS_API_D
BaS_2A --( PaaS_API_C
BaS_2A --( PaaS_API_D
BaS_2B --( PaaS_API_A
BaS_3A --( PaaS_API_D
BaS_3B --( PaaS_API_B
BaS_3C --( PaaS_API_C
PaaS_A --( IaaS_API_A
PaaS_A --( IaaS_API_B
PaaS_A --( IaaS_API_C
PaaS_B --( IaaS_API_A
PaaS_B --( IaaS_API_B
PaaS_B --( IaaS_API_C
PaaS_C --( IaaS_API_A
PaaS_C --( IaaS_API_B
PaaS_C --( IaaS_API_C
'folder dependencies to try to force placement
Boundary -[hidden]- Domain
Domain -[hidden]- One
Domain -[hidden]- Two
Domain -[hidden]- Three
One -[hidden] Two
Two -[hidden] Three
One -[hidden]- PaaS
Two -[hidden]- PaaS
Three -[hidden]- PaaS
PaaS -[hidden]- IaaS
@enduml