Section 12.3. Provided and Required Interfaces of a Component


12.3. Provided and Required Interfaces of a Component

Components need to be loosely coupled so that they can be changed without forcing changes on other parts of the systemthis is where interfaces come in. Components interact with each other through provided and required interfaces to control dependencies between components and to make components swappable.

A provided interface of a component is an interface that the component realizes. Other components and classes interact with a component through its provided interfaces . A component's provided interface describes the services provided by the component.

A required interface of a component is an interface that the component needs to function. More precisely, the component needs another class or component that realizes that interface to function. But to stick with the goal of loose coupling, it accesses the class or component through the required interface. A required interface declares the services a component will need.

There are three standard ways to show provided and required interfaces in UML: ball and socket symbols, stereotype notation, and text listings.

12.3.1. Ball and Socket Notation for Interfaces

You can show a provided interface of a component using the ball symbol introduced in Chapter 5. A required interface is shown using the counterpart of the ballthe socket symboldrawn as a semicircle extending from a line. Write the name of the interface near the symbols.

Figure 12-4 shows that the ConversionManagement component provides the FeedProvider and DisplayConverter interfaces and requires the DataSource interface.

The ball and socket notation is the most common way to show a component's interfaces, compared with the following techniques.

Figure 12-4. The ball and socket notation for showing a component's provided and required interfaces


12.3.2. Stereotype Notation for Interfaces

You can also show a component's required and provided interfaces by drawing the interfaces with the stereotyped class notation (introduced in Chapter 5). If a component realizes an interface, draw a realization arrow from the component to the interface. If a component requires an interface, draw a dependency arrow from the component to the interface, as shown in Figure 12-5.

Figure 12-5. The stereotyped class notation, showing operations of the required and provided interfaces


This notation is helpful if you want to show the operations of interfaces. If not, it's best to use the ball and socket notation, since it shows the same information more compactly.

12.3.3. Listing Component Interfaces

The most compact way of showing required and provided interfaces is to list them inside the component. Provided and required interfaces are listed separately, as shown in Figure 12-6.

Figure 12-6. Listing required and provided interfaces within the component is the most compact representation


This notation additionally has an <<artifacts>> section listing the artifacts, or physical files, manifesting this component. Since artifacts are concerned with how your system is deployed, they are discussed in deployment diagrams (see Chapter 15). Listing the artifacts within the component is an alternative to the techniques shown in Chapter 15 for showing that artifacts manifest components.

Deciding when to use which notation for required and provided interfaces depends on what you're trying to communicate. This question can be answered more fully when examining components working together.




Learning UML 2.0
Learning UML 2.0
ISBN: 0596009828
EAN: 2147483647
Year: 2007
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net