hjwilli / grails-service-visualizer

Visualizes Grails Service and Controller Dependencies using Graphviz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grails-service-visualizer

Visualizes Grails Service and Controller Dependencies using Graphviz

Simple tool I wrote one afternoon to visualize complex Grails apps I was working with. See my blog post about the topic.

Build

You'll need Go installed. Build by running go build or go install if you have your GOPATH set up properly.

Also you will need a GraphViz installation.

Using

Assuming you're in the directory where the grails-service-visualizer binary lives:

grails-service-visualizer /path/to/grails-application

This will create a grails-application.dot file which you can then run through GraphViz:

dot -Tpng grails-application.dot -o grails-application.png

Enjoy.

To Do

This is app is a huge hack and currently can even produce invalid Graphviz files. It's by no means perfect, but allowed me to generate the beautiful graphs reference below:

Sample Images

Sample Graph App A Full Resolution[PNG 558K]

Sample Graph App B Full Resolution[PNG 393K]

Ideas

  • Calculate the transitive number of dependencies a component has and adjust the size of the visual representation based on that. For example, a service used only by a single controller would be fairly small. Another service, used by twenty other services would be much bigger and more prominent. Fairly easy to implement.
  • Use afferent and efferent coupling to calculate the instability of services. Originally a metric for packages, this could probably applied to services as well. Could be visualized with border thickness of shapes.
  • Support different types of artifacts and give them different shapes. Right now I'm thinking quartz jobs which play a fairly important role in our application.
  • Parse code instead of string searching. Right now I'm simply scanning each source file line by line and search for certain patterns. This works reasonably well, but with some apps I get unwanted values. Sometimes from comments, sometimes other values. If I were to actually parse the source into an AST, all these issues would disappear. It would also allow a host of other interesting things, like:
  • Calculate the Cyclomatic Complexity for each component and use that to colour code the visual representation. Low complexity could be a green tint, high values would be red.
  • Support different languages and frameworks. I was able to implement this tool very easily because Grails' service and controller naming follows an entirely name based convention. That makes finding service definitions trivial. I would love to extend this tool to support different languages and frameworks.
  • Have more ideas? Drop me an email or a comment or send me a pull request! :)

About

Visualizes Grails Service and Controller Dependencies using Graphviz

License:GNU General Public License v3.0


Languages

Language:Go 100.0%