Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Nested packages. Which code is "better"?

0 votes

I generate PlantUML code programmatically. The two script below produce identical diagrams.  I'm tempted to use the format of the first script, because it makes my program simpler. Question: Are there other reasons to chose one over the other?

@startuml
title Packages - Class Diagram
package Folder <<Folder>> {
package Rectangle <<Folder>> {
  class Worker1
}}
package Folder <<Folder>> {
package Rectangle <<Folder>> {
  class Worker2
}}
package Folder <<Folder>> {
package Rectangle <<Folder>> {
  class Worker3
}}
package Folder <<Folder>> {
  class Worker
}
Worker1 --> Worker2
Worker2 --> Worker3
@enduml

 

@startuml
title Packages - Class Diagram
package Folder <<Folder>> {
package Rectangle <<Folder>> {
  class Worker1
  class Worker2
  class Worker3
}}
package Folder <<Folder>> {
  class Worker
}
Worker1 --> Worker2
Worker2 --> Worker3
@enduml

 

asked Mar 16 by poi (920 points)
edited Mar 16 by poi

1 Answer

0 votes
PlantUML will support both syntax.

But I think that the second one is better : the code is shorter. Especially if this is generated, the first script will be very verbose and difficult to debug in case of issues.

Just my two cents!
answered Mar 16 by plantuml (125,210 points)
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...