Read my latest article: Planet Argon Blog (posted Wed, 17 Feb 2010 15:11:00 GMT)

Put Your Controllers on a Diet already!

Posted by Robby Russell Tue, 19 Jun 2007 13:16:00 GMT

6 comments Latest by fast diet Sun, 01 Mar 2009 12:21:03 GMT

If you’re working with Ruby on Rails and are looking for ways to improve your existing code base, I would encourage you all to read the following blog posts.

Hopefully… you’ve already read each of them and as a result… put your controllers on a diet.

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    Dan Wed, 20 Jun 2007 04:24:14 GMT

    Are there performance increases in having smaller controllers? I understand that moving a a find method out of the controller into the model may look nicer, but it seems to me that it is an extra step. Why is doing it this way better? Thanks.

  2. Avatar
    Robby Russell Wed, 20 Jun 2007 05:45:12 GMT Recommend me on Working with Rails

    Dan,

    In general, you’re not likely to find the application speed change much if the code is in the controller or the method. What is being advocated is a cleaner way of developing MVC applications. If we start looking at our Models as a set of APIs that interact with our data source, we can call upon their services and get what they provide us. We provide them with some parameters and they return it. By reducing the amount of code in our controllers, we’re also able to test the behaviour of our models much more efficiently. The more business logic that you can keep in your models.. the better. Perhaps there needs to be more discussion about what is and isn’t business logic.

  3. Avatar
    Dan Wed, 20 Jun 2007 14:01:26 GMT

    That explanation makes perfect sense. As someone new to Rails I found myself using models to declare relationships and do validation but not much else. I think many people like myself would find articles about business logic very useful. Thanks.

  4. Avatar
    Roypxo Tue, 14 Aug 2007 16:30:52 GMT

    http://adbrwsrfqwffa.host.com desk3 [url=http://adbswsrfqwffa.host.com]desk4[/url] [link=http://adbawsrfqwffa.host.com]desk6[/link]

  5. Avatar
    fast diet Sun, 01 Mar 2009 12:20:54 GMT

    The Slim Fast Diet has been around for over two decades. This simply shows that the Slim Fast Diet is really a popular form of diet and it is definitely the most popular diet shake ever existed.

  6. Avatar
    fast diet Sun, 01 Mar 2009 12:21:03 GMT

    The Slim Fast Diet has been around for over two decades. This simply shows that the Slim Fast Diet is really a popular form of diet and it is definitely the most popular diet shake ever existed.

Share your thoughts... (really...I want to hear them)

Comments