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 titled On 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 books Code Quality: The Open Source Perspective (Addison Wesley, 2006) and Code 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 by javadoctags.Running the UmlGraph doclet on the specification will generatea Graphvizdiagram 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 plotutils pic2plot 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值