MVC 的替代品是什么? [英] What's an alternative to MVC?

查看:39
本文介绍了MVC 的替代品是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我参与的每个项目都使用模型视图控制器架构,这就是我推出自己的项目的方式.有替代方案吗?否则如何创建具有持久存储和用户界面的应用程序?

Seems like every project I'm on uses a Model View Controller architecture, and that's how I roll my own projects. Is there an alternative? How else would one create an application that has persistent storage and a user interface?

推荐答案

MVC 已经存在一段时间了.这是经过时间考验和证明的模式.许多框架利用 MVC 模式.Martin Fowler 将 MVC 解构为:监督演示者被动视图.

MVC has been around for a while. It's a time tested and proven pattern. Many frameworks leverage the MVC Pattern. Martin Fowler has deconstructed the MVC into: Supervising Presenter and Passive View.

建筑师 Christopher Alexander 说得最好:

每个模式描述了一个问题一次又一次地发生在我们环境,然后描述解决这个问题的核心,这样你就可以使用它解决方案一百万次,没有曾经两次以同样的方式做.

Each pattern describes a problem which occurs over and over again in our environment and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.

我不确定您为什么要从 MVC 迁移.您是否遇到了 MVC 无法解决的问题?为了给您一个更好的答案,我们需要更多地了解您的问题域.

I'm not sure why you would want to move from MVC. Is there a problem you are encountering that MVC does not eloquently solve? To give you a better answer we need to know more about your problem domain.

在考虑模式/架构时要考虑的事项:如果您正在使用 Myspace 类型的架构,您需要一个健壮的架构 (MVC).如果您正在通过网络创建一个简单的 crud 界面 - 几乎任何事情都可以.

Things to take into account when considering patterns/architecture: If you are building something with a Myspace type architecture you'll need a robust architecture (MVC). If you are creating a simple crud interface via the web - almost anything will do.

对于不是 MVC 的 .Net Web 表单(我假设是 Web,因为您没有说厚客户端或 Web 客户端),维护它们是一场噩梦.使用几年以上的 Web 表单应用程序往往会变成大泥球.即便如此,开发人员还是发现了使用 MVC 和 Web 表单的方法.

For .Net Web forms (I am assuming web, since you didn't say thick or web client) which is not MVC, it was a nightmare maintaining them. Web Forms applications that lived more that a couple years tended to become big balls of mud. Even then developers discovered ways to use MVC with web forms.

具有讽刺意味的是,ASP.NET Web 表单中缺乏 MVC 架构是导致 ASP.Net MVC 框架.

Ironically, the lack of MVC architecture in ASP.NET web forms was one of the driving complaints that lead to the development of ASP.Net MVC framework.

根据经验,如果您不使用某些 MVCesk 方法,您的解决方案将变得难以维护和臃肿.这些应用程序将缓慢而痛苦地死去.

From experience if you don't use some MVCesk approach, your solutions become hard to maintain and bloated. These applications will die a slow painful death.

如果您的解决方案是一次性的小型项目,那么一定要把一些东西放在一起.哎呀,有一些工具可以生成从屏幕到数据访问层的所有内容.任何可以完成工作的方法.

If your solutions are small one-off projects, the by all means throw something together. Heck there are tools that will generate everything from the screens to the data access layer. Whatever works to get the job done.

这篇关于MVC 的替代品是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