- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我公司,我们将使用ASP.NET MVC建立一个新站点。我的老板(市场营销人员)想了解有关该技术的更多信息,所以我试图找到一个真正好的,简单且具有教育意义的MVC概念介绍,但没有任何运气。他们中的大多数都需要大量的编程基础知识。
对于优质视频,幻灯片或其他任何建议?
最佳答案
克雷格·斯特朗(Craig Strong)撰写了一篇不错的文章,介绍了有关MVC的总体知识以及如何解释其对业务的好处。在此处检查:Updated link。
Define MVC in layman’s terms
Remember you’re technically minded and close to the code. MVC to youis as clear as day, but saying to the business ‘Model, View,Contoller’ could give them the impression that you are suffering fromsome form tourette syndrome. MVC won’t mean much to the business evenafter you define them in relation to the code. To get the business tounderstand why this is the answer and least of all what it is, can bemore of a task than expected in my experience. Even some fellowdevelopers have difficulty understanding this on occasion.
To get the listener to understand what MVC is and why it works what Ihave tried in the pass is to apply MVC to a different industries wherethe listeners have had more involvement. An example that has workedfor me in the past in a comparison to the property or even thevehicles. Most people have had dealing’s with builders, carpenters,plumbers, electricians or have watched the flood of property shows onthe TV. This experience is a good platform to use and to explain whyseparation such as MVC works. I know you’re probably thinking thatwon’t work as it’s not the same as in software, but remember you’renot trying to train the business to become developers or have an indepth understanding of MVC, simply explaining to them that separationin production is required and that’s what an MVC structure offers.
To give an example of how you could describe this I have very brieflyexplained how separation works in property. Keep in mind this isfocused on using the system not developing which could be a completelydifferent angle of explanation.
View
The view in MVC is the presentation layer. This is what the end userof a product will see and interact with. A system can have multipleviews of all different types ranging from command line output torendered HTML. The view doesn’t consist of business logic in mostclear designs. The interface is fit for purpose and is the area ofinteraction. Therefore you could simply output HTML for consumers tointeract with or output SOAP/XML for businesses to interact with. Bothuse the same business logic behind the system otherwise known as themodels and controllers.
In the world of property you could think of the view as the interiorof a property or the outer layer of a property that the inhabitantsinteract with. The interior can be customised for purpose and the sameproperty can have many different types of tenants. For example aproperty of a particular design could contain residential dwellings.The same internal space could easily be used as office space, wherealthough in the same property has a different purpose. However theproperty structure is the same. Therefore the environment in which theusers interact does not interfere with the structure of the building.
Controllers
The controller is where the magic happens and defines the businessapplication logic. This could be where the user has sent a responsefrom the view, then this response is used to process the internalworkings of the request and processes the response back to the user.Taking a typical response where a user has requested to buy a book.The controller has the user id, payment details, shipping address anditem choice. These elements are then processed through the businesslogic to complete a purchase. The data is passed through the systeminto the model layer and eventually after the entire request satisfiesthe business definitions, the order is constructed and the userreceives their item.
If we compare this to a property, we could compare the ordering of abook online to turning on a light switch. A tenant will flick theswitch to on just like ordering a book. The switch itself is anelement in the view layer which sends the request to the controllerjust like clicking a checkout button on a web site. The business logicin this case is what the electrician installed and are embedded withinthe property designs. The switch is flicked, which completes thecircuit. Electricity runs through all the wires including the fuse boxstraight through to the light bulb. Just like the user receiving abook, in this case the tenant receives light. The whole process behindthe scenes involving the electricity cabling is not visible to the thetenant. They simply interact with the switch within the space and fromthere the controller handles the request.
Models
The models in MVC are the bottom most layer and handle the core logicof the system. In most cases this could be seen as the layer thatinteracts with the data source. In systems using MVC, the controllerwill pass information to the model in order to store and retrievedata. Following on from the example above controller definition, thisis where the order details are stored. Additional data such as stocklevels, physical location of product of the book amongst many thingsare all stored here. If that was the last book in stock ordered, thenext request for this item may check if it’s available and disallowthe order as the item is no longer available.
Sticking with our example of turning on a light switch, this level inour structure could be the electricity supply. When the tenant flicksthe switch, the internal circuit must request electricity to power therequest which is similar when the user requested data from thedatabase, as in data is needed to process a request. If the dwellingisn’t connected to an electric supply, it cannot complete the process.Business benefits from using MVC
After you get the message across explaining what MVC is, you will thenhave to see what benefits can be obtained from it. I’m not going to gointo a huge amount of detail here are I’m sure you can apply benefitsmore accurately which are directly related to you actual situation. Tolist just some of the common benefits of an MVC based system here area few examples:
- Different skill levels can work on different system levels. For example designers can work on the interface (View) with very littledevelopment knowledge and developers can work on the business logic(Controller) with very little concern for the design level. Then theysimply integrate together on completion.
- As a result of the above separation projects can be managed easier and quicker. The designer can start the interfaces before thedeveloper and vice versa. This development process can be parallel asopposed to being sequential therefore reducing development time.
- Easy to have multiple view types using the same business logic.
- Clear route through the system. You clearly know where there different levels of the system are. With a clear route of the system,logic can be shared and improved. This has added security benefits asyou clearly know the permitted route from the data to the user and canhave clear security checks along the route.
- Each layer is responsible for itself. (Relates to point 1) This means that you can have clean file structure which can be maintainedand managed much easier and quicker than a tightly couple system whereyou may have lots of duplicate logic.
- Having a clear structure means development will be more transparent which should result in reduced development time,maintenance problems and release cycles if applied properly.
关于asp.net-mvc - 在哪里可以找到关于MVC的简单解释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/883004/
我在一个项目中工作,该项目需要 SQL 结果的最佳性能,并且希望优化查询,但经过反复试验后,我在 IN 方面遇到了一些问题。 -- THIS RETURNS NO RESULTS AT ALL. SE
在尝试创建一个实际上非常简单的 SQL 语句时,我发现自己迷失了方向。 我有一个包含 3 个表的数据库: 食谱 - 存储一些用于 cooking 的食谱名称 配料食谱 - 将配料与食谱链接 成分 -
我正在尝试理解 PHP 中的 Hebrev 函数。 https://php.net/manual/en/function.hebrevc.php 它说:“将逻辑希伯来语文本转换为视觉文本”。但我不明白
嗨,我在 Grid view 的 android 文档中发现了一段代码对于以下代码。 gridview.setOnItemClickListener(new OnItemClickListener()
谁能解释一下 InfiniBand 是什么?与以太网相比的主要区别是什么,这些差异如何使其比以太网更快? 在官方description从 mellanox 写到 Introduce InfiniBan
这个问题已经有答案了: How are java increment statements evaluated in complex expressions (1 个回答) 已关闭 8 年前。 我知道
我正在阅读 MySQL 教程,我遇到了这个: SELECT /*! SQL_NO_CACHE */ user FROM users; 为什么优化提示 SQL_NO_CACHE 包含在: /*!
我无法理解$(this),我做了一个剪刀石头布的版本,并应用了 jQuery 让用户在计算机上选择按钮选项。我希望有人能解释一下 $(this) 指的是什么,它是 btn-primary 吗?该函数在
我不是很确定 while(choice == 1 || choice ==2);谁能解释一下。我明白这一点 if(choice ==1) displayMonthly(rainfall); e
let flyRight = CABasicAnimation(keyPath: "position.x") flyRight.toValue = view.bounds.size.width/2 f
目录 解释:int型默认值为0 但我们尝试发现并不能通过: 原因: int的默认值为0,而Integer的默认值为null
我正在处理一个查询,自从一个 SSRS 服务器传输到另一个服务器后,它似乎没有按预期执行,并且 where 语句的一部分中出现了以下行 找出不同之处,或者至少从我能找到的地方来看。 where COA
我正在制作一个退回检测程序,读取退回邮件。我们的设置是发送电子邮件,在发送的邮件中添加一个 noreply@domain.tl。一些收件人不再存在,因此我们想要读取退回邮件,并检测它发送给谁。我已经崩
我有一个关于公式通过控制点弯曲的问题。 如您所知,HTML Canvas 有 quadraticCurveTo(x1, y1, x2, y2)与 x1 and x2作为控制点。 但是,当您尝试使用它绘
我有一个 Emakefile看起来像: %% -- %% %% -- {'/Users/user/projects/custom_test/trunk/*', [debug_info, {out
我有一个非常简单的问题。这不仅适用于 spray-json,而且我已经阅读了 argonaut 和 circe 的类似声明。所以请赐教。 在 spray-json 中,我遇到了 There is no
我正在为视频添加水印。我试图让水印与视频尺寸成比例。我已经使用 scale2ref 看到了十几个不同的答案,但没有解释实际发生了什么,所以我发现很难知道如何实现/更改配置以适应我的情况。 当前覆盖命令
因为我正在学习语言,所以我在玩 Haskell,我只是发现了一些我不理解的东西,我找不到解释。如果我尝试运行此代码: map (`div` 0) [1,2,3,4] 我得到一个除以 0 的异常,这是预
我正在寻找解决错误对象引用未设置到对象实例的步骤/指南。以及问题发生原因的解释。 我正在寻找更一般的解释,所以如果我收到错误,我应该采取什么步骤来查找问题。我经常看到有人提供特定代码段的帖子,而其他人
我最近想升级我的知识React ,所以我从组件生命周期方法开始。让我好奇的第一件事是这个componentWillReceiveProps .所以,文档说当组件接收新的(不一定是更新的) Prop 时
我是一名优秀的程序员,十分优秀!