Automatically generate interactive sequence diagrams of your Java code's runtime behavior
Tags: java, productivity, programming, codenewbie
Published: 2023-04-11 19:14:58

The AppMap team is excited to announce that automatic, interactive sequence diagrams for Java applications in the [IntelliJ IDE](https://plugins.jetbrains.com/plugin/16701-appmap) is live!

(Also available [in VS Code](https://marketplace.visualstudio.com/items?itemName=appland.appmap))

![See the new sequence diagrams tab at the top](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/16chnp50hv1r5f6fdhzv.png)

Sequence diagrams are incredibly powerful for visualizing and understanding runtime behaviors. Their inherent structure - objects flowing across the page, time flowing down the page - is intuitive and easy to learn. And they are one of the best tools for developers and technical non-developers (like engineering managers and product managers) to use when discussing code design.

AppMap can now generate sequence diagrams automatically from any running Java application.

Before, sequence diagrams can only be created by manually inspecting code listings or debugging a system. With AppMap, you simply run your application and accurate sequence diagrams are generated instantly.

{% embed https://youtu.be/8l4-hNih_GQ %}

## They're interactive 🖱!

Once you [install AppMap into IntelliJ](https://plugins.jetbrains.com/plugin/16701-appmap) and generate your own sequence diagrams, you can click on any function call in the sequence to inspect the code.

![Inspecting the code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ranj6yk20nh439y0m0t9.png)

Each vertical "lifeline" in the diagram floats as you scroll down long interactions, making it easy to keep track of which lifeline is involved in any function call. 

Lifelines can also be hidden to make the sequence diagram even more readable. This is especially useful if you want to hide calls to things which are less important (for example, a logging class).

![Keeping track of lifelines](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xc7wthzd2kq7bhpgc1o.png)

## Examine loops and call timings ➰

Loops are automatically detected and rendered in a summarized fashion to prevent the sequence diagram from becoming too long. All function call durations are shown, so you can quickly see where your code is spending the most time doing its processing.

![Examining the loop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rr4lk7accmlflgm0qmh4.png)

## Always accurate sequence diagrams ✅

The biggest challenge with manually-created sequence diagrams is that they quickly go out of date compared to the current behavior of the system. Because AppMap records the runtime behavior of your application, the sequence diagrams it creates are always guaranteed to be accurate and complete.

## Easily view database queries - even auto-generated ones 👀

AppMap captures all SQL queries made to a database while your application runs, even if your database queries are automatically generated by an ORM/JPA framework like Hibernate.

![Capturing all SQL queries](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lek4jshujnxq9aq8g3tn.png)

## 3 simple steps

1. [Install](https://plugins.jetbrains.com/plugin/16701-appmap) the AppMap plugin into JetBrains
2. Run your application (or your tests) with the AppMap library loaded
3. Open the generated AppMap to view the sequence diagram

![Running an application with the AppMap library loaded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqlmdn5y7echc16qvdsw.png)

### Available now for IntelliJ and JetBrains

AppMap with sequence diagram support is now available for installation from the JetBrains marketplace, and it is free for personal use and for open source projects. [Get it now!](https://plugins.jetbrains.com/plugin/16701-appmap)

(Also [available in VS Code](https://marketplace.visualstudio.com/items?itemName=appland.appmap))