BirdsView
BirdsView copied to clipboard
A tool to visualize the structure of Java code.
BirdsView
About
BirdsView is a tool to visualize the structure of Java projects.
It takes source code and builds a graph of classes and interaces based on method invocations. Vertices are assigned a score according to PageRank or another algorithm of choice. The result is visualized in a force-directed graph.
What you get is a visualization of your project structure:
Tightly coupled classes end up close to each other while unrelated classes don't. Classes which encapsulate a lot of control (they call many other classes' methods) appear as larger nodes.
On top of that, you can hack the generated graph visualization with an embedded JS editor.
Installation and Usage (Unix)
prerequisites: Java 8+, a web browser
- Step 1: Download the jar
- Step 2: Run the jar:
java -jar BirdsView-1.0.jar PATH_TO_YOUR_SRC
Important: The PATH_TO_YOUR_SRC has to reference the parent of your java package structure. Meaning if your directory structure is something like:
/home/you/IdeaProjects/YourProject/src/main/java/com/yourdomain/yourpackage/YourClass.java
You would pass /home/you/IdeaProjects/YourProject/src/main/java/
for PATH_TO_YOUR_SRC.
Optional Args
- -h for help
- --scoreScale FACTOR to provide an integer factor that is applied to vertex scores. If not specified, a default factor specific to the scoring algorithm is used.
- The algorithm for vertex scoring:
--pageRank for PageRank (default) --alpha for AlphaCentrality --betweenness for BetweennessCentrality --closeness for ClosenessCentrality --harmonic for HarmonicCentralilty --clustering for ClusteringCoefficient
- --reverse to point edges from the calling type to the called type
References
This project uses...
- JavaParser and JavaSymbolSolver for source code analysis
- JGraphT for graph representation and algorithms
- kotlin-argparser for easy arg parsing
- Ace for the embedded js editor
- D3 for graph visualization
- Kotlin because it's the best
This gist created by Peter Kerpedjiev is the base of the visualization code.