石头

我的备忘录

Automated Drawing of UML Diagrams
UMLGraph allows the declarative specification and drawing ofUML class and sequence diagrams.The current featuresare part of an ongoing effort aiming to provide support forall types UML diagrams.An IEEE Software article titledOn the declarative specification of modelsexplains the rationale behind this approach.The tehnology behind UMLGraph was used to draw many of the diagramsappearing in the award-winning booksCode Quality: The Open Source Perspective (Addison Wesley, 2006) andCode Reading: The Open Source Perspective (Addison Wesley, 2003).In addition,the UMLGraphDoc doclet included in this distribution automaticallyadds UML diagrams to javadoc documentation.

Many programs build on UMLGraph; follow this linkfor more details.In addition,Martin Fowler, the author ofUML Distilled, writes:

I thought I'd send you a note saying how much I enjoyed discovering UML Graph.I've long fancied a text based way of describing UML diagrams,but never felt sufficiently time-rich to develop anything.

Class Diagrams

One specifies a class diagram using the Java syntax complemented byjavadoctags.Running the UmlGraph doclet on the specification will generateaGraphvizdiagram specification that can be automatically processed tocreate Postscript, GIF, SVG, JPEG, fig, or Framemaker drawings.

The following is an example of a class diagram specification and the resulting UMLdiagram:

class Person {
	String Name;
}

class Employee extends Person {}

class Client extends Person {}
Simple UML class diagram

Sequence Diagrams

One specifies a sequence diagram using pic macros to defineobjects and method invocations.The GNU plotutilspic2plot program can then process the sequence diagram to create aPNG, PNM, (pseudo)GIF, SVG, AI, Postscript, CGM, FIG, PCL, HPGL, Regis, or TEKdrawing.

The following is an example of a sequence diagram specification and theresulting UML diagram:

# Define the objects
object(O,"o:Toolkit");
placeholder_object(P);
step();

# Activation and messages
active(O);
message(O,O,"callbackLoop()");
create_message(O,P,"p:Peer");
message(O,P,"handleExpose()");
active(P);
return_message(P,O,"");
inactive(P);
destroy_message(O,P);
inactive(O);

# Complete the lifeline of O
step();
complete(O);
Simple UML sequence diagram

阅读更多
个人分类: uml
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

Automated Drawing of UML Diagrams

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