When Rails Abstractions Are Not Enough
In this chapter, we conclude our Rails Way research and prepare to enter the world of abstractions. First, we will discuss the limitations of the Rails MVC-based architecture layout, which lead to either controller- or model-layer bloats—an ever-increasing number of lines of code and growing conceptual overhead. Then, we’ll take off the Rails Way and add S to the equation—services.
We will discuss how services can help in keeping controllers and models thin but, at the same time, turn into a chaotic or poor abstraction layer. Finally, we will discuss how breaking services further into more specialized abstractions could help keep the code base in a healthy state and how to design such abstractions following the layered architecture principles.
We will cover the following topics:
- The curse of fat/thin controllers and thin/fat models
- Generic services and granular abstractions
- Layered architecture and abstraction...