Review: Growing Rails Applications in Practice
If you are a Rails developer with a few years under your belt and struggle with the occasional fat model, unwieldy controller and go berserk when you see the horrible mess of CSS we make, this book is for you.
It is published directly by the authors on LeanPub. Here is the link: Growing Rails Applications in Practice.
What is it about?
Rails gives our programs an implicit shape: ActiveRecord models hold domain logic, controllers orchestrate communication with the outside world, views hold forms, helpers can talk to views, and then there are CSS files. The amount of organization is minimal and works during the early duration of a project, but over time we find the control of the project slipping from our hands: the models become too fat, there is callback hell, the controllers seem to do too many things, and the CSS is a complete mess.
We develop coping mechanisms as we encounter them and over time a good developer will end up with a toolbox to manage this complexity. The authors of this book, Henning Koch and Thomas Eisenbarth, both from Makandra, the makers of Rails-LTS and Makandra Cards, have distilled the toolbox they built over years of working with Rails into this book.
They talk about namespacing - an under-appreciated technique in the Rails world, how to tease out PORO objects from ActiveRecord models, how to write clean, consistent controllers, and among others, how to use BEM to structure our CSS. Some of it reinforces existing wisdom about Rails code organization, and some of it taught me new tricks to manage large Rails projects.
Why is it relevant?
This is a common complaint from developers working on long-lived Rails projects: the codebase is too big, a tangled web of dependencies that are hard to reason about. And far too often the proposed solution is to split the large project into smaller ones. Wise advice, but it can be an extreme remedy.
Monolithic applications can go out of hand quickly if we don't pay attention. The reasons can be many: the Active Record pattern, Ruby's dynamic nature, and the inherent issues with monolithic systems. But when done right, monolithic applications can scale in both project complexity and team-size quite a bit before they need to be cut up into a finer grained architecture.
This book teaches how to do exactly that: building well-engineered monolithic systems that can be a delight to work on. Everything is described in the context of Rails, but the principles can apply to other programming situations as well.
Check out the book here: Growing Rails Application in Practice.