A component is a cohesive, opaque, replaceable, deployable, functional module of a larger system.
The larger system can be an engineered system such as a computer or a computer program or an organizational system such as a company, government, or military organization. Thus a component can be a hardware component, such as a device, microchip, or circuit; a software component such as a user interface, database, or message passing subsystem; or a component can be a business unit such as payroll, provider, or shipping.
Like a system, a system component has an internal/structural view and an external/functional/behavioral view.
A component's external/functional/behavioral view is specified by a set of provided interfaces (lollipops) and a set of required interfaces (sockets).
An interface is a set of related operations or services.
In the following diagram component A depends upon interfaces I2 and I3 and implements interface I1:
A component can be simple or composite:
Internally, a composite component, like a system, is a network of subcomponents. These subcomponents are connected through their interfaces. For example, the following diagram depicts a network of components in which component B realizes interface I2 which is needed by component A and component C realizes interface I3, which is also needed by A:
An e-commerce system such as Amazon.com can be viewed as a network of components:
Internally, a simple software component is implemented by a collaboration. A collaboration is a collection of classes that work together to implement the services specified in the component's provided interfaces.
UML provides some notational support for collaborations:
Inside the shipping collaboration we might find that a shipper keeps the method of shipping in a separate ShippingMethod object. When asked to ship a purchase to a customer, the shipper delegates to the shipping method object to decide if the purchase should be shipped by land, sea, or air:
Inside the billing collaboration we might find that the
Billing component delegates to a tax calculator to decide how much sales tax to
add to the invoice. This object determines if
A
The simplest simple component is implemented by a single class. The interface realized by this component is the set of all public fields and methods.
UML makes a distinction between components and component instances.
In the single class component an object is a component instance.
Software components are realized by artifacts (files usually) which are deployed on software platforms, which are hosted by hardware platforms. Platforms (called nodes in UML) communicate using protocols and communication links. Here's a UML component diagram combined with a UML deployment diagram showing these concepts: