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

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

问题描述

现在,我正在使用MVC模式进行Web开发。我使用codeIgniter框架。我发现 http://fuelphp.com/ http://kohanaframework.org/ ,他们正在使用HMVC。我仍然不清楚HMVC,为什么我们应该使用HMVC而不是MVC?阅读HMVC模式后,我感到困惑,MVC并没有太大的不同。你能否解释为什么我们应该使用HMVC进行Web应用开发?

解决方案


视图控制器(HMVC)模式是MVC模式的直接
扩展,可以解决许多已经提到的
可扩展性问题。 HMVC首先在
博客文章中标题为 HMVC:2000年7月在JavaWorld网站上开发强大的
客户端层
的分层模式。
文章的大部分内容集中在使用HMVC与图形用户
的好处接口。已经有一个一些建议
实际上重新解释1987年描述的另一个模式叫做
Presentation-Abstraction-Control(PAC)的作者。在JavaWorld中的文章
提供了HMVC如何帮助
设计桌面应用程序与GUI的详细解释。这个
文章的重点是演示HMVC如何用于创建可扩展的web
应用程序。



HMVC是传统MVC三元组的集合作为一个
应用程序。每个黑社会是完全独立的,可以执行
而不存在任何其他的。所有向triads发出的请求必须
使用控制器接口,不要在自己的域外部加载模型或库

托管环境中的黑社会实体位置并不重要,只要从
可以访问系统的所有其他部分。 HMVC
的独特功能鼓励重用现有代码,简化了系统不同的
部分的测试,并确保应用程序容易
增强或扩展。


使用HMVC扩展Web应用程序
Sam de Freyssinet


Now, 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. I still not clear of HMVC and why we should use HMVC instead of MVC ? I confuse after reading HMVC pattern and it's not too much different with MVC. Can you explain why we should use HMVC for web application development ?

解决方案

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 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.

From Scaling Web Applications with HMVC by Sam de Freyssinet

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

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