Layering and Clean Architecture
In this chapter, we explore the inherent concepts behind layering. Layering is a popular way of organizing computer systems by encapsulating major concerns into layers. Those concerns are related to a computer vocation, such as data access, instead of a business concern, such as inventory. Understanding the concepts behind layering is essential, as many concepts and applications leverage layers.
We start this chapter by exploring the initial ideas behind layering. Then, we explore alternative ways to structure our layered applications that can help us solve different problems. We use anemic models and rich models and expose their pros and cons. Finally, we quickly explore Clean Architecture, an evolution of layering, and a modern way to organize layers.
This chapter lays out the evolution of layering, starting with basic, restrictive, and even flawed techniques, and then gradually moves toward more modern patterns. This journey should help...