The Unified Modeling Language User Guide SECOND EDITION [Electronic resources]

Grady Booch, James Rumbaugh, Ivar Jacobson

نسخه متنی -صفحه : 215/ 25
نمايش فراداده

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's THRead 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.

You can model this physical view using an artifact diagram, as in Figure 3-6.

Figure 3-6. HelloWorld Artifacts

Artifacts are discussed in Chapter 26 .

The logical class HelloWorld 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 called hello.java represents the source code for the logical class HelloWorld, 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 manifestphysically implementthe logical class. This is shown by the dashed arrows with the keyword «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, indicating 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 page hell205 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.

The UML's extensibility mechanisms are discussed in Chapter 6 .

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.