Connections & Ports
This chapter focuses on how to model connections between the components of your system. You’ve already seen the basic component-to-component connection schema:
This is fine, but high-level. We just know that two components talk to each other and that’s it. What if we wanted to dig deeper, how about:
- What kind of
protocolis used to talk between those components? - Is
clienteven supporting that protocol? - Does
serverhas anyportfor the client to connect to?
Note
Programmers reading this probably think about
portsin terms of networking. In the case of this book, think about a more broad/generic definition of “something to connect to”.
While this model compiles without any errors, the model completion score points us towards things to specify further:
- There are 0
portsdefined - There are 0
messagesdefined
TODO: what the hell is “Connections 0/1”? Some bug prolly…
Defining & connecting ports
TODO: 0/4 ports, marked as unused or what? Why isn’t completion score up? Same issue with connections as before.
The work-computer system defines 2 usb-c ports on the component level. Now
we have more details about what exactly we’re connecting to. The component
states what port it exposes and the compiler will raise an error if you try to
connecting to a non-existing port. Consider having an inventory of components
from some iteration of your product, while designing a new version of that
product. Having ports specified inside components allows you to quickly see what
parts can be easily re-used and which ones will require changes at interface
level, or even need a complete rework.