This is an adapted excerpt from Chapter 1 of Modular Rails: Architecture for the Long Game , my book on building maintainable Ruby on Rails applications using Rails Engines. "The goal of software architecture is to minimize the human resources required to build and maintain the required system." -- Robert C. Martin, Clean Architecture The Cost of Change Over Time Every Software Engineer that uses Ruby on Rails has lived this story. The application starts small. A handful of models, a few controllers, a test suite that runs in seconds. Adding a feature is straightforward -- you create a model, write a migration, build a controller, add some views. The framework guides you. Convention over configuration. Life is good. Then the application grows. The app/models directory fills up. The User model gains associations to everything. Service objects proliferate in app/services/ . Someone introduces an app/interactors/ directory. Then app/queries/ . Then app/decorators/ .…