Runtime Reverse Engineering with UML

You're probably used to reverse-engineering Java code into a UML model. Just feed in some Java source files and you're rewarded with a class diagram that shows the static relationships between the classes in your application.

What about other UML diagrams, such as sequence diagrams, that describe the dynamic behavior of an application? We can draw them up-front to show how we expect the application to behave, but it would be useful if we could reverse-engineer them as well, in order to find out if the actual behavior of the system matched the original design.

Well, we've actually developed a rudimentary runtime reverse-engineering tool that allows you to do just that. Look back at the sample visualizations produced by TraceViewer. We have all the information we need to render a proper UML sequence diagram: a sender object, a message, and a receiver object. With a little more ingenuity we could even come up with something like this:

We wouldn't even have to write our own visualization tool; we could simply output the debugging messages in an XML format that could be loaded into a UML tool such as Rational Rose or TogetherJ.