Is it possible to set a different layout style by packages in class diagram

0 votes
asked Oct 15, 2022 in Question / help by anonymous
edited Oct 15, 2022

for example something like having "left to right direction" in one package, and "top to bottom direction" in another.

It's the only way I could dream of to make big plantumls more readable.

Currently, my big plantumls does not show well the layer structure I'd like to expose.

I looked in the doc, search on internet, and have not found any ways so far, but I still hope I simply missed the feature of my dream :)

1 Answer

0 votes
answered Oct 24, 2022 by Todd Musheno (2,680 points)
If you are trying to generate a class diagram out of a large code base you are going to get a large diagram.

You may want to consider a component, or deployment diagram if you want a high level view of your code.

If you have a code base with 1,000 classes in 100 packages all interrelated (not uncommon), your diagram is going to be hard to read no matter how you cut it. That problem is one of the main reasons for component and deployment diagrams.

In large code bases I generally generate a component diagram for how packages are related, and then a class diagram per package.

If that is still hard to visualize you probably have a complexity issue in your code, and may need to refactor. Cognitive complexity is the number one cause of bugs, and the number one things that slows a development cycle.

If you are having issues diagraming your system in a readable way, developers are going to have a even worse time with it.
commented Oct 24, 2022 by anonymous

Thanks for your answer,

I understand your point that there is no magic for reducing complexity.

I hoped there could be ways of showing some kind of underlying structure by playing with different direction priority in the different packages or something like this, because while my code is complex, it has a layered structure that makes it a bit simpler than what the final plantUml diagram shows.

I could indeed split my diagram into different packages, and that's actually what I'm doing, but I tried something else here.

Thanks anyway
commented Oct 27, 2022 by Todd Musheno (2,680 points)

Don't get me wrong it was a good question, but I think you would be better served with reducing the diagram then trying to get more control over layout.

One of the best things about plantuml is its lack of control over the layout, if your diagram changes, everything is re rendered "correctly" with zero need for you to do anything.

If you want full control over the look of everything, I would suggest something listed here:

Keep in mind though any change in those tools will require a human person to go through and layout everything again (IMHO not worth it, but your millage may vary), also most (if not all) of them do not have the ability to simply track changes... something plantuml excels at.