Slide 22
Slide 22 text
Once we know how to separate components by setting boundaries, we can organize these
components into layers. Layers are concentric and represent how fundamental (or high-level)
components are. At the core, we have the high-level policies, i.e. stable and abstract components
encapsulating our business rules. On the outer ring, we have the details, for example, unstable and
concrete GUI’s.
Source-level dependencies should be organized according to the dependency rule: outer layers should
depend on inner layers (at the source-level), and not vice versa. We can remove violations of the
dependency rule by setting boundaries as explained above.
Entities: objects containing critical business logic. For example, a bank could establish that no loans are
granted to customers not satisfying some credit score requirements. Entities may be shared across
apps in the same enterprise.
Use-cases: app-specific business rules. For example, the sequence of screens to execute a bank
transfer.
Interface adapters: Gateways, presenters and controllers. For example, this layer will contain the MVC
architecture of the GUI and also objects that transform data between the format of the database and
the use-cases.
Frameworks and drivers: web frameworks, database, the view of MVC.