UML实例--HELL_WORLD(三)



This class diagram captures the basics of theHello, World! application, but it leaves out a number of things. As the preceding code specifies, two other classes----Applet andGraphics----are involved in this application and each is used in a different way. The classApplet is used as the parent ofHelloWorld , and the classGraphics is used in the signature and implementation of one of its operations,paint . You can represent these classes and their different relationships to the classHelloWorld in a class diagram, as shown in Figure 3-2.

 

图3-1显示的类图捕获的是你好,世界!应用的基础信息,它省略了许多东西.作为预定义,另两个类--AppletGraphics--在这个应用被使用到,并且使用的方式不同.Applet类是HelloWorld的父类,Graphics作为识别标志被使用,并实现了它的一个操作paint.你可以在一个类图中,表达这些类和它们与类HelloWorld的不同关系.如图3-2所示.

The AppletandGraphics classes are represented graphically as rectangular icons. No operations are shown for either of them, so their icons are elided. The directed line with the hollow arrowhead fromHelloWorldtoAppletrepresents generalization, which in this case means thatHelloWorld is a child ofApplet . The dashed directed line fromHelloWorld toGraphics represents a dependency relationship, which means thatHelloWorld usesGraphics.

Applet类和Graphics类的图形表示符号是一个矩形图标.在这个应用中因没有用到它们的操作,所以省略了它们的图标.带有空心箭头的有向线从HelloWorld指向Applet,表示的是通用关系,含义是在这里HelloWorld继承自Applet.从HelloWorld指向Graphics的虚线指示线表达一种依赖关系,含义是HelloWorld使用Graphics

 

This is not the end of the framework upon whichHelloWorld is built. If you study the Java libraries forApplet andGraphics , you will discover that both of these classes are part of a larger hierarchy. Tracing just the classes thatApplet extends and implements, you can generate another class diagram, shown in Figure 3-3.

 

HelloWorld之上构建的框架并没有结束.如果你为了AppletGraphics而研究Java库,将会发现这两个类是一个大的层次的一部分.跟踪Applet 类的扩展和实现,可以产生另一个类图,如图3-3所示.

 

 

Note: This figure is a good example of a diagram generated by reverse engineering an existing system. Reverse engineering is the creation of a model from code.

备注:这个图是通过逆向工程将已存在的系统转换成图的非常好的例子.逆向工程的含义是从代码创建模型.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值