Hints and Tips
Components allow you to encapsulate the parts of your system to reduce dependencies, make them explicit, and enhance replaceability and flexibility when the system must be changed in the future. A good component:
- Encapsulates a service that has a well-defined interface and boundary.
- Has enough internal structure to be worth describing.
- Does not combine unrelated functionality into a single unit.
- Organizes its external behavior using a few interfaces and ports.
- Interacts only through declared ports.
If you choose to show the implementation of a component using nested subcomponents:
- Use a moderate number of subcomponents. If there are too many to show comfortably on one page, use additional levels of decomposition in some of the subcomponents.
- Ensure that the subcomponents interact only through defined ports and connectors.
- Determine which subcomponents interact directly with the external world and model them with delegation connectors.
When you draw a component in the UML:
- Give it a name that clearly indicates its purpose. Name interfaces in the same way.
- Name subcomponents and ports if their meaning is not clear from their types or if there are multiple parts of the same type.
- Hide unnecessary detail. You don't have to show every detail of the implementation on the component diagram.
- Show the dynamics of a component using interaction diagrams.