开发者

Determining if .NET MVC should be used

开发者 https://www.devze.com 2023-01-23 21:59 出处:网络
I am about to start a new project.I would like some indicators to determine if I should use ASP.NET MVC or not.

I am about to start a new project. I would like some indicators to determine if I should use ASP.NET MVC or not.

(Other than experience with ASP.NET MVC...)

What are some indicators that ASP.NET MVC model should be used when starting a project?

What are some indicators that ASP.NET MVC model should n开发者_StackOverflow社区ot be used when starting a project?


Hm. I thought better about that question, and I guess it would be acceptable to use WebForms if and only if:

  • Your team members have no idea of web standards, and they prefer to use Visual Studio for developing pages.
  • You don't care about TDD.
  • You don't care about object coupling and other "esoteric" SOLID principles.
  • You miss developing windows applications, and you want that web development be as close as possible of that experience.
  • You don't care about maximizing performance, or making session-less web applications.
  • You wanna make it fast and dirty.

If any of the above statements is false, I would recommend you to forget about WebForms and dive into ASP.NET MVC.

Edit:

There is also another reason for NOT using ASP.NET MVC:

  • You are somehow commited to WebForms (for instance, spent a lot of money on WebForms components or training).

This would invalidate any of the reasons above, unfortunately.


If you want or need testability, definitely go with MVC. That is pretty much the only area of MVC that is almost impossible in Webforms. Other than that it is totally subjective.

Both frameworks are pretty much equally applicable in most areas. In my opinion it comes down to one thing:

Do you prefer to work with a page and component-based framework (Webforms) or an action-based MVC framework (MVC obviously).

In my view Webforms are getting much more bad press than it deserves, and honestly it seems that it is simply come il faut these days to hate Webforms, and love MVC.

Both are simply a tool to reach your target, choose what you like the most. That's it.


I'd generally run with MVC these days. But webforms isn't that bad, and the 4.0 tweaks brings things much more in line with modern web standards and tools. One place they can really shine is intranet apps -- the disadvantages like poor SEO and viewstate either don't matter or become advantages. Drag-n-drop ajax is nice, many developers still do better using the ajax control toolkit over jquery.

On the testability side, I will agree that MVC is a bit more testable in the UI layer, but the meat of your application should be below that waterline. Moreover, there is a fair bit of black magic and voodoo in MVC (DefaultModelBinder anybody?) too. What you really need in both cases is true UI integration tests and they generally don't care either way.

So do what you know and love.


UI COMPLEXITY The main limitation of the mvc architecture is the absence of viewstate, it don't provide any integrated solution to manage the state of components of UI. The asp net webfom provide a integrated solution to manage it. So if you plan to realize UI with many widgets inside, the webform has a builtin solution to archive the problem (at the cost of a more complexity).

0

精彩评论

暂无评论...
验证码 换一张
取 消