MVC vs HMVC for web application development

HMVC can do anything that MVC can and more

one of the things that you will or had struggled with in MVC is that you can’t call a controller from another controller (unless you use a custom library or helper to do that)

in HMVC (Hierarchical Model View Controller) you can do that , i would sum all the qualities in here:

  • reuse your code in other projects
  • simplify maintaining your project
  • scale your project
  • organize code
  • modular structure

you will never go back to MVC after trying HMVC
here is a picture to be more clear

See picture

for CodeIgniter use “Modular Extensions – HMVC”

Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components,
typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications.

Module Controllers can be used as normal Controllers or HMVC Controllers and they can be used as widgets to help you build view partials.

if you want to use codeigniter with HMVC pattern, you can use Modular Extensions – HMVC here

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

and here are some nice and funny video tutorials that will get you on rails with HMCV in codeigniter

hope that helps!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)