Rails Hurts → Painless Rails
Rails itself doesn't do anything to help programmers organize code in large applications.
If you don't do anything as well, you're screwed up - everything gets intertangled and fragile. The development process, previously agile, becomes clunky.
…but we're aware!
Most of us are aware of the problem and take actions to resist:
- We have empirically figured out that certain features of Rails should be avoided, but we're not sure why are they so harmful
- We keep our controllers skinny, but this rule turns our models into junk drawers :(
- We read about SOLID principles and design patterns, but they barely give any answers. It is not even clear if they are applicable to Ruby and Rails at all
- We look for salvation in OOP. Assuming we don't know it enough, we read books from recognized gurus of the industry. But resulting solutions appear to be bulky and not as beautiful as we expect
- We introduce additional abstractions to beat complexity, but they bring unwanted overhead and complicate our code
The worst is that everyone has a different approach. Therefore, where you expect to see a more or less unified approach, everyone comes up with its own solution.
Rails community is like ancient Babylon – everyone speaks its own language
This contradicts the central idea of engineering - to develop a single optimal solution for every problem, and to stick to it.
What if there is a simple consistent approach which solves maim problems of Rails applications growth, and it brings almost no overhead?
Painless Rails approach
I am writing a book called "Painless Rails", where I describe such an approach. It has some quite interesting characteristics:
- It doesn't fight against Rails
- It brings very little overhead
- It uses Rails conventions
- It doesn't rely on a programmer's discipline
- It doesn't compromise the joy of development with Rails, as it often happens with alternative approaches
- It doesn't simply patches the Rails Way, but rather provides a conceptual upgrade to it
This book is here to help you achieve these things:
- Identify and fix most harmful flaws in your current Rails application
- Establish a solid foundation for your next Rails project
- Learn to look beyond code and realize how to organize concepts, not classes and methods
Meet the book:
Table of contents*
Chapter 1: Controversial smoothness of Rails way approach
- Masking complexity with callbacks and conditional validations
- Mixing internal with external
- Ignoring layers in Rails
- Mixing Application Logic and Business Logic
- The time-bomb effect
Chapter 2: Painless Rails foundation
- Domain Models
Chapter 3: Painless Rails frame
- Hierarchy of models
- The key part of REST
- Hierarchy of controllers
- Service Locator
Chapter 4: Painless Rails approach in practice
* The book structure and titles might differ in the final version
Who is this book for?
- You know that vanilla Rails is not enough for big projects
- You have tried multiple alternative approaches
- You are still not happy with what you get
If all of the above applies to you, then you will not regret buying this book.
- The price is only $65, but it will go up, once more content is added
- If you buy now, you get all the future updates of course.
- This is prerelease, although the book is already doing its job pretty well.
What do I get?
- The work-in-progress version of the book (83 pages in PDF format), containing first three chapters.
- Also, if you understand Russian, you get a bonus of 16 screencasts (2.5 hours) with Painless Rails approach description
- Access to private Telegram chat where you can ask questions about the approach
- All future updates
This book is going to help you to:
- understand the real meaning of Rails Way code, and its negative effects
- separate business logic from application logic
- line up the hierarchy of models and controllers
- start using lightweight services to describe business scenarios
- turn your models into Domain Models
- distinguish harmful gems from harmless
- isolate harmful gems effects if you want to keep using them
- recognize and avoid harmful Rails features and conventional techniques
- learn how to write cheap but efficient tests
Meet the author: Ivan Nemytchenko
- Has 15 years of experience in Web applications development
- Rails applications architecture explorer
- Occasional speaker and teacher
- Former GitLab developer advocate
The roots of the Painless Rails approach
The author of the approach described in the book is Kirill Mokevnin - CTO of Hexlet.io - a major online-learning platform for programmers (not only) in Russia.
Their platform is a six years old Rails application with:
- more than 300 models
- ~100 associations in the User model
- ~700 routes
- ~50K lines of Ruby code
- user base: 175000 learners
Kirill has managed to develop an efficient approach to web development using Rails, so that through the whole life of the project there were only 1-2 active developers.
I learned about that approach three months ago. The most enchanting discovery for me was that you don't have to fight against the framework. Even if you're introducing additional abstractions.
I was so impressed that I decided to share it with those who love Rails but are not satisfied with what it suggests out of the box today.