Component Diagram Tutorial
Component diagrams are integral to building your software system. They help your team understand the structure of existing systems and then build new ones.
Easily make component diagrams, and any other type of UML diagrams, in Lucidchart's intuitive diagramming editor.Demo here Sign up free
What is a Component Diagram
The purpose of a component diagram is to show the relationship between different components in a system. For the purpose of UML 2.0--and for any time that we discuss components on this site-- we are referring to a module of classes which represent independent systems or subsystems that have an ability to interface with the rest of the system. There exists a whole development approach that revolves around components, called component-based development (CBD). In this approach, component diagrams allow the planner to identify the different components so the whole system does what it's supposed to do.
More commonly, in an OO programming approach, the component diagram allows a senior developer to group classes together based on common purpose so that the developer and others can look at a software development project at a high level.
Component Diagram Symbols and Notation
There are three popular ways to create a component's name compartment. You always need to include the component text inside the double angle brackets and/or the component logo. The distinction is important because a rectangle with just a name in it is reserved for classifiers (class elements).
As with the class notation, components also have an optional space to list interfaces, similar to the way you add attributes and methods to class notation. Interfaces represent the places where the groups of classes in the component communicate with other system components. An alternative way to represent interfaces is by extending symbols from the component box. Here is a quick run down of the most commonly used symbols.
- Provided interfaces 0--[component] - is a straight line from the component box with an attached circle. These represent the interfaces where a component produces information used by the required interface of another component.
- Required interfaces [component]-( is a straight line from the component box with an attached half circle. This is also represented as a dashed arrow with an open arrow. These represent the interfaces where a component requires information in order to perform its proper function.
An easy way to remember this is that the provided interface looks like a ball being thrown by the component, and the required interface look like a catcher's mitt ready to catch a ball.
In UML, a component diagram visually represents how the components of a software system relate to one another. To build one, try using Lucidchart’s custom component diagram shape library. Component diagrams should communicate:
- The scope of your system.
- The overall structure of your software system.
- Goals that it helps human or non-human entities (known as actors) achieve.
Why Make a Component Diagram?
Though component diagrams may seem complex at first glance, they can be invaluable in building your system. Component diagrams can help your team:
- Imagine the system’s physical structure.
- Pay attention to the system’s components and how they relate.
- Emphasize the service behavior as it relates to the interface.
Employing Component Diagrams
A component diagram in UML gives a bird’s-eye view of your software system. Understanding the exact service behavior that each piece of your software provides will make you a better developer. Component diagrams can describe software systems that are implemented in any programming language or style.
UML is a set of conventions for object-oriented diagrams that has a wide variety of applications. In component diagrams, the Unified Modeling Language dictates that components and packages are wired together with lines representing assembly connectors and delegation connectors. To learn more about UML and its uses, check out this guide to What Is UML.
Building Blocks of Component Diagrams
Component diagrams range from simple and high-level to detailed and complex. Either way, you'll want to familiarize yourself with the appropriate UML symbols. These are some shape types you will commonly encounter when reading and building component diagrams:
- Component - an entity required to execute a stereotype function. A component provides and consumes behavior through interfaces, as well as via other components. Think of components as a type of class. In UML 1.0, a component is modeled as a rectangular block with two smaller rectangles protruding from the side. In UML 2.0, a component is modeled as a rectangular block with a small image of the old component diagram shape.
- Node - nodes are hardware or software objects, which are of a higher level than components. Boxes represent nodes in Lucidchart.
- Interface - show input or materials that a component either receives or provides. Interfaces can be represented with textual notes or symbols—such as the the lollipop, socket, and ball-and-socket shapes.
- Port - symbolized with a small square, ports specify a separate interaction point between the component and the environment.
- Package - groups together multiple elements of the system. Packages are represented by file folders in Lucidchart. Just as file folders group together multiple sheets, packages can be drawn around several components.
- Note - this allows a developer to affix a meta-analysis to the component diagram. Notes look like sticky notes in Lucidchart.
- Dependency - shows that one part of your system depends on another. Dependencies are represented by dashed lines linking one component (or element) to another.
Component Diagram Examples
Here is a simple component diagram putting together all the parts that we have covered. In the example, we have 3 simple components that work together to create a whole system. You might remember this system from elementary school.
The example above uses UML 1.x notation for the the required interface because Lucidchart currently doesn't support the half circle shape. Each component is a complicated subsystem that interfaces with another component by producing a requirement needed by another component. The Lucidchart shape library can help you create any component diagram using our online UML tool.
More Component Diagram Examples
- How to draw a Component diagram
- Component diagram for an ATM system
- Component diagram for hospital management system
- Component diagram for library management system
- Component diagram for online shopping system
Use Lucidchart to collaborate and create UML diagrams when you start an account for free today! No plugins or download required.