Thursday, January 10, 2013

Code Smells & Solutions in Rails Applications

I came across an interesting presentation by Brandon Keepers at GitHub that he gave in June of 2012.  I didn't make it through the 35 minute video of the presentation, but there is also the slide deck. Scanning the rest of the presentation in the slide deck, I was delighted to see Brandon promoting appropriate separation of concerns with respect to the use of Rails and its components.

It's time to move away from Fat Models and get Domainy.  Use ActiveRecord to be the encapsulator of things specifically related to working with the database.  Build your domain model on top of that.

Gary Bernhardt of Destroy All Software fame promotes the same.

I liked Brandon's identification that test cases can illustrate where the code smells when the tests are too complex.  Spot on.