且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MVC与的WebForms

更新时间:2023-09-20 16:32:04

您不要随意一个或另一个之间作出决定;不丰满的MVC框架只是因为它是块新的孩子,每个人都在唱赞美它,尤其不要如果你熟悉用做Web窗体的事情。几乎每一个现有的系统将要使用旧的,更成熟的技术,并没有什么错的这一点。

You shouldn't arbitrarily decide between one or the other; don't plump for the MVC framework just because it's the new kid on the block and everyone's singing its praises, especially not if you're comfortable with doing things using Web Forms. Practically every existing system is going to be using the older, more established technology, and there's nothing wrong with that.

虽然它的真正的MVC框架确实允许的担忧更容易分离(毕竟,这就是MVC模式是),它也带来编写更多的HTML的责任,我觉得一个稍大的理解的网络是如何工作的;不一定是不合理的要求,但你可以认为它会稍微设置前几次你慢下来,大约使用它。

While it's true that the MVC framework does allow for even easier separation of concerns (after all, that's what the MVC pattern is for), it also brings with it the responsibility of writing more HTML, and I think a slightly greater understanding of how the web works; not necessarily an unreasonable requirement, but you could argue it'll slightly slow you down the first few times you set about using it.

说实话,我同意Web窗体要花很多冤枉高射炮的。当然,有很多神奇的背景回事,你得到了一些HTML输出的控制较少,但它不是完全不可能的风格和CSS(你最终使用!重要很多,也许),而且它也不是不可能得到的关注一些分离,即使它不符合什么可能是最纯粹的观点。您仍然可以使用MVC框架写pretty可怕code。如果你正在寻找快速拼凑的东西,你是好与Web窗体,然后你将能够做到这一点非常快,这没有什么可羞耻的,是吧?

To be honest, I agree that Web Forms takes a lot of undeserved flack. Granted, there's a lot of magic going on in the background, and you get less control over some of the HTML output, but it's not exactly impossible to style with CSS (you end up using !important a lot, perhaps), and it's also not impossible to get some separation of concerns, even if it doesn't meet the purist's view of what that might be. You can still write pretty horrible code using the MVC framework. If you're looking to throw together something quickly, and you're good with Web Forms, then you're going to be able to achieve that very quickly, and it's nothing to be ashamed of, is it?

这并不是说,当然,前提是你要坚持你的枪,而忽略MVC要么;这是一个很好的框架(实际上,这是一个的非常的很好的框架),它不会赋予你可能想从长远来看趁几个好处。你还必须记住,它不会自动废止,您了解了ASP.NET 2.0中的一切,无论是;很多配套建筑被接受的MVC框架,包括像会员提供商。

That's not to say, of course, that you should stick to your guns and ignore MVC either; it's a good framework (in fact, it's a very good framework) and it does confer several benefits which you might want to take advantage of in the long run. You also have to remember that it doesn't automatically nullify everything you learned about ASP.NET 2.0, either; a lot of the supporting architecture is embraced in the MVC framework, including things like the membership providers.