4

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

Community
  • 1
  • 1
Janis Peisenieks
  • 4,938
  • 10
  • 55
  • 85
  • 1
    A "more broad" answer is more off-topic here. Stackoverflow is for technical answers, not for elaborating on conjectures that you've heard somewhere. And deriving scalability or performance discussions from a minor application structuring scheme is likewise unproductive. (Also MVC does not mean what you think it means.) – mario Feb 18 '12 at 15:25
  • 1
    @mario how in the world can you know that I think MVC means? And I totally disagree on the "more broad" part. It can mean more consice and looking more in depth at the question. – Janis Peisenieks Feb 18 '12 at 15:31
  • 1
    For one, you seem to think that ZF implements MVC, or other PHP frameworks would. Your second misconception is that HMVC descends from MVC, instead of PAC (which you are googling right now). And before you demand a more in depth answer, you might wish to explain the scalability buzzword. How many servers? How is it gonna help you to break out parts, and which? – mario Feb 18 '12 at 15:46
  • 3
    Please stop being so unconstructive. This is a Question and Answer board, isn't it? Then please be so kind as to provide the missing parts in your explanation, instead of bashing what you think I think. `For one, you seem to think that ZF implements MVC, or other PHP frameworks would` - yes, I do. What is wrong with that? Isn't that the truth? And if not, what do they implement? You seem to forget this part. As to scalability - I mean allowing more than one person to work together, while writing a more DRY code. I may have chosen a wrong term here, I admit that. – Janis Peisenieks Feb 18 '12 at 16:20
  • MVC QUIBBLE FTW!! Possible duplicate of [What is the HMVC pattern](http://stackoverflow.com/questions/2263416/what-is-the-hmvc-pattern) – Gordon Feb 18 '12 at 16:21

1 Answers1

5

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/

Shog9
  • 156,901
  • 35
  • 231
  • 235
laurent
  • 88,262
  • 77
  • 290
  • 428