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 130253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:55:08+00:00 2026-05-11T05:55:08+00:00

I just read a blog post that explains MVC with a banking analogy. I

  • 0

I just read a blog post that explains MVC with a banking analogy. I have a few months of experience with web application development with an MVC framework (CakePHP), so I get the basics, but I began to see a theme that made me think I’m taking a flawed approach to where I put my logic:

  • Fat models, skinny controllers
  • Keep as much business logic in the models as possible

In my app, models are anorexic and controllers are obese. I have all business logic in the controllers and nothing besides associations and validation rules in the models.

Scanning through my controllers, I can now identify a lot of logic that should probably go in a model:

  • The app has lists, which contain items, and the items can be ranked. The sorting logic which puts the list in ranked order is in a controller.
  • Similarly, items (Item model) also have images (Image model). Each item may have a default image (designated by image_id in the items table). When an item is displayed with its images, the default image should appear first. I have the logic that does this in a controller.
  • When a list is displayed, related lists are displayed in the sidebar. The logic to determine which lists are related is in a controller.

Now to my questions:

  1. With the examples I gave above, am I on the right track in thinking that those are instances of logic presently in a controller that belongs in a model?
  2. What are some other areas of logic, common to web apps, that should go into models?
  3. I’m sure identifying this problem and changing my design pattern is half the battle, but even if I decide to take those examples I gave above and try to move that logic to a model, I wouldn’t know where to begin. Can anyone point me in the right direction by posting some code here, or linking to some good learning resources? CakePHP specific help would be great, but I’m sure anything MVC will suffice.
  • 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. 2026-05-11T05:55:08+00:00Added an answer on May 11, 2026 at 5:55 am

    It’s a bit tough to give you the ‘right’ answers, since some of them deal with the specifics of the framework (regardless of the ones you are working with).

    At least in terms of CakePHP:

    1. Yes

    2. Anything that deals with data or data manipulation should be in a model. In terms of CakePHP what about a simple find() method? … If there is a chance that it will do something ‘special’ (i.e. recall a specific set of ‘condition’), which you might need elsewhere, that’s a good excuse to wrap inside a model’s method.

    3. Unfortunately there is never an easy answer, and refactoring of the code is a natural process. Sometimes you just wake up an go: ‘holy macaroni… that should be in the model!’ (well maybe you don’t do that, but I have :))

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

Sidebar

Related Questions

I just read this blog post and it stated that: Google is now working
I just read this blog post on Razor Templating in ASP.NET MVC 3. Put
I just read a blog which says ...methods that couldn’t be inlined previously because
I've just read on a blog that the UDID will not survive iOS 5.
I just read an article on www.songho.ca which indicates that a projection matrix is
I just read in Code Complete that you should not use exceptions for flow
I just read about SQL injection and found this function on the blog i
So, here is the discussion I have just read: http://www.mail-archive.com/delphi@delphi.org.nz/msg02315.html BeginUpdate and EndUpdate is
I recently read a blog post about having your code rely as little on
I recently read an interesting blog post on Anders Hejlsberg's arguments against AOP. The

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.