Thursday, December 18, 2008

PyXMI

A few years back, I had a failed attempt at creating an open-source UML activity diagram runner called PyXMI. As the name implies, it was a Python program that attempted to load UML modules that were saved in the XMI format, and execute activity diagrams.

I think this project failed mostly because of my lack of understanding in the UML specification area as well as my lack of any use cases for such a project. I still do think it would be quite useful for such a library to exist. Having the ability to draw work-flow visually and have it directly executed (as opposed to generating the source code, and executing that), is a powerful tool. Maybe not in production use but as far as testing new ideas goes, this could offer insight that is not available by other means. Besides, that is why the UML was created, to visualize systems.

What if, besides generating the XMI document and executing that, we were able to simulate the model that is held in memory by the modeling tool? I know of no open-source project that can do this but the existing projects offer the components necessary to realize this functionality. Ideally, this would be fairly trivial to do if the modeling language is written in a dynamic language such as Python. Gaphor is written in Python and the code is of high quality and easy to grasp.

One feature Gaphor that is missing is colour support in the diagram canvas. Umbrello does offer colour support and makes for a good example of simulating a running activity diagram. For example, consider the following activity diagram.



This diagram is extremely straight-forward so I'm not going to bother explaining what it represents. Next, if we were running a simulation of this diagram, the modeling software could step through the activities and change the colour of the currently executing activity. Once an activity transition is reached, however, the model would need to pause for at least half a second so as to not fly through the execution. The reader should have the opportunity to view the execution as is illustrated below.



Now we process the input.




Finally, we send the output.




Hopefully, Gaphor will soon implement colour support so I can start experimenting with a plugin that will make another attempt at realizing executable/simulatable activity diagrams.

No comments :

Post a Comment