5 ms·
you can write spaghetti with every language in every framework. btw. razor pages doesn't mean that you need to write spaghetti code. I've seen tons of MVC code
by merb 8y ago
you can write spaghetti with every language in every framework.
btw. razor pages doesn't mean that you need to write spaghetti code. I've seen tons of MVC code where the view layer got way too much code.
most of the time it will help if people actually only put the bare minimum of code into the view layer. (only if/for/etc where absolute necessary)
- wokwokwok 8y agoSure, but... I suggest that it is a trade off in which functionality is exchanged for convention and simplicity...and perhaps not for good reasons, or in a way that encourages good outcomes by default. If I was under the impression the ASP.NET team was on the ball and agreed with the decision they were making, I'd be more prepared to run with it... but I'm not. For example, there's an open github issue discussing the concerns people have raised about the ASP.NET team suggesting that razor pages are better than MVC. Read it yourself and you'll be extremely familiar with the various opinions on the matter: https://github.com/aspnet/Docs/issues/6146 https://github.com/aspnet/Docs/issues/6146 This, is again, as I said before, an example of not everything that (specifically the ASP.NET team) does, being a good idea.
- merb 8y agowell most of these concerns are from people that actually never tried to run with razor pages, which is really sad. as said my background was basically 5 years or more working in mvc and even partially working on the framework itself. and I would say that Razor Pages is a good starting point for any application. currently I think both, Razor Pages AND MVC is important, but it's so easy to use both, so there is no problem. If something grows to much you can easily split it into the old traditional MVC paradigma, but actually most of the time I migrate directly to a web api instead of dotnet core mvc. (at the moment I have 2 mvc controllers, which are basically the same as web api 2 endpoints (no view/no model)) also razor pages is kind of MVVM which is common more (i mean in the javascript world more stuff is mvvm than mvc, not sure why java/c# can't follow that aswell?!) and more for UI related frameworks (which razor pages of course is) but most people didn't realized that on this github issue..
- giancarlostoro 8y agoExactly this, if you've got crazy logic going on it should be removed from the view and done in the controller. The only code in your view should aid displaying model data and defining the layout output. I usually do my best but of course there are exceptions, especially if using third party libraries for views.