Components in UML

In the following diagram Component1 realizes (or implements) Interface1 and requires Interface2, which is realized by Component2.

Modern UML favors using class icons with a component decoration or stereotype:

(I don't like this notation because it's hard to draw by hand.)

Collaborations

Often a component is implemented as a collection of objects that collaborate to realize the component's interfaces.

A collaboration is a set of objects together with a set of interactions between the objects.

An interaction is analogous to a scene from a play, objects (the actors) play roles (client, server, broker, etc.). In these roles the objects exchange messages with each other in a prescribed order. Examples of messages include synchronous or asynchronous method calls, replies (e.g., return values), and asynchronous signals (i.e., broadcast messages).

We use UML sequence diagrams to describe interactions: