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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:59:36+00:00 2026-05-11T23:59:36+00:00

In a few MVC projects I’ve been working on, it has become apparent that

  • 0

In a few MVC projects I’ve been working on, it has become apparent that there are a few problematic controllers that have organically grown into God classes – demi-gods each in their own domain, if you will.

This question might be more of a matter ‘what goes where,’ but I think it’s an important question with regards to SRP (Single Responsibility Principle), DRY (Don’t Repeat Yourself), and keeping things concise, “agile” — and I am not experienced enough (with this pattern and in general design) to be knowledgeable about this.

In one project, we have a NutritionController. Over time it’s grown to include these actions (many with their respective, GET, POST, and DELETE methods):

Index (home controller)
ViewFoodItem
AddFoodItem
EditFoodItem
DeleteFoodItem
ViewNutritionSummary
SearchFoodItem
AddToFavorites
RemoveFromFavorites
ViewFavorites

Then we have an ExerciseController, which will include many similar actions, such as the searches, and favorites actions. Should these be refactored into their own controller so that it’s something like so?

SearchController {
    SearchExercise
    SearchNutrition
    //... etc
}

FavoritesController {
    ViewNutritionFavorites
    AddToNutritionFavorites
    AddToExerciseFavorites
    EditNutritionFavorites
    EditExerciseFavorites
    //... etc
}

It just seems to me that if you break them out into separate controllers, you’re going to grow an unbelievably large dependency at some level to deal with the information that you will need. OR you are going to have a completely generic handling application that will be very difficult to handle since you will have to jump through so many hoops to get your desired effect (either at the M, V, or C level).

I am thinking about this the wrong way? For example, should I have a generic Favorites object and then let the controller decide what view to throw it to?

*Sorry for spelling out the acronyms — I’m doing so in case anyone else comes across this question and is clueless as to what those things are

EDIT:
All the logic I perform is pretty much handled in the service layers. For example, the controller will send the ‘new’ FoodItem to the service. If it already exists, or there’s an error with it, the service will bubble it back up to the controller.

  • 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-11T23:59:36+00:00Added an answer on May 11, 2026 at 11:59 pm

    I would break your first list up based on responsibility:

    HomeController

    • Index

    FoodItemController

    • ViewFoodItem
    • AddFoodItem
    • EditFoodItem
    • DeleteFoodItem
    • SearchFoodItem

    NutritionController

    • ViewNutritionSummary

    FavoritesController

    • AddToFavorites
    • RemoveFromFavorites
    • ViewFavorites
    • SearchFavorites

    Django‘s approach to MVC is to separate responsibilities into “applications”, each with their own models, controllers, and even templates if necessary. You’d have a Food app, a Nutrition app, a Search app, and a Favorites app, most likely.

    Edit: The OP mentioned that searching is more specific to each controller, so I’ve made those actions. However, searching may also be just a general global thing, so in those cases, a SearchController would be fine.

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

Sidebar

Related Questions

I am working on a few PHP projects that use MVC frameworks, and while
ASP.NET MVC has been discussed on this forum a few times. I'm about to
I've been working with ASP.NET MVC for the last few weeks, learning as I
I have a few projects coming up that have a number of endpoints or
I am building my first few projects with ASP.NET MVC, and I have a
I've been reading a few things about ASP.NET MVC, SOLID and so on, and
I've created a few html helper methods for asp.net mvc that I would like
I have a .NET solution containing two projects: An ASP.NET MVC project, 'Website' A
I have a solution with two relevant (to this question) projects, and a few
I've seen a few examples of RSS Feeds in ASP.NET MVC, like this ,

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.