Showing Components Working Together

Showing Components Working Together

If a component has a required interface, then it needs another class or component in the system to provide it. To show that a component with a required interface depends on another component that provides it, draw a dependency arrow from the dependent component's socket symbol to the providing component's ball symbol, as shown in Figure.

The ConversionManagement component requires the DataSource interface, and the BlogDataSource component provides that interface

As a presentation option for Figure, your UML tool may let you get away with snapping the ball and socket together (omitting the dependency arrow), as shown in Figure. This is actually the assembly connector notation, which is introduced later in this chapter.

Presentation option that snaps the ball and socket together

You can also omit the interface and draw the dependency relationship directly between the components, as shown in Figure.

You can draw dependency arrows directly between components to show a higher level view

The second notation (omitting the interface, shown in Figure) is simpler than the first (including the interface, shown in Figure), so you may be tempted to use that as a shorthand, but keep in mind a few factors when choosing how to draw component dependencies.

Remember that interfaces help components stay loosely coupled, so they are an important factor in your component architecture. Showing the key components in your system and their interconnections through interfaces is a great way to describe the architecture of your system, and this is what the first notation is good at, as shown in Figure.

Focusing on the key components and interfaces in your system

The second notation is good at showing simplified higher level views of component dependencies. This can be useful for understanding a system's configuration management or deployment concerns because emphasizing component dependencies and listing the manifesting artifacts allows you to clearly see which components and related files are required during deployment, as shown in Figure.

Focusing on component dependencies and the manifesting artifacts is useful when you are trying control the configuration or deployment of your system

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows