1. Beyond
The Rails Way
Andrzej Krzywda
http://rails-refactoring.com
2. Why is Rails
business-friendly?
• Quick to produce a prototype
• Prototypes are production-ready enough
• Easy to add new features
• Possible to turn a prototype into proper
production app
4. Why is Rails not business-friendly?
• Because of The Rails Way
• Business loves the speed of adding new features
• … but loves predictability even more
• There’s no predictability with The Rails Way
5. The Rails Way
• Scaffold-like code in controllers/views
• ActiveRecord goes all the way up to the view
• features implemented with external gems
• external gems assume ActiveRecord in the views
• all models connected to each other with associations
• non-trivial things implemented with callbacks, filters, state-machine, STI, validations
• some JS/Coffee on top of the server-rendered html
• one monolith app
• Convention over Configuration
• Magic (relying on meta)
• Don’t Repeat Yourself
• “We’re 95% done with this app, can you help us finish it?”
6. When is The Rails Way
good?
• for business/coding people to prototype
• for less-experienced developers
• to quickly get a result
• for geniuses
• they will handle any code
• mostly-CRUD
• logic-less apps
7. When is The Rails Way bad?
• advanced developers
• complex business logic
• long-living business processes (like order)
• multiple teams
• predictable speed of work
25. DRY examples
• It’s OK to have different User classes for
authentication, storage and for presentation
• It’s OK to duplicate some code in controllers/services
instead of relying on the controller filters
26. The Next Way is just one
possible set of techniques