Are MVC and Webforms (with code-behind) paradigms mutually exclusive?

0

My question comes from an instructor's explanation that the MVC standard applied to the presentation layer, but when I came across #

    
asked by anonymous 01.06.2016 / 13:11

1 answer

2

MVC and WebForms are design patterns or architectural patterns as some consider, but are not paradigms.

3 Layers has nothing to do with this. It's too generic a term to define anything. You can apply these three specific layers shown in the question referenced with MVC, with WebForms and in many other ways. This is orthogonal. But it does not make sense.

In thesis en possible to use MVC and WebForms together . It does not make much sense, it would only happen in a legacy system that is making the transition to the other pattern. Or the programmer has no idea what he's doing. It is not very easy to make it work right, but it is possible. At bottom there will be an integration between the parties rather than being one thing. Technically they are not mutually exclusive, but in practice they end up being.

The question and answer referenced shows that DAL and BLL are often merged into the MVC. And Controller and View are heavily integrated into WebForms (well, that does not show so clearly, but it does).

In MVC the business rules stay in Model . If someone separates your data structure and rules, you are creating two layers for the Model . There are some who argue this, some people find it disgusting.

The Controller handles the application flow. Some people consider that application rules that go beyond the flow must be separated into another layer of service. Others find it disgusting. Some people put business rules here. Some people find this very strange.

The View of MVC works much more decoupled than the WebForms equivalent. In the latter you can find application and even business rules (via code-behind ), especially when the programmer is lost.

There are advantages and disadvantages to everything. Whoever follows fixed rule and says "this can or can not" has already started wrong. There are some things that are rarely advantageous, of course, but you have to understand in depth what you are doing, the consequences of all decisions, so the decision will be more correct, which is the only thing that matters. Attempting rules imposed by third parties does not help at all.

    
01.06.2016 / 13:49