Hacker News new | ask | show | jobs
by obiefernandez 5282 days ago
Overly alarmist headline, although there are some good points of discussion in there, especially for Rails newbies. The article left a bad taste because it didn't elaborate on well-known solutions for the problems cited.

For instance, the sole problem mentioned with ActionController is the use of instance variables to communicate state to the view templates. The popular decent_exposure gem [1] eliminates this problem by giving you a declarative way to program to the controller's stated interface. It completely eliminates the need for using instance variables in your controller code.

[1] https://github.com/voxdolo/decent_exposure

2 comments

I'm glad Obie chimed in. Most of the points discussed in the article (like decent_exposure) are discussed in his book, The Rails 3 Way. Others, like presenters, have had recent RailsCasts about them.

Rails 3.1 seems to provide a "best of both worlds" when it comes to convention over configuration. It feels a lot more modular and configurable, yet still does most of the work for you. I don't feel Rails itself provides much friction, and areas that do are easily overcome with gems from the community.

why is it a problem anyway?
Use of instance variables to communicate state to views is known to lead to implicit and tight coupling between controller and templates (and become a nightmare to maintain over time)

DHH disagrees with this point of view because he considers templates to be methods of the Controller optimized for generating text. Hence use of instance variables is not a problem.