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

  • Home
  • SEARCH
  • 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 1110909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:27:55+00:00 2026-05-17T02:27:55+00:00

When building complex applications the controllers can start to get unwieldy and very large,

  • 0

When building complex applications the controllers can start to get unwieldy and very large, which may mean that you split them out into separate controllers. This may not be suitable as it will be reflected in the users experience. Ie. They will see the controller name in the URI.

For example: The default project that ships with MVC has an AccountController, that has actions for login, logoff, register etc.. which seems to violate the Single Responsibility Principle.

So the question is how to resolve this problem and separate out the concerns? An initial response could be just to create separate controllers. Ie.

AccountLoginController

AccountRegisterController

But this would not be a great experience from a customers point of view as it would effect the URI when requesting the resource.

A solution could be to have separate folders for each controller which contains separate class files for the action, each one with a single responsibility like so.

Controllers (folder)
    Account  (folder)
        Register.cs
        Login.cs
        Logout.cs
    AnotherController (folder)
        Actionfile.cs
        Actionfile.cs

The above would separate out the functionality and be highly cohesive.

So, this is a long explanation, but my questions are..

  • Has anyone implemented this before?

  • If so how do you go about it?

  • What are your thoughts regarding this pattern?

  • 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-17T02:27:56+00:00Added an answer on May 17, 2026 at 2:27 am

    It depends on what you mean by single responsibility.

    If you mean Authentication as a responsibility, then the out of the box controller is perfect just the way it is. Logging in, Logging out and Registering are all part of the same thing – Authentication. So it makes sense that their code is in the same controller.

    If you take the single responsibility principle to the ridiculous extreme, you would never have more than single classes with a single function in a single file.

    You have to find a balance between readability/maintainability vs separation of concerns. In this case, it is going too far.

    Also, remember that MVC is all about Convention over Configuration, meaning that if you name your controllers and views according to the convention, then they will be discoverable and you will have fewer configuration and routing issues.

    Having said that, if you are determined to have a non-conventional Controller Naming convention, so to speak, you can implement your own Controller discovery code which would allow you to use a different convention. From the article linked to above:

    public class ControllerConvention : TypeRules, ITypeScanner {
      public void Process(Type type, PluginGraph graph) {
         if (CanBeCast(typeof (IController), type)) {
         string name = type.Name.Replace("Controller", "").ToLower();
          graph.AddType(typeof(IController), type, name);
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Caching a complex application can get hairy very quickly. My question is do developers
I am trying to move a set of fairly complex C++ applications/libraries from building
For a testing usage of not very complex WPF applications I often don't make
I'm building a database and have run into a problem that I can't seem
We have a several large MFC applications which presently call a COM object to
Where can I find in-depth guidance for building complex WinForms Setup projects? To be
I'm building a MVC application which is a bit more complex than what I
When building a VS 2008 solution with 19 projects I sometimes get: The GenerateResource
Im building a web application which is a process management app. Several different employee
When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant

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.