首页 > 代码库 > UML实例--HELL_WORLD(六)
UML实例--HELL_WORLD(六)
Artifacts
工件
“Hello, World!” is implemented as an applet, so it never stands alone but instead is typically a part of some Web page. The applet starts when its enclosing page is opened, triggered by some browser mechanism that runs the applet’sThread object. However, it’s not the HelloWorld class that’s directly a part of the Web page. Rather, it’s a binary form of the class, created by a Java compiler that transforms the source code representing that class into an artifact that can be executed. This suggests a very different perspective of the system. Whereas all the earlier diagrams represented a logical view of the applet, what’s going on here is a view of the applet’s physical artifacts.
“Hello, World!”作为一个小应用程序执行,所以它不能单独成立,而只能是某些网页的一部分.当它依附的页面被打开,这个小应用程序就会启动,通过一些浏览器机制触发并运行这个小应用程序的Thread对象.然而,HelloWorld类并不是网页的一部分,相反,它是类的二进制形式,通过Java编译器创建,将这个类的源代码表示为可被执行的工件.这表明,这个系统的一个非常不同的视点.而所有早期的图表示了这个应用程序的逻辑视图,在这里显示的是应用程序的物理效应.
You can model this physical view using an artifact diagram, as in Figure 3-6.
你可以使用工件图构建物理视图模型.就像图3-6显示的那样.
The logical classHelloWorld is shown at the top as a class rectangle. Each of the other icons in this figure represents a UML artifact in the implementation view of the system. An artifact is a physical representation, such as a file. The artifact calledhello.java represents the source code for the logical classHelloWorld, so it is a file that may be manipulated by development environments and configuration management tools. This source code can be transformed into the binary applet hello.class by a Java compiler, making it suitable for execution by a computer’s Java virtual machine. Both the source code and the binary applet manifest -- physically implement -- the logical class. This is shown by the dashed arrows with the keyword <<manifest>>.
逻辑类HelloWorld被作为类矩形框显示在顶部.在这个图中的每一个其它图标代表着系统的实施视图中一个UML工件.一个工件是一个物理表示法,如文件.hello.java工件代表的是HelloWorld逻辑类的源代码,所以那是一个通过开发环境和配置管理工具控制的文件.这个源代码可以通过Java编译器变换成二进制形式的应用程序hello.class,以适用于计算机的Java虚拟机执行.包括源代码和二进制程序清单--物理实现--逻辑类.这个通过带有关键词<<manifest>>的虚线箭头表示出来.
The icon for an artifact is a rectangle with the keyword <artifact> above the name. The binary applet HelloWorld.class is a variation of this basic symbol, with its lines made thicker, indication that it is an executable artifact (just like an active class). The icon for the hello.java artifact has been replaced with a user-defined icon, representing a text file. The icon for the Web pagehello.html has been similarly tailored by extending the UML’s notation. As the figure indicates, this Web page has another artifact, hello.jpg , which is represented by a user-defined artifact icon, in this case providing a thumbnail sketch of the graphics image. Because these latter three artifacts use user-defined graphical symbols, their names are placed outside the icon. The dependencies among the artifacts are shown by dashed arrows.
在工件名称上标注了关键词<artifact> 的矩形框,是一个工件图标.这个二进制程序HelloWorld.class是一个变化的基本符号,带有的双重线,指示出它是一个可执行的工件(就像一个活动类一样).代表hello.java工件的图标已经用一个用户自定义的图标所替代,表示的是一个文本文件.代表网页hello.html的图标已经通过扩展UML的符号作了相似的调整.如图所示,这个网页有另一个工件,hello.jpg,通过一个用户自定义的工件图标表现,在这种情况下,提供了一个图形图像的缩略草图.因为后面的三个工件使用的是用户自定义的图形符号,它们的名称被放在了图标的外面.这些工件之间的依赖关系用虚线箭头表示.
Note:The relationships among the class (HelloWorld), its source code (hello.java), and its object code (HelloWorld.class) are rarely modeled explicitly, although it is sometimes useful to do so to visualize the physical configuration of a system. On the other hand, it is common to visualize the organization of a Web-based system such as this by using artifact diagrams to model its pages and other executable artifacts.
备注:类(HelloWorld)之间的关系,它的源代码(hello.java)和它的对象代码(HelloWorld.class)很少被明确地建模,尽管 这么做有时对可视化系统的物理配置很有用.另一方面,可视化基于网络系统的组织是很常见的,如通过使用工件图构建它的页面和其它可执行工件.