How to Draw a Component Diagram in UML?

Component Diagrams show the types of software components in the system, their interfaces and dependencies. People often use UML Component Diagram in the following scenarios:

  • Show the structure of the code itself
  • Can be used to hide the specification detail (i.e., information hiding) and focus on the relationship between components
  • Model the structure of software releases; show how components integrate with current system design
  • Model source code and relationships between files
  • Specify the files that are compiled into an executable

How to create Component Diagrams?

The steps below outline the major steps to take in creating a UML Component Diagram.

  • Decide on the purpose of the diagram
  • Add components to the diagram, grouping them within other components if appropriate
  • Add other elements to the diagram, such as classes, objects and interfaces
  • Add the dependencies between the elements of the diagram

Creating a Component Diagram

  1. Click Diagram > New from the toolbar.
    Create new diagram
  2. In the New Diagram window, select Component Diagram, then click Next. You can use the search bar above to filter results.
    Select Component Diagram
  3. Name the diagram, then click OK. You will then see a blank diagram. We will name the diagram Component Diagram Tutorial in this tutorial.
    Name Diagram
  4. To create a component, select Component, then click any empty space on the diagram.
    New Component
  5. Rename the component by double clicking the component. In this case, we will be renaming this component Item.java.
    rename Component
  6. Repeat step 4 and 5 for more components. You will see something like this after creating all components:
  7. We can create some dependencies once the components are created. In this example, we are creating a dependency from Item.java to Loan.java. Click Item.java, then click and hold the resource button Resource Catalog, drag the cursor to Loan and release, select Dependency from the popup window. You will now see a dependency from Item.java to Loan.java.
    New DependencySelect Dependency
  8. Repeat step 7 for more dependencies.
  9. You will see something like this when you finished your diagram:

Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK