Well I've heard of people talking about the concept of HMVC, which is an evolved version of MVC. I know its the abbreviation of hierarchical model view controller, and that you have several layers of MVC integrated with each other. I was wondering though, are there any popular framework or applications that actually use HMVC? And more importantly, what are the benefits of using HMVC over MVC?

    Apparently, kahona uses a HMVC pattern. I'd never heard the term before, but it's described very much like what I know as "modular MVC" - instead of one controller, there can be many (one per component or tier), with the front controller delegating tasks to them. I do this often with "widget"-like components of a site; most CMS's I've seen take a similar approach, at least with plug-ins, though they don't use the term HMVC.

      traq;11017927 wrote:

      Apparently, kahona uses a HMVC pattern. I'd never heard the term before, but it's described very much like what I know as "modular MVC" - instead of one controller, there can be many (one per component or tier), with the front controller delegating tasks to them. I do this often with "widget"-like components of a site; most CMS's I've seen take a similar approach, at least with plug-ins, though they don't use the term HMVC.

      I see, so multiple controllers/view files for various components? I actually think it can be quite useful for admin control panel. Lets say you have three basic actions 'add', 'edit' and 'delete'. 'add' is one of a kind, but 'edit' and 'delete' both require an id to be processed. You can define two actions 'add' and 'manage', while have a sub-controller handling manage actions that contains 'edit' and 'delete'. The 'delete' action cannot be undone so you may want to have another controller called 'confirm', which can help nicely. I am not sure if this is the practice of HMVC, but looks quite similar.

        Write a Reply...