200% Reflective Class Diagram Creation Tool

Some of you may have been www.codeproject.com members for quite some time, and may recall about 4 years ago I published a article which drew a class diagram from a Dll/exec called "AutoDiagrammer" I was quite lucky with that article, as it turned out to be very popular, and got loads of votes and a tonne of views, basically people seemed to love it, which is ace…I was very happy with that. Every author here wants people to like the stuff they publish (myself included, its the whole vanity thing I suppose).

Thing is, I wrote that orginal article a long time ago, when I was just getting into WPF, and although I was pretty happy with it, I always thought it could be so much better. So fast forward a couple of years, I now know enough WPF to really do justice to the orginal article and get it how I always envisaged it could be.

The things that I felt were wrong with the 1st  "AutoDiagrammer" article were as follows:

  1. The drawing of class associations was based on a grid layout
  2. The user could not move the classes around on the design surface, once they were laid out that was it
  3. The Association lines were not that clear to see
  4. The user could not scale the produced diagram that well (it was possible, but was not that great)
  5. The loading of the Dll/Exe to be drawn as a class diagram was done in the same AppDomain as the AutoDiagrammer.exe app, so when reflecting would be forced into loading ALL the additionally reflected types from the Dll/Exe into the AutoDiagrammer.exe apps AppDomain. Ouch…Not cool
  6. People found is slightly cumbersome figuring out how to get a diagram actually produced

That said, there were things I feel I definately got right such as

  1. The overall idea (people seemed to generally like it, and find it a very useful tool)
  2. The reflecting of information was correct
  3. The ability to fine tune what was show on the diagram

With all these good and bad points in mind coupled with the fact that I now know enough WPF to do the original code justice and do it how I always wanted to do it, I thought..YES the time is right, do a complete re-write of the original article.

So that is what this article is, it is a complete re-write of the original  "AutoDiagrammer" article, the feature list of this new articles code is:

  1. Detection of valid .NET assembly (Yes same as the 1st article, this tool only works with .NET Assemblies)
  2. The ability to move the classes in the design surface within the diagram
  3. The ability to not show classes that did not have any associations on the diagram, but still allow the user the ability to view these from a drop down list. This aids in keeping the diagram clutter free, only show what is absolutely needed
  4. Persisted settings, so that the next time the application is run, your personal settings will be as you left them
  5. Proper scaling of objects as vectors, so whatever scale the diagram is viewed at the objects are as clear as they could be
  6. Saving of the diagram to a XPS (Extensible Paper Standard) document which can easily be viewed using the standard Window XPS Viewer
  7. Printing a XPS document to a printer
  8. Loading the Dll/Exe into a seperate AppDomain that does not poluate the AutoDiagrammer.exe AppDomainwith the loaded Dll/Exe types
  9. Integrated help
  10. The classes show a full Association popup with all Associations shown a list of strings
  11. The Association lines show in a different color when the user hovers over them with the mouse
  12. Better detection of Associations between classes via parsing of method body IL (Intermediate Language)
  13. The ability to view method body IL (Intermediate Language)

As you can see I have kept what was good with the old article/codebase and have added more features to it. I am really happy with how it turned out and I hope you will be to.

 

if you want to know more you can read the full article over at this link:

http://www.codeproject.com/KB/WPF/AutoDiagrammerII.aspx

And here is a small screen shot of the new codebase in action:

image