As the first step in mapping the project's architecture, we will begin by creating a UML component diagram. The main goal here is to identify and describe the structural connections between the various components that comprise our system.
A component is defined as an encapsulated standalone unit that constitutes an integral part of a system or a sub-system. Components communicate with each other by exposing and consuming one or several interfaces.
One key point of component-based design is that components should always be considered as abstract, logical entities that expose a particular behavior. This design approach is closely aligned with the SOLID principles and offers us the flexibility to freely change or even swap component implementations at any point throughout the project's development.
One key point of component-based design is that components should always be considered as abstract, logical entities that expose a particular behavior. This design approach is closely aligned with the SOLID principles and offers us the flexibility to freely change or even swap component implementations at any point throughout the project's development.
The following diagram breaks down the Links 'R' Us project into high-level components and visually illustrates the interfaces exposed and consumed by each one of them:
Figure 1: The UML component diagram for the Links 'R' Us project
In case you are not familiar with the symbols used by this type of diagram, here is a quick explanation of what each symbol represents:
- Boxes with two port-like symbols on the side represent components.
- Components can also be nested within other components. In that case, each sub-component is encapsulated within a box that represents its parent component. In the preceding diagram, Link Filter is a sub-component of Crawler.
- A full circle represents an interface implemented by a particular component. For instance, Search is one of the interfaces implemented by the Content Indexer component.
- A half-circle indicates that a component requires a particular interface. For example, the Link Extractor component requires the Insert Link interface implemented by the Link Graph component.
Now that we have mapped out a high-level view of the system components required for constructing our project, we need to spend some time and examine each one in a bit more detail.