The basic structure of code can be somewhat hidden by its use of trivial helper classes. Theses are classes with simple functions (getters, setters, predicates, etc) that don’t use other classes. I wanted to see if there was a way to use a graph database to help identify such classes in an unfamiliar code base.
Once that’s in place, a cypher query shows all the “leaf” classes, i.e. those that don’t call methods in other classes:
MATCH(n) WHERE NOT (n)-[:CALLS]->() RETURN n ORDER BY n.defined_class LIMIT 10;
This query returns 10 classes that don’t have a
CALLS relationship with any other classes.
These are the simple classes I was looking for, and excluding them from AppMaps definitely improved the visualizations.
Originally posted on Dev.to