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

Simple and straight. Have your say, better with real examples.
Reply
#2

There is far too many of these threads.

Why not.

1) If you want it, start a project on github with the rest of the people who want it. Develop your own HMVC addon.
2) Put it here with instructions on how to integrate it.
3) ....
4) Profit??
Reply
#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
#4

Modular structure and HMVC are different things.
Reply
#5

(11-10-2014, 01:46 AM)ivantcholakov Wrote: Modular structure and HMVC are different things.

You're right. From my understanding, HMVC allows you to use resources from other MVC triads, whereas straight modular separation does not. I think I've got that right but feel free to correct me if I'm wrong. I know my understanding of the differences was fuzzy for a while.
Reply
#6

I am a little bit concerned about voting in these forums. Voting pushes people to express determined opinions immediately about things that require more time for consideration. It is early for voting about HMVC.
Reply
#7

These are informal polls created by the forum users, not official polls by the council. So, these aren't voting for features or anything, just people excited.
Reply
#8

It is good to see people excited about CI!

Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB