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

Chapter 10: Component View

Figure 10.4: Mapping classes to a component

3.

Right−click the class to map.

4.

Select Assign from the pop−up menu.

OR

1.

In the browser, select the class to map.

2.

Drag the class to the desired component, either in the browser or on a diagram.

Adding Component Dependencies

The only type of relationship that exists between components is a component dependency. A component dependency suggests that one component depends on another. A component dependency is drawn as a dashed arrow between the components:

In this example, Component A depends upon Component B. In other words, there is some class in A that depends on some class in B.

These dependencies have compilation implications. In this example, because A depends on B, A cannot be compiled until B has been compiled. Someone reading this diagram will know that B should be compiled first, followed by A.

As with package dependencies, you want to avoid circular dependencies with components. If A depends on B, and B depends on A, you cannot compile either until the other has been compiled. Thus, you have to treat the two as one large component. All circular dependencies should be removed before you attempt to generate code.

The dependencies also have maintenance implications. If A depends on B, any change to B may have an impact on A. Maintenance staff can use this diagram to assess the impact of a change. The more components that a single component depends on, the more likely it is to be affected by a change.

Finally, the dependencies will let you know what may or may not be easily reused. In this example, A is difficult to reuse. Because A depends on B, you cannot reuse A without also reusing B. B, on the other hand, is easy to reuse, since it does not depend on any other components. The fewer components that a single component depends on, the easier it is to reuse.

To add a component dependency:

1.

Select the Dependency icon from the toolbox.

2.

372