用于 Web 应用程序开发的 MVC 与 HMVC [英] MVC vs HMVC for web application development

查看:27
本文介绍了用于 Web 应用程序开发的 MVC 与 HMVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MVC 模式进行 Web 开发.我使用 codeIgniter 框架.我找到了 http://fuelphp.com/http://kohanaframework.org/ ,他们正在使用 HMVC.仍然不清楚 HMVC 以及为什么我们应该使用 HMVC 而不是 MVC ?阅读 HMVC 模式后我很困惑,它与 MVC 没有太大区别.您能解释一下为什么我们应该使用 HMVC 进行 Web 应用程序开发吗?

I'm using MVC pattern for web development. I use codeIgniter framework. I found http://fuelphp.com/ and http://kohanaframework.org/ , they are using HMVC. It still not is clear of HMVC and why we should use HMVC instead of MVC ? I am confused after reading HMVC pattern and it's not too much different from MVC. Can you explain why we should use HMVC for web application development ?

推荐答案

Hierarchical-Model-View-Controller (HMVC) 模式是一个直接的MVC 模式的扩展,它设法解决了许多问题已经提到的可扩展性问题.HMVC 最早是在一个题为 HMVC:开发强大的分层模式的博客文章2000 年 7 月 JavaWorld 网站上的客户端层.文章重点介绍了在图形用户中使用 HMVC 的好处接口.已经有 一些建议,作者在哪里实际上重新解释了另一种称为1987 年描述的 Presentation-Abstraction-Control (PAC).文章在 JavaWorld 中详细解释了 HMVC 如何帮助使用 GUI 设计桌面应用程序.这个的重点文章是为了演示如何使用 HMVC 来创建可扩展的 Web应用程序.

The Hierarchical-Model-View-Controller (HMVC) pattern is a direct extension to the MVC pattern that manages to solve many of the scalability issues already mentioned. HMVC was first described in a blog post entitled HMVC: The layered pattern for developing strong client tiers on the JavaWorld web site in July 2000. Much of the article concentrates on the benefits of using HMVC with graphical user interfaces. There has been some suggestion that the authors where actually re-interpreting another pattern called Presentation-Abstraction-Control (PAC) described in 1987. The article in JavaWorld provides a detailed explanation of how HMVC can aid in the design of desktop applications with GUIs. The focus of this article is to demonstrate how HMVC can be used to create scalable web applications.

HMVC 是作为一个整体运行的传统 MVC 三元组的集合应用.每个黑社会是完全独立的,可以执行没有任何其他人的存在.对三合会提出的所有请求必须使用控制器接口,从不加载模型或库在他们自己的域之外.三合会内的物理位置托管环境并不重要,只要可以从系统的所有其他部分.HMVC的鲜明特点鼓励重用现有代码,简化不同的测试系统的一部分,并确保应用程序很容易增强或扩展.

HMVC is a collection of traditional MVC triads operating as one application. Each triad is completely independent and can execute without the presence of any other. All requests made to triads must use the controller interface, never loading models or libraries outside of their own domain. The triads physical location within the hosting environment is not important, as long as it is accessible from all other parts of the system. The distinct features of HMVC encourages the reuse of existing code, simplifies testing of disparate parts of the system and ensures that the application is easily enhanced or extended.

来自 使用 HMVC 扩展 Web 应用程序作者:Sam de Freyssinet

From Scaling Web Applications with HMVC by Sam de Freyssinet

这篇关于用于 Web 应用程序开发的 MVC 与 HMVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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