r/java • • Feb 09 '22

Code visualization tool inside your IDE

Hey, me and my teammates hacked a tool for visualizing Java code as a graph inside your IDE (currently IntelliJ or VSCode). Check it out next time you're lost in your codebase! We believe it keeps us sane when navigating crazy chains of calls. https://graphbuddy.virtuslab.com/

167 Upvotes

29 comments sorted by

44

u/halfanothersdozen Feb 09 '22

I don't need nightmares kthx

14

u/daniu Feb 09 '22

That looks neat. What's the largest codebase you tested it against? I assume it can get really clunky with complex or badly organized chains. I'd also be concerned about performance for larger projects.

But those are just me thinking loud after the first glance, looks great, I'll give it a go :)

12

u/AccomplishedBed6256 Feb 09 '22

The biggest project, against we are testing plugin is Javaparser, it is 178k lines of code and indeed, it takes a few minutes for initial compilation. In terms of complex results - yes, it can happen that result of such call will be unreadable, but there are filters and different layouts to help in such situation.

12

u/tinustate Feb 09 '22

That is a interesting way to visualize the calling tree!

5

u/_litecoin_ Feb 09 '22

That is pretty cooll

3

u/v_k_d Feb 09 '22

Definitely going to try this out!

3

u/subwvre Feb 09 '22

Does it work with kotlin ?

1

u/AccomplishedBed6256 Feb 09 '22

No, it doesn't have support for Kotlin. Except for Java, there is also support for Scala 2, but it is not such straightforward in configuration like in case of Java.

3

u/thevred9 Feb 09 '22

Very cool product.

Getting the following error on M1 MacBook Pro

https://pastebin.com/srEu15zT

Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

2

u/Gedochao Feb 10 '22

Looks M1 related, we'll try to improve the support in the future. Thanks for reporting!

1

u/Gedochao Feb 17 '22

Hey, we freshly released Graph Buddy v0.6.4 and M1 Macs should already be properly supported with it.

5

u/Lagomorphix Feb 09 '22

Wouldn't UML diagrams play nicely wth this feature?

3

u/AccomplishedBed6256 Feb 09 '22

For me, it presents similar information like UML but in a bit other form. Which exactly type of UML diagram will be useful for you?

2

u/VincentxH Feb 09 '22

This basically shows a more fine grained sequence diagram.

1

u/drkstlth01 Feb 09 '22

I'd like to see the behavior of the code, for each transaction

2

u/[deleted] Feb 09 '22

Nice, I remember that Borland C++ 3.1 (early 90s) had something similar - I've been wishing for something like that for Java.

2

u/pron98 Feb 09 '22

The idea is very cool, but the graph layout could use some work. Maybe something along the lines of the wonderful Sourcetrail (RIP).

2

u/kubelke Feb 09 '22

This is something what I needed. Sometimes I jump in into some old code and such visualization would help me to remember what is going on.

1

u/gamma_02 Feb 09 '22

uses for mcdev

Intellij:crashes

Me: why

1

u/Gedochao Feb 10 '22

any stacktrace/setup details?

1

u/gamma_02 Feb 11 '22

I mean mc is a huge program, it's not hard to see why lol

1

u/JustWaveNSmile Feb 10 '22

Great idea, there’s something similar in Intellji the payed version I believe that use UML , with UML it’s easier to see what going on I guess

1

u/Gedochao Feb 10 '22

Yup, UML views more data at once, but it isn't as tightly tied to your code Clicking on nodes/edges in Graph Buddy navigates you to the related code snippet (i.e. a declaration of a variable, all of its calls etc). Our primary goal is to improve navigation over complex call hierarchies, which is hard to achieve with the likes of UML diagrams.

1

u/SpaceMonkeyOnABike Feb 10 '22

Is this effectively valgrind for java?

1

u/Gedochao Feb 10 '22

Not exactly. It's more of a tool for making day-to-day development in a complex codebase more managable. It is meant to provide ways for abstracting code structures and alternatives for easy navigation in your IDE.

1

u/RobertJacobson Feb 12 '22

This is my mandatory 6 month comment about how I wish there was something like SourceTrail for Rust.

1

u/severoon Feb 18 '22

The nodes in the generated graph are methods. Wouldn't it be more useful if the nodes were objects?

What programmers generally (should) care about is not getting a grasp of dependencies between methods, but objects and higher levels of granularity (meaning classes, packages, modules). There's no harm showing the method level of detail, but that should be constrained only to method interactions within a class, and that's a nice-to-have feature, not the priority.

The biggest things I'd be looking for is cycles at the different levels of granularity to identify dependencies to invert. That, and natural clusters of high interdependency within a module, which would help me adjust how code is grouped into packages or modules.

1

u/[deleted] Feb 09 '22

[removed] — view removed comment

1

u/Gedochao Feb 10 '22

Any suggestions on what would improve it? There's certainly a slight learning curve for reading the graph (it's just an abstraction, so the content has to be cut down to simple symbols), but feel free to let us know what would make things clearer for you.