A component diagram describes the organization and wiring of the physical components in a system. Component diagrams are often drawn to help model implementation details and double-check that every aspect of the system's required functions is covered by planned development. In the first version of UML, components included in these diagrams were physical: documents, database table, files, and executables, all physical elements with a location. In the world of UML 2, these components are less physical and more conceptual stand-alone design elements such as a business process that provides or requires interfaces to interact with other constructs in the system. The physical elements described in UML 1, like files and documents, are now referred to as artifacts. A UML 2 component may contain multiple physical artifacts if they naturally belong together.
Steps to Creating a Component Diagram
- Take stock of everything needed to implement the planned system. For example, for a simple e-commerce system, you'll need components that describe products, orders, and customer accounts.
- Create a visual for each of the components.
- Describe the organization and relationships between components using interfaces, ports, and dependencies.
Basic Component Diagram Symbols and Notations
A component is a logical unit block of the system, a slightly higher abstraction than classes. It is represented as a rectangle with a smaller rectangle in the upper right corner with tabs or the word <component> written above the name of the component to help distinguish it from a class.
An interface (small circle or semi-circle on a stick) describes a group of operations used (required) or created (provided) by components. A full circle represents an interface created or provided by the component. A semi-circle represents a required interface, like a person's input.
Draw dependencies among components using dashed arrows.
Ports are represented using a square along the edge of the system or a component. A port is often used to help expose required and provided interfaces of a component.
What's the Difference Between a Package Diagram and a Component Diagram?
Package diagram elements are always public, while component diagram elements are private.