Skip to main content

UML isn't Dead

If you’ve studied software design at the university, there is no chance you missed UML diagrams. But, “when did you last use UML diagrams?” and the answer unanimously came across as “UML is pretty much dead, I used sequence diagrams occasionally, and that’s pretty much it”. I did some research, and I found some interesting stuff. Buckle up and hold on as we go through this ride.

How did it start?

It all started when I had to generate class diagrams for a data ingestion engine(2020) I was working on. I quickly found a Python library and stitched it to our Pre-Commit, generating a new diagram per commit.

Later in 2022, when I wanted to write a Github action, I used the same blog post as a reference and the generated ERD images as a part of the code review comment.

Are there other tools in the same arena? Is it possible to generate full fletched diagrams just by using codebase as your source of truth? Are there tools like this available already? Like Simon Brown, I hate diagramming tools. Too much mouse involvement, never up to date.

UML diagrams are no longer used for system design. I’m not sure how people are designing systems these days. The code is extremely user-friendly. It’s easier to visualize things from the code base, or is it so?

I originally backed that up with a quick scan of job boards, but I can’t point you to a source or a number for it, so I’ve cut it. Instead of arguing from job titles, let’s look at the mechanisms people who watched UML decline keep pointing to.

Why did UML fade?

None of these says diagrams are useless. They say the heavyweight, up-front, drawn-in-a-GUI version of UML lost to code. What survived is the lightweight version Fowler calls UML as sketch, where “the essence of sketching is selectivity.”

As systems become complex, you still need a way to express software specifics in a format both tech and non-tech stakeholders can follow. That is where diagrams earn their keep, from brainstorming your system design to documenting it. There are tools in place to help us.

Where UML still survives

  • Systems engineering (SysML). In July 2025 the OMG approved SysML v2.0 for final adoption, with complementary textual and graphical representations of the model. Notice that even this world moved towards a text notation you can keep in git.
  • Automotive (AUTOSAR). AUTOSAR’s Classic Platform specifies its Basic Software modules in a UML model, using component, class, sequence and state machine diagrams so the many specification documents stay consistent.
  • Payment and integration flows. When several parties exchange messages in a fixed order, a sequence diagram is the natural format. Payment providers publish their flows this way, for example Worldpay’s Payments API sequence diagrams covering card payments, 3DS authentication and stored credentials.

Here is the kind of thing I mean, a deliberately simplified card payment flow (my own sketch, not any provider’s spec):

sequenceDiagram
    participant C as Customer
    participant M as Merchant app
    participant P as Payment provider
    participant B as Bank
    C->>M: Pay
    M->>P: Create payment
    P->>B: Authorise
    B-->>P: Approved or declined
    P-->>M: Result
    M-->>C: Confirmation
    P-->>M: Webhook, payment settled (async)

Notice what these have in common: many parties, strict ordering, and a cost to getting it wrong. That is where a diagram beats reading five codebases.

Software Modeling Diagrams

UML

UML is widely used in software engineering and recognized as a de facto standard for modeling software systems. It is often used in the early stages of software development to help stakeholders understand and communicate the design of a system. UML is used in various contexts, including business process modeling, enterprise architecture, and system engineering.

UML Diagram Types

Structure Diagrams

  • Class Diagram.
  • Component Diagram.
  • Deployment Diagram.
  • Object Diagram.
  • Package Diagram.
  • Profile Diagram.
  • Composite Structure Diagram.

Behavioral Diagrams

  • Use Case Diagram.
  • Activity Diagram.
  • State Machine Diagram.
  • Sequence Diagram.
  • Communication Diagram.
  • Interaction Overview Diagram.

Among these, the class and the sequence diagram are the most commonly used

ERD Diagrams

ERD diagrams are used to model the logical structure of a database. They depict the relationships between entities (e.g., tables or views) in a database and the attributes that define them. ERD diagrams are used to design and document a database’s structure, typically used in the early stages of database development.

C4 Model

The C4 model is a software architecture model used to describe and communicate the structure of a software system. Simon Brown developed it to improve the effectiveness of software architecture documentation.

The C4 model is based on four levels of abstraction: context, container, component, and code. Each level represents a different perspective on the system, and the model provides a way to visualize and communicate the relationships between these levels.

One key difference between the C4 model and UML is that the C4 model is specifically focused on software architecture. At the same time, UML is a broader modeling language used to design various systems.

Which diagram when (and when not to model)

You don’t need all fourteen UML diagram types. This is the short list I’d reach for, and the question each one answers.

You need to answer…Reach forNotes
How do these services or actors talk to each other, in what order?Sequence diagramAuth flows, payments, webhooks, retries. The one most worth keeping.
What are the main types and how are they related?Class diagramKeep it to the handful of classes worth discussing, not the whole codebase.
How is the data stored and related?ERDGenerate it from the schema or ORM models where you can.
What states can this thing be in, and what moves it between them?State machine diagramOrders, payments, jobs, anything with a lifecycle bug waiting to happen.
What does the system look like to someone new?C4 context or container diagramStart here for onboarding docs.
How does a process or decision flow?Flowchart / activity diagramBusiness rules, runbooks. Often what a non-technical stakeholder wants.

