0

I have got into a debate with some other developers (aka my boss's), we are weighing up the pros and cons of a crud (create update delete and edit) controller in MVC vs a Single action controller (a separate controller for create, update, delete and edit).

I have pointed out that for a web application like ours which has roughly 50 webpages which are all crud, splitting the crud approach we have taken (ignoring the time it would take to actually do this), will not only make our project slower due to the additional 200 odd controllers which will be added, but that it will also increase the compilation time.

Can you help me please settle this, I have searched high and low on the internet and have found no examples of this anywhere.

I have found (Better to have huge Controllers, or many controllers, in MVC?) but this discusses the layout, where as I am arguing that the build time and speed of VS will increase, at least a bit, if not significantly.

Community
  • 1
  • 1
McShep
  • 491
  • 3
  • 14
  • more code , more bugs.... so the less controlers you have the less buggs you will have , and less rows to maintain etc. if you have 50 pages you should probably have 50 controllers handling those pages not one controller for each operation – Thorarins Aug 19 '16 at 07:44
  • 3
    At the end of the day, you should really ignore "run time performance" and especially ignore "compilation performance". Any real gains you can make in run time will be blown away by a few meters of network cable, or lord help you, a switch. Your primary concern should be towards the readability of your code. By organizing your methods into CRUD controllers you improve readability (at least to developers who understand OOP). – Aron Aug 19 '16 at 07:45
  • 1
    I think one possible consideration is how you will setup the **routing logics** if you split them up to 200 controllers – Kien Chu Aug 19 '16 at 07:46
  • I personally wouldn't split each CRUD task by controller, instead I only create a new controller when the overall context changes i.e. from looking at a Person viewmodel to looking at a PersonReport view model – JsonStatham Aug 19 '16 at 08:24
  • Readability and maintainability of your code Trumps compilation time every time, sad! – AD.Net Aug 21 '16 at 03:16

0 Answers0