DEV Community

Discussion on: Importance of diagrams

Collapse
 
cjbrooks12 profile image
Casey Brooks

I love to use diagrams for organizing my thoughts at a high level on a complex feature before writing any code for it. It really helps me to figure out exactly what this new features needs to have and how the various pieces should work. As I get writing code for this feature, it also serves as a great reference, so I can check how clearly the code follows the diagram and that it is doing what I think it should be.

I don't try to be too strict about UML syntax, and when I start writing code, I may find the code requires a different setup, at which point I will modify the diagram to match the new direction.

As for tools, I really like using PlantUML. While its documentation isn't that great, it is a really powerful tool, and I love that I can create diagrams just out of text. I like being able to check a diagram into source control, and it makes it much easier to compose large diagrams. Before I found PlantUML, I always liked the idea of diagrams, but always found graphical diagramming tools clunky and difficult to scale to anything with more than a couple dozen nodes. PlantUML frees me from the layout and allows me to just express my thoughts in terms of relationships among nodes, and it figures out how to draw the diagram so it can be easily viewed at a glance.

There are lots of tools that integrate with PlantUML, but I like to manage my diagrams with Orchid. I originally built Orchid to document my Java projects' code and wikis, and being able to embed diagrams right alongside that makes it really easy to keep up to-date. I even have a project that uses a pub-sub architecture, and I parse the Java sources to find all the places that fire/receive events, and generate a PlantUML diagram mapping out the entire app. I can then compare this generated event diagram with the one I created manually to verify that the actual application structure matches the planned structure.

Collapse
 
bertilmuth profile image
Bertil Muth

Yes, I think generating diagrams from code can be really powerful.

Collapse
 
functor profile image
Santana16

And I think in this case, there are some tools that generate architecture diagrams automatically from the source code. Here is what I use for my projects sourcespy.com