Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:57:17+00:00 2026-05-23T17:57:17+00:00

So its a fairly noobish question. Im still coding a web spider and have

  • 0

So its a fairly noobish question. Im still coding a web spider and have lots of questions but the first one I want to ask is how do you decided whether a method should belong to a controller or a model.

I don’t want to bring my application into this as there are many specific “does this code belong in controller or model” questions whereas I’m hoping this question will just serve as a general guideline.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:57:18+00:00Added an answer on May 23, 2026 at 5:57 pm

    I’ve worked in many environments, in many languages, ranging from entirely procedural, to object-oriented but not MVC, to MVC with fat controllers and MVC with skinny controllers. I can only speak of my own opinions, but these are things I’ve learned over the years and opinions I’ve gained through experience and having to deal with the maintenance consequences of some of the early code I wrote (we all have a past!).

    I also know that many people will disagree with what I write here, as that is the nature of how we work 😉

    1. Fat controllers are generally bad. It probably indicates that you have model logic in your controllers and where models are used in more than one controller, there’s a good chance some of that logic is being needlessly duplicated.
    2. Controllers should give as little information as needed to their views, and the views should be able to “pull in” what else they need, by asking one or two core models for it (e.g. don’t worry about passing in a model and its associations as separate variables. Pass in the model and let the view fetch the associations if needed. I’ve worked on systems (in fact, I’d say, unfortunately, most systems) that pass 10’s, 20’s, 30’s of variables into a view, when many of those could simply have to been loaded on-demand by the view itself. I think Rails generally does a good job of encouraging a model-pull methodology, but I’m talking about MVC (on the web) as a broader concept.
    3. Views can use complex logic. Some projects I’ve worked on thought that because something in a view was more than a simple “for each” loop, it therefore needed to be stuffed into the controller. That is wrong. Your controller is then performing view logic. The view is code… let’s not hide that fact.
    4. Relating to point (3), don’t confuse “template” with “view” as a whole. The template is just part of your view.

    I’m drifting off-topic here, but in short, most of your logic should probably finish up in your models. Your models, well, model your application in terms of data and how that data changes. It’s therefore natural that this is where a lot of logic is placed. Your controllers only serve to transport information between the models and your end user (which just so happens, to be via the view).

    Quite a long-winded way to say “I agree with John”, eh? 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question...I am using an MVC structure to build my site (its fairly large,
Here's my first question at SO. I have a internal application for my company
I'm part way through building a fairly complex HTML5 web app, that retrieves its
I have a fairly simple MFC app that just defines its own sub-classes of
Has anyone looked at Yahoo's ASTRA ? It's fairly nifty, but I had some
I have a form showing progress messages as a fairly long process runs. It's
its out of question that a dao will not hold any state. however, for
When developing whether its Web or Desktop at which point should a developer switch
I think its fairly common practice these days not to include a mailto: tag
I'm doing a one-time import routine from one system to another. The first step

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.