Welcome Guest, Not a member yet? Register   Sign In
HMVC: pros and cons
#3

I think you're asking for our opinions on whether to use HMVC or not? That's what I'll answer with anyway.

HMVC, when used simply to collect "mini-applications" with config, controllers, helpers, libraries and models is a great way to make your code re-usable. If you find yourself commonly needing a simple blog application you can write it once and drop it in your next project and you're ready to roll. For very large applications it also provides a way to compartmentalize different sections of your site. This might be just to keep things organized, since having all of those items in in the common model folder, etc, can quickly become unwieldy. HMVC then allows you to easily access the libraries and models from other modules if you need it. This is also useful when you think the app might gain traction and have to be split into different parts to be placed on different servers for performance reasons.

Currently, CI has Packages which are close - but do not allow routing to controllers within packages, which makes controllers unsupported in the current scheme. This was intended, I believe, primarily for EllisLabs' use when moving ExpressionEngine over to be built on CodeIgniter and they needed a way to make their current module system work with it.

As for the cons - the ability to load a controller and execute one of it's methods is horrible. It creates additional, unneeded overhead as the call forces another entire app life-cycle to load, with some versions of HMVC. It makes it extremely difficult to do any form of testing on your code. In every case I've ever come across where someone wanted to do this, a better solution was simply to include the code in a library and call it from all of the different places you might need it.
Reply


Messages In This Thread
HMVC: pros and cons - by geekita - 11-09-2014, 04:24 PM
RE: HMVC: pros and cons - by no1youknowz - 11-09-2014, 05:40 PM
RE: HMVC: pros and cons - by kilishan - 11-09-2014, 08:24 PM
RE: HMVC: pros and cons - by ivantcholakov - 11-10-2014, 01:46 AM
RE: HMVC: pros and cons - by kilishan - 11-10-2014, 07:36 AM
RE: HMVC: pros and cons - by ivantcholakov - 11-10-2014, 12:14 PM
RE: HMVC: pros and cons - by kilishan - 11-10-2014, 12:16 PM
RE: HMVC: pros and cons - by Chroma - 11-14-2014, 08:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB