0

I don't have real understanding of the MVC model or Architecture yet but what I read and see is that it separated the 'Concerns' that is the presentation UI and logical code, right? But I know that WebForms Architecture also has a code behind model which then separates the code and UI.

Is there something else also in MVC which further separates the stuff around?

7
  • I don't know enough about MVC to answer, but from what I've seen MVC code has a lot of mixing code and markup together. In fact, that's why I've avoided it thus far. So I'm surprised to see you suggest MVC separates the two. Commented Jan 15, 2011 at 16:30
  • 3
    @Jonathan Wood - You are mixing up the idea of putting code and markup together with separation of concerns (UI, business logic, persistence etc...) Commented Jan 15, 2011 at 16:32
  • @Jonathan there is HUGE amount of similar questions here already. take a look. and get a grip on mvc - that's really the only way to answer this question (by Yourself). Commented Jan 15, 2011 at 16:33
  • @Oded: Yes I certainly am. Markup is traditionally a UI "concern" while code is generally associated with business logic. Commented Jan 15, 2011 at 16:45
  • 2
    @Jonathan Wood - You have a deep misunderstanding of MVC. Yes, it's true that MVC "Views" have code in them, but that is only code that is used for presentation (ie code that either inserts data into the view, or modifies the view in some way based on the data). What "seperation of concerns" means is that the business logic code is seperated from the ui code. Commented Jan 15, 2011 at 17:16

4 Answers 4

1

The main difference between MVC and WebForms is that in WebForms it is the view that receives the request (/foo.aspx), while in MVC it is the controller (/controller) which will manipulate the model and choose the appropriate view to render. Another important difference is that all the HTTP Context stack (Request, Response, Session, ...) has been abstracted behind abstract classes and interfaces in ASP.NET MVC which allows for better separation of concerns and unit testability in isolation. You also have far more control over the generated markup in ASP.NET MVC in contrast to WebForms where the markup is essentially generated by server side controls.

Sign up to request clarification or add additional context in comments.

Comments

1

Code-behind is specifically what makes UI tightly coupled to business logic in WebForms -- the code-behind is part of the UI.

Using controllers instead of code-behind is one of the primary ways in which MVC decouples these concerns.

Comments

0

The easiest way to think about this is that the .aspx and code behind are essentially two different views of the same component, the UI. It's completely possible to use code behinds with MVC (if you're using the webforms view engine), but both the view and the code behind are considered part of the UI. The controller is a seperate entity, as is the model.

Comments

0

Code-behind is specifically what makes UI tightly coupled to business logic in WebForms -- the code-behind is part of the UI.

Only if you choose to let it.

Business logic will not be coupled to UI if you choose to have seperate business layer/tier and implment an appropriote UI layer pattern such as MVP/MVC/MVVM. Id argue a n-layer design with an MVP pattern in webforms can offer even greater seperation of concerns than asp.net MVC but requires alot more upfront design.

Asp.Net MVC forces better seperation out of the box. Its baked into it. This is good for developers who might not know any better. With webforms it is completly up to the architect/developer to select the level of sepearion required, a double edged sword because if you're experienced with the platform can do some great stuff, but if your new to it or coming from a classic asp style of development you may make a mess of it without some guidance.

Biggest plus I see for asp.net MVC over webforms isnt soc, or testability (as they can be acheived in webforms) it's the ability have better control over markup (if you need it) and the more web centric focus (again, if thats what you need).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.