Denys Poltorak
2 min readMar 20, 2024

--

"Modules on one layer can only interact with modules from the layers strictly below." - this is not always true. Quoting from the book Fundamentals of Software Architecture by Mark Richards: "Each layer in the layered architecture style can be either closed or open. A closed layer means that as a request moves top-down from layer to layer, the request cannot skip any layers, but rather must go through the layer immediately below it to get to the next layer (see Figure 10-3). For example, in a closed-layered architecture, a request originating from the presentation layer must first go through the business layer and then to the persistence layer before finally making it to the database layer."

If a layer is closed, it may extend its API with methods that forward requests to the layer below it without doing anything at all. An open layer can be avoided. Actually, there were "smart UI" applications where UI or frontend had access to the database.

The difference of complexity is that a closed layer becomes more complex by copying part of the API of the layer below it, it slows down the system because its forwarding methods are still called though they don't do anything useful, but the layer above it stays less complex. An open layer stays as simple as possible, but the programmers of the layer above need to learn APIs of the two layer which thay may access, namely the open layer and the one below it, thus it is harder to program in the layer above an open layer.

The entities and other similar stuff comes from the old book Domain-Driven Design by Eric Evans. It is nice to read because its ideas are everywhere now.

--

--

Denys Poltorak
Denys Poltorak

Written by Denys Poltorak

yet another unemployed experienced embedded / low-level C++ technical lead from Ukraine

Responses (1)