我在哪里可以找到 MVC 的清晰示例? [英] Where can I find clear examples of MVC?

查看:31
本文介绍了我在哪里可以找到 MVC 的清晰示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一些关于 MVC 的内容,但我仍然不明白什么时候应该使用它们,什么时候不应该使用它们.我正在寻找明确的例子,比如如果你正在开发这个,那么你应该使用 MVC,就像这样"和如果你正在开发这个,你不应该使用MVC."我见过的大多数示例都依赖于已经实现了所有内容的复杂框架,您必须学习该框架并大量使用它才能了解真正发生的事情.对于许多程序员来说,诸如UI 业务逻辑"之类的措辞听起来像是营销术语——例如,这篇文章.

我意识到可能潜伏在阴影中的危险,因为 MVC 是一个概念,每个人都觉得他们最了解它,但没有人真正知道如何使用它,因为可能涉及很多变量,每个人都允许对如何将项目分解为模型、视图和控制器有不同的看法.那里有很多理论,但很少有明确的例子.我正在寻找的不是最好的"方法,因此不应将其视为主观的;我正在寻找不同的简单实现,以便我自己决定哪些是最好的方法.

简明扼要:有哪些好的在线资源可以展示在各种情况下使用 MVC 的利弊,并提供清晰的示例来帮助读者理解这个概念?

解决方案

IMO,最好的例子是代码和/或入门工具包.

Rob Conery 有一个 大量帖子 解释了如何使用 ASP.NET MVC 创建 MVC 站点.每一个都有一个视频教程,贯穿博客文章的讨论.

官方 ASP.NET MVC 站点也有一些 视频帖子,入门工具包(此处这里这里) 和 额外的酱汁来帮忙.

IMO,MVC 是网站的必经之路.没有喷出所有行话和营销口号,它确实将您的代码分解为漂亮的、独立的和定义的部分.这些部分中的每一个都可以进行测试..这确实有助于保护开发过程,因为您知道触摸系统的一个部分不会破坏另一个部分(因为测试在您最近的更改后全部通过),所以您可以放心.

您应该查看的其他博客:

I've read a couple of things about MVCs but I still don't understand when they should be used and when they shouldn't be used. I am looking for clear examples that say things like "if you're developing this then you should use MVC, like this" and "if you're developing this, you shouldn't use MVC." Most of the examples I've seen rely on complex frameworks which have already implemented everything and you have to learn the framework and use it a lot to understand what's really happening. To many programmers, phrasings such as "UI business logic" sound like marketing terms — for example, the words "Instead the View binds directly to a Presentation Model" are used in this post.

I am aware of the dangers that may lurk in the shadows as MVC is a concept and everyone feels like they know it best, yet nobody really knows exactly how to use it because there may be a lot of variables involved and everyone is allowed to have a different perspective on how to dissect a project into the Model, the View and the Controller. There is a lot of theory out there but very few clear examples. What I'm looking for are not "the best" ways of doing it so this should not be considered as subjective; I'm looking for different simple implementations that would allow me to decide on my own which are the best approaches.

Succinctly: What are good on-line resources that present pro and con arguments to using MVC in various situations and provide clear examples to help the reader understand the concept?

解决方案

IMO, the best examples are with code and/or starter kits.

Rob Conery has a great number of posts that explain how to to create an MVC site with ASP.NET MVC. Each one of these has a video tutorial which runs through the blog post discussion.

The official ASP.NET MVC site also has some video posts, starter kits (here, here and here) and extra sauce to help.

IMO, MVC is the way to go for Web Sites. Without spewing all the jargon and marketing speak, it really breaks down your code into nice, separate and defined sections. Each of these sections can also be tested .. which really helps protect the development process because you have peace of mind knowing that touching one part of the system doesn't break another (because the tests all pass after your latest change).

Other blogs which you should check out:

这篇关于我在哪里可以找到 MVC 的清晰示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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