Object Oriented Programming Comes to Rails

decent_exposure helps you program to an interface, rather than an implementation in your Rails controllers.

Sharing state via instance variables in controllers promotes close coupling with views. decent_exposure gives you a declarative manner of exposing an interface to the state that controllers contain, thereby decreasing coupling and improving your testability and overall design.

via voxdolo/decent_exposure – GitHub.

It’s almost as if the program were composed out of some kind of discrete “objects”, which only communicated with each other via well-defined “interfaces”, and “encapsulated” their implementation details. It’s like a whole new paradigm of programming!

(Just in case anyone misses the joke, this is not an indictment of decent_exposure. It’s a commentary on just how broken the Rails Controller/View interface is and has always been. I find it ironic that one of the most OO languages in modern use, the notion of a public method interface has to be hacked into Rails controllers with a special syntax.)