根据.Net代码自动生成UML Sequence 图。
Sequence Diagram Generator for .NET
I was recently asked about programs that can automatically generate sequence diagrams from code. While this seems like a somewhat trivial task, there aren’t any good ones. I figured I’d share what I knew, tho. Maybe someone else knows of something better.
The first option that came to mind was Visio. I have to admit I’m not a fan of Visio. If you’re designing or documenting network topology, I’m sure it’s great. I don’t do that, tho. I work with software, and Visio is horrible for that. If you want to give it a try, tho, you can export your project from Visual Studio. Unfortunately, this won’t create a sequence diagram for you, so it was even more useless for what I was needing.
The next thing that came to mind was a tool built to do exactly this, SequenceViz. This tool analyzes an assembly and creates a sequence diagram. You’d think the search would be over, but not quite. The problem with SequenceViz is that, if you try to map out anything complex, the diagram is useless. Not because it’s all jammed together; the tool doesn’t scale… at all. Beyond this, the tool has some promise. The only other complaint I really have is the install experience. There are some odd dependencies that aren’t included in the installer, so you have to go hunt them down and install them separately. I hate this. Given the power of WPF, I would’ve preferred to use the capabilities built into .NET.
The next thing I thought about was my favorite modeling environment, Sparx Systems Enterprise Architect. The problem here is the automatic generation thing. To my knowledge, it doesn’t do that. I could be wrong, tho, so if you’re looking for an all-up modeling environment, I recommend you start here. If the price tag is a problem, take a look at StarUML, which is open source. StarUML hasn’t updated in a few years, tho, which is disappointing.
The last tool I found was a Visual Studio add-in called Flow Chart 4 C#. This tool generates a flow chart – not a UML activity diagram – for a given code block. This isn’t exactly what I was looking for and, honestly, I wasn’t impressed. If I were to need something like this, I’d prefer standard UML over some non-standard flow chart visualization.
One thing I’ve wanted for a long time has been a complete MDA environment for Visual Studio. When the domain specific language (DSL) Tools was released, I thought this would be a great tool to help get there, but it seems I’m the only one interested in it. Microsoft has a vision, but it’s at a much higher level. I’m thinking about an almost completely pure MDA approach where you don’t need much code. Most are probably scoffing at this, but I’m not talking about getting rid of code. I’m talking about code = model and model = code. There should be no difference between the two. I’ve put some thought into it, but don’t really have the time to dedicate to working on it. Maybe after a few more side projects.