Modern software architecture is full of metaphors—and none may be as visually striking as the Onion Architecture. But what does it really mean when we talk about “layers,” “abstractions,” and “interfaces”? In this article, we’ll unravel these concepts and explore the foundational principles that shape robust, flexible systems. Peeling Back the Onion The Onion Architecture… Continue reading The Onion, the Layer, and the Interface
Category: Design Patterns
Generic Discriminator and Factory
As discussed in the Open-Closed Principle article, the final solution included an EmailSender class, that acted as the orchestrator, and required as dependencies a CurrentDayProvider and an EmailSenderFactory. The EmailSender class looked like this: The CurrentDayProvider was not the most complicated class ever: And the EmailSenderFactory was pretty standard containing the decision logic based on… Continue reading Generic Discriminator and Factory
Substitute Switch-Case With Data Structures
As discussed in the Open-Closed Principle article I suggested that in some certain situations, the decision on what email sender type to instantiate in the factory, can be represented in a data structure, instead of using switch-case (or if-else) structures. I will paste the code here, because the changes are not major, and then I’ll… Continue reading Substitute Switch-Case With Data Structures