我使用 Zend Framework 已有 2 年多了,我喜欢它。但现在我必须为我的一门课程创建一个小型自定义框架,一位编码员同事建议我尝试 HMVC。
所以,我的问题是:
在 PHP 中选择 HMVC 相对于直接 MVC 的优点/缺点是什么?
我听说过可扩展性专业人士等,但我正在寻找更广泛和完整的答案。我真的很想看到每个部分的列表(最好有来源)。
So, I've been working with Zend Framework for more than 2 years now, and I love it. But now I've got to create a small custom framework for one of my courses, and a fellow coder suggested I try HMVC.
So, my question is:
What are the pros/cons of choosing HMVC over straight up MVC in PHP?
I have heard about the scaleability pros, and such, but I'm looking for a more broad and complete answer. And I would really like to see a list in each part (prefferably with a source).
发布评论
评论(1)
基本上,HMVC 模式只是 MVC 的扩展。 HMVC应用程序包括一个或多个MVC子应用程序。因此,MVC 能做的任何事情,HMVC 也能做。现在,这取决于您是否需要 HMVC 提供的灵活性和可扩展性。
在性能方面,HMVC 和 MVC 没有区别(只要正确实现)。 Sam de Freyssinet,Kohana(HMVC 框架)的开发者之一,解释得很好 - http://techportal.inviqa.com/2010/02/22/scaling-web-applications-with-hmvc/
Basically, the HMVC pattern is just an extension of MVC. An HMVC application includes one or more MVC sub-applications. So anything MVC can do, HMVC can do too. Now, it depends on whether you need the flexibility and scalability that HMVC offers.
In terms of performance, there's no difference between HMVC and MVC (as long as it's properly implemented). Sam de Freyssinet, one of the developers of Kohana (an HMVC framework), explains that very well - http://techportal.inviqa.com/2010/02/22/scaling-web-applications-with-hmvc/