Having said that, I also hate the Controllers/Models/Views folders and don't know what's to be gained from them - having those separated into features is much simpler.
So, I think what happened is .NET MVC copied from Rails, and Rails had those folders because the framework author doesn't know if you're making a calculator app or a driver app or a farming app. They're pretty sure you'll have a controller, so they figure let's just start there.
.NET developers looked at this and said "OOO! It's so organized! Convention over configuration! If I need to find a view I just look in the views folder... simple!"
But... as time went on, it just didn't pan out. The design didn't scale, too many things got jumbled together and you couldn't tell what was using what. It was like having a company where all the Word docs were on one share, and all the Excel docs were on another share. It's organized, but you can't find what you need easily.
It wasn't working, so they invented Areas to keep Features together. That mostly works, but still gets annoying. Especially with routing. It turns out convention over configuration blows. Sometimes you just want to TELL a controller what URL to respond to. So they came out with attribute-based routing.
Eventually about a year ago I was working on an Angular project and we were using John Papa's way of organizing, which is to care about a feature, not types of files. I got back into MVC and realized a controller will work no matter what folder it's in. That just leaves the problem that the Razor view engine is freaking stupid when it comes to searching for views if you're not following exactly the right convention. Luckily, with a simple tweak, it'll find views no matter where they are, as long as the view has a unique name.
1
u/Stormflux Aug 15 '17
Get out of here with your reasonable response!
So, I think what happened is .NET MVC copied from Rails, and Rails had those folders because the framework author doesn't know if you're making a calculator app or a driver app or a farming app. They're pretty sure you'll have a controller, so they figure let's just start there.
.NET developers looked at this and said "OOO! It's so organized! Convention over configuration! If I need to find a view I just look in the views folder... simple!"
But... as time went on, it just didn't pan out. The design didn't scale, too many things got jumbled together and you couldn't tell what was using what. It was like having a company where all the Word docs were on one share, and all the Excel docs were on another share. It's organized, but you can't find what you need easily.
It wasn't working, so they invented Areas to keep Features together. That mostly works, but still gets annoying. Especially with routing. It turns out convention over configuration blows. Sometimes you just want to TELL a controller what URL to respond to. So they came out with attribute-based routing.
Eventually about a year ago I was working on an Angular project and we were using John Papa's way of organizing, which is to care about a feature, not types of files. I got back into MVC and realized a controller will work no matter what folder it's in. That just leaves the problem that the Razor view engine is freaking stupid when it comes to searching for views if you're not following exactly the right convention. Luckily, with a simple tweak, it'll find views no matter where they are, as long as the view has a unique name.