A component diagram is a modular part of a system that encapsulates its contents and is replaceable within its environment. A component in UML 2 is represented as a rectangle with optional compartments stacked vertically. A component diagram is a collection of vertices and arcs that commonly contain components, interfaces, and relationships such as dependency, aggregation, constraint, generalization, association, and realization. It could also include notes and constraints. Component diagrams differ in their nature and behavior. Component diagrams are used to represent the physical characteristics of a system.