Inverting dependencies on a hexagonal application
The dependency inversion principle (DIP), as introduced by Robert C. Martin, states that high-level components should not depend on low-level components. Instead, both of them should depend on abstractions. At first glance, for some, it may not be so obvious to understand such a concept. After all, what do the high- and low-level components mean? And what kind of abstractions are we talking about?
A high-level component has a set of operations orchestrated to enable a major system behavior. A high-level component may rely on low-level components to provide a major system behavior. A low-level component, in turn, utilizes a specialized behavior that supports the goals of a high-level component. We call a piece of client code that acts as the high-level component because it depends on and consumes the functionalities provided by the low-level component.
The high-level component can be either a concrete or abstract element, while...