Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Mastering UML with Rational Rose 2002.pdf
Скачиваний:
137
Добавлен:
02.05.2014
Размер:
9.68 Mб
Скачать

Chapter 10: Component View

We move now to the Component view of Rose. In the Component view, we'll focus on the physical organization of the system. First, we'll decide how the classes will be organized into code libraries. Then, we'll take a look at the different executable files, dynamic link library (DLL) files, and other runtime files in the system. We won't concern ourselves yet with where the different files will be placed on the network. We'll consider these issues in the Deployment view.

Exploring types of components

Creating components and mapping classes to components

Using Component diagrams

What Is a Component?

A component is a physical module of code. Components can include both source code libraries and runtime files. For example, if you are using C++, each of your .cpp and .h files is a separate component. The .exe file that you create after the code is compiled is also a component.

Before you generate code, you map each of your files to the appropriate component(s). In C++, for example, each class is mapped to two components—one representing the .cpp file for that class and one representing the

.h file. In Java, you map each class to a single component, representing the .java file for that class. When you generate code, Rose will use the component information to create the appropriate code library files.

Once the components are created, they are added to a Component diagram and relationships are drawn between them. The only type of relationship between components is a dependency. A dependency suggests that one component must be compiled before another. We'll look at this in more detail in the "Adding Component Dependencies" section later in this chapter.

Types of Components

In Rose, you can use several different icons to represent the different types of components. As we mentioned earlier, there are two primary types of components: source code libraries and runtime components. Within each of these two groups are a number of different component icons you can use. Let's start by looking at the source code library icons:

Component The Component icon represents a software module with a well−defined interface. In the component specification, you specify the type of component in the Stereotype field (e.g., ActiveX, Applet, Application, DLL, and Executables). See Table 10.1 in the stereotypes section for a discussion of the different stereotypes you can use with this icon.

360

Chapter 10: Component View

Subprogram Specification and Body These icons represent a subprogram's visible specification and the implementation body. A subprogram is typically a collection of subroutines. Subprograms do not contain class definitions.

Main Program The Main Program icon represents the main program. A main program is the file that contains the root of a program. In PowerBuilder, for example, this is the file that contains the application object.

Package Specification and Body A package is the implementation of a class. A package specification is a header file, which contains function prototype information for the class. In C++, package specifications are the .h files. In Java, you use the Package Specification icon to represent the .java files.

A package body contains the code for the operations of the class. In C++, package bodies are the .cpp files.

361