And when I would not model:

SituationWhy skip the diagram
The code is small enough to navigate in your IDE in a few minutesThe code already is the diagram.
Throwaway scripts and prototypesThe diagram will outlive the code and mislead.
A diagram you’d have to redraw by hand every sprintIf it can’t be generated or kept as text next to the code, it will rot.
Restating what a type signature or schema already saysLink to the schema instead.
The only reason is that a process demands oneA diagram nobody reads is negative value.

Diagram From Code

As the exploration began at the start of the blog, the goal was to generate a diagram from source code. Below are some language-wise tools that create diagrams.

PlantUML

PlantUML is an open-source tool allowing users to create diagrams from a plain text language. Besides various UML diagrams, PlantUML supports various software development-related formats

@startuml

Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response

@enduml

PlantUML sequence diagram of Alice and Bob exchanging authentication requests and responses

ZenUML

ZenUML is a tool similar to plantUML. It claims to have better DSL syntax than PlantUML. PlantUML still has the market because of the ecosystem and the support for all UML diagrams.

ZenUML example: code on the left (BookController, BookService, BookRepository calls) rendered as a sequence diagram on the right

Mermaid vs PlantUML

Both let you write diagrams as text. The difference is mostly about where you want them to render.

MermaidPlantUML
RuntimeJavaScript, rendered to SVG in the browserJava; Graphviz needed for everything except sequence diagrams
In GitHub markdownRendered nativelyNot listed among the syntaxes GitHub renders
Diagram coverageFlowchart, sequence, class, state, ER, C4, Gantt and moreWider UML coverage, which is why PlantUML kept its ecosystem
Fits bestREADMEs, docs sites and blogs like this one, anywhere a markdown renderer can draw itHeavier UML work, CI pipelines that already have Java

A simple rule of thumb: start with Mermaid because it renders where your docs already live, and move to PlantUML when you need a UML diagram type Mermaid doesn’t have. Check the Mermaid diagram list before you switch. The Graphviz weight I mentioned earlier is the other thing to remember when you put PlantUML in CI.

Diagramming Tools

These tools have a structure that will let you write these diagrams in text format. We are skipping the general-purpose diagramming tools such as Draw.io.

Mermaid

JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically.

Mermaid can create a variety of Charts and graphs, Gantt, Class, ERD, and Sequence diagrams. It has its own syntax to generate diagrams. You can try it live at https://mermaid.live/

WebSequenceDiagrams

Websequence Diagrams is a simple and easy-to-use online tool. It comes with an online editor with many pre-defined examples to customize. It supports PlantUML syntax.

DBDocs.io

DBDocs uses the DBDigram.io tool is specifically designed to generate ERD diagrams based on the DB schema. Similar to the websequence diagram, it has a code-based editor. They support up to 10 diagrams for free.

Dbdiagram.io uses DBML as our syntax for defining databases. DBML has open-sourced markup language used to describe database schema structure. The team behind DBdiagram also develops DBML.

TryEraser

Eraser is a visual + code-based tool that lets you document your cloud architecture and ERD. It now describes itself as an AI-native architecture platform.

Aivosto

Supports 49 languages https://www.aivosto.com/visustin.html

Draw.io

Draw.io might look like a drag-and-drop UI on the surface. But here is something that most people don’t know about it. It supports plantUML. You import a diagram using plantUML.

Draw.io Arrange > Layout > Advanced menu with options From Text, PlantUML, Mermaid, SQL and CSV

Apart from that, it also has ways to import and generate images from SQL or CSV.

Excalidraw

A virtual whiteboard with a hand-drawn look, which is exactly the “UML as sketch” spirit. It is the opposite of a strict modelling tool, and that’s the point: diagrams that look like sketches don’t pretend to be the blueprint. mermaid-to-excalidraw converts Mermaid flowcharts, sequence, class, ER and state diagrams into editable Excalidraw elements, so you can generate a first draft as text and then tidy it by hand.

D2

“A modern language that turns text to diagrams.” D2 is an open-source diagram scripting language with a choice of three layout engines, a hand-drawn sketch mode, themes, and support for sequence diagrams and UML class shapes. Worth a look if Mermaid’s layouts or styling feel limiting.

Language-Specific Tools and Libraries

In the upcoming sections, we will be discussing language-specific diagram generators. Before we do that, It is important to pause here for a minute and appreciate the greatness of the GraphViz library. This library is the base for some of the famous visualization projects and is pretty much used in all the libraries we are going to discuss in the next section.

GraphViz

Graphviz is open-source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. The source of major diagramming tools, all the above tools work on top of this.

One downside of GraphViz is heavy(700MB). If you use any of the libraries in CI/CD, you are spinning up a 700MB+ container every time. Not very resource friendly

NodeJS Prisma

Prisma is an open-source data access layer that connects databases and manipulates data. It is built on the Node.js runtime and provides a simple and expressive API for working with databases.

TypeScript

