PackageMap - a tool to build a map of your code
I built https://packagemap.co to see how cohesive or coupled code was.
PackageMap is the next iteration of java-graphviz.
It builds on the same principles as java-graphviz. Namely that:
- Coupling is bad
- Cohesion is good
- The existing code review tools show you file content, but not how the files interact with each other.
Code review is hard
I do a bunch of code review, particularly in github. The code review UI is great, but I found that I was only reviewing the content of the files.
I was missing how those files fit together. I found it hard to see from a file-tree, in an IDE or in Github code review, how the types are used across an application.
As the applications I reviewed got larger, I wanted to check if the code was being packaged by domain — to be cohesive. I wanted to check that the code that is related to each other is in the same package, and that there were few cross-package imports.
To solve the problems I had with code review, and to see how code fits together, I built https://packagemap.co
Packagemap is made of two parts
- A java parser (hopefully other languages to come) that builds an AST of your code, to work out which classes are using which other classes. The parser runs on your machine, so the source files stay on your machine.
- The https://packagemap.co site. On the site you can filter and explore the “maps” (directed graphs of the code’s imports). You can filter and explore maps by prefix, like “com.example.package” or by wildcard “*.package.MyClass”
- SQLite database using LiteFS
- VueJS 3
- Bulma.io CSS framework