This simple tool creates a UML diagram from typescript modules. It also uses the famous GraphVis. Heads up: the last commit I could see in the repo is from December 2017.

Ruby On Rails

Rails ERD was explicitly created for Rails, and its README now says it works on Rails 6.0 and later (including 7.x and 8.x). It uses Active Record’s built-in reflection capabilities to determine how your models are associated.

Python

Python open-source tools are plenty, and since I am a Pythonista, I give more attention to this section

Diagrams

A pythonic interface to generate cloud architecture diagrams

Diagram generated with Python code: a load balancer connected to a web service and a user database

# diagram.py
from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB

with Diagram("Web Service", show=False):
    ELB("lb") >> EC2("web") >> RDS("userdb")

Erdantic

Erdantic is a simple tool for drawing entity relationship diagrams (ERDs) for Python data model classes. Diagrams are rendered using the venerable Graphviz library. Supported data modeling frameworks are: Pydantic and dataclasses

Py2UML

py2puml produces a class diagram PlantUML script representing class properties (static and instance attributes) and their relations (composition and inheritance relationships).

py2puml internally uses python’s standard inspect library and abstract tree parsing to retrieve relevant information.

PyFlowChart

PyFlowchart is a package to:

  • write flowcharts in the Python language,
  • translate Python source codes into flowcharts.

PyFlowchart produces flowcharts in flowchart.js flowchart DSL, a widely used flowchart textual representation. It’s easy to convert these flowcharts’ text into a picture via flowchart.js.org diagrams or some markdown editors.

Django

Django-extensions, an Opensource project, provides various tools and extensions to make Django development smooth and effortless.

A part of it is Django Graph models that generate UMLs based on your schema definition.

One downside is that it doesn’t support Many2ManyFields, which is still a challenging problem in most of these packages.

SQLAlchemy

ERAlchemy is a similar version available for SQLAlchemy-based ORMs. The original repo had no updates after 2021 when I first wrote this, so it was adopted as eralchemy2. The original has since moved to the eralchemy organisation, so check both before picking one. With the release of SQLAlchemy 2.0, I don’t know how much of an impact it will have on ERAlchemy.

Diagrams on IDEs

IntelliJ

Intellij Ultimate(Paid) shows us a dependency diagram (UML) for a package, making it easy to read a new codebase.

Right-click a package, and you’ll see diagrams -> Show diagrams.

VSCode

Sorry, VSCode people, I haven’t found anything as promising as IntelliJ ones. There are extensions, but they’re not comparable to what IntelliJ can do.

Diagrams and AI

The other change since I first wrote this post is that you can now ask an LLM for the diagram instead of drawing it. I work with GenAI day to day, so here is how I’d use it for diagrams, and what I’d check.

Prompt to diagram. Describe a flow in plain English and ask for Mermaid or PlantUML text, not an image. Text can be diffed, reviewed and committed, and you can render it anywhere. Something like:

Write a Mermaid sequenceDiagram for this flow. Use only the participants I list.
Participants: Customer, Web app, Payment provider, Bank.
Flow: customer pays, web app creates a payment with the provider, provider
authorises with the bank, result goes back to the web app and the customer.
Include the failure path where the bank declines.
Return only the code block.

Code to diagram. Paste in the specific module, route handler or schema you care about and ask a specific question (“show the call sequence for POST /orders”). This is Fowler’s reverse-engineering sketch: selectivity matters, so don’t hand the model the whole repo and ask for “the architecture”. For class diagrams and ERDs where you need the exact structure, a deterministic tool such as py2puml, Erdantic or Django’s graph_models (covered above) will be more reliable than a model. Where the LLM earns its keep is behaviour, such as sequence flows across files, which static tools can’t see.

What to check before you trust it:

  • Does it parse and render? Generated diagram syntax can be wrong, so validate it. Mermaid’s mermaid.parse validates a definition without rendering it, and rendering it in CI (for example with mermaid-cli) catches the rest. The MermaidSeqBench benchmark for natural-language-to-Mermaid sequence diagrams reports significant capability gaps across the models it evaluated, which is a good reason not to skip this step.
  • Are the participants real? Models happily invent a “Cache” or “Auth Service” that your code doesn’t have. Compare every box with something you can grep.
  • Is the order right, and sync vs async? Arrows can be in the wrong direction or sequence. Walk the diagram against the code.
  • Where are the error paths? The happy path is easy. Retries, timeouts and declines are what usually get dropped.
  • Is it labelled as a sketch? Treat the output as a draft derived from reading, not a source of truth.
flowchart LR
    A[Code or spec] --> B[LLM]
    B --> C[Mermaid text]
    C --> D{Parses and renders?}
    D -- no --> B
    D -- yes --> E[Review against the code]
    E --> F[Commit next to the code]

This loop also attacks the drift problem from earlier. If regenerating a diagram is a prompt away and the source lives next to the code, keeping it current stops being a chore nobody does. I’d still have a human review it before it merges.

Behind the scenes

  • I ideated, researched, and wrote this blog in December
  • If you want to initiate a conversation or want me to write a blog for me, write an email to me bhavanicodes@gmail.com