Welcome Guest, Not a member yet? Register   Sign In
To HMVC or MVC, that is the question!
#1

[eluser]jleequeen[/eluser]
Hello Everyone,

I'm working on a new project and am trying to decide whether to go with HMVC over MVC. All my previous applications have been done with MVC using my own custom libraries for custom functionality. I understand that in HMVC I can use modules for functionality instead of having to create libraries. I also can see the benefits of using modules to invoke view partials, and widgets, although for this particular project I don't really see the need to have much code reuse in terms of views.

I'm also interested in building modules that can be used in other web applications in the future, but honestly i'm having a hard time seeing how that would work in practice. I would have to keep a base set of modules up to date and share them with my existing applications, but I doubt i'd really want to do that. For the life of me, I just don't think it'd be as easy as slapping modules in from one application to another. Not to mention having to "think" about making modules generic enough to use in other applications.

I guess I just think of each of my websites/applications as custom built, and they take a life of their own. I may use similar libraries or coding practices between them, but they really don't share anything, nor honestly do they need to for the most part.

Anyway, sorry to get long winded, but could I get some thoughts from all of you? To HMVC or not? Am I making a big mistake by not moving to HMVC? I'd be very appreciative to hear of your experiences.

Thanks.
#2

[eluser]jleequeen[/eluser]
So 40+ views, and not one response? I'll take that meaing most people are just using MVC, without the HMVC extension, or that no one really cares to answer Smile No biggie, just thought someone might be kind enough to share their experience. Hopefully that didn't come across as rude, just disappointed I haven't gotten even a single response!
#3

[eluser]Narf[/eluser]
Unless your project is a large and modular (really modular, by functional requirement) application, you've got no reason to use HMVC.

HMVC is the easy way for quite some people, but that's only in the short term. It's an often abused feature like ORMs, for example. Not using it will force you to think more carefully about your application's architecture, which if you do properly, will benefit you much more when you have to maintain it for a longer period of time.
It's also a third-party extension that is neither developed, nor supported by CodeIgniter itself, and hacking anything in system/ is always a bad idea.

And forget about code reuse between different projects - that's what libraries are made for. Just recently I had to do some work on a project for which somebody decided that it would be a great idea to reuse all the modules, everywhere, while each module is a separate product at the same time - WHAT A NIGHTMARE! You don't want this.
#4

[eluser]stevezissou[/eluser]
Quote:I also can see the benefits of using modules to invoke view partials, and widgets, although for this particular project I don’t really see the need to have much code reuse in terms of views.

Just an FYI, you don't need "HMVC" to do this.
#5

[eluser]jleequeen[/eluser]
[quote author="Narf" date="1409181335"]Unless your project is a large and modular (really modular, by functional requirement) application, you've got no reason to use HMVC.

HMVC is the easy way for quite some people, but that's only in the short term. It's an often abused feature like ORMs, for example. Not using it will force you to think more carefully about your application's architecture, which if you do properly, will benefit you much more when you have to maintain it for a longer period of time.
It's also a third-party extension that is neither developed, nor supported by CodeIgniter itself, and hacking anything in system/ is always a bad idea.

And forget about code reuse between different projects - that's what libraries are made for. Just recently I had to do some work on a project for which somebody decided that it would be a great idea to reuse all the modules, everywhere, while each module is a separate product at the same time - WHAT A NIGHTMARE! You don't want this.[/quote]

Thanks Narf! I really don't like using third party addons and would rather stick with the core system supported by CodeIgniter. This is the kind of first hand experience I was looking for. Thanks also to you for all the hard working you're putting in on CI 3.0. I can't wait until it's released!
#6

[eluser]jleequeen[/eluser]
[quote author="stevezissou" date="1409237765"]
Quote:I also can see the benefits of using modules to invoke view partials, and widgets, although for this particular project I don’t really see the need to have much code reuse in terms of views.

Just an FYI, you don't need "HMVC" to do this.[/quote]

I realize that, albeit it via a different method, but you are right!
#7

[eluser]ivantcholakov[/eluser]
@jleequeen "To HMVC or MVC, that is the question!"

Easy, simple projects don't exist. They turned to be FB pages now. :-)

Even if you start something simple, your client will come back with more ideas, because he/she is under competition too. It is crucially important how projects start, they have to be open for growing.

HMVC is one of the approaches to help about complexity. Much is written on this, you may find the details alone.

Modular structure helps about complexity too, however, people expect modules to be totally portable between projects. I use modules, they give convenience, but I don't care about portability too much.

My answer is "HMVC, but there are practical obstacles. "...

The most popular third party solution (a subjective impression) for CodeIgniter is by wiredesignz. It actually provides two features - HMVC and modularity, I like that. Unfortunately, at the moment there is no support for CodeIgniter 3. Ok, you may make efforts for adapting this third party solution (I did), you arrange your code, and suddenly in the future CodeIgniter comes with its own solution...

HMVC should not be a third party solution.

..."Hope and wait...". :-)




Theme © iAndrew 2016 - Forum software by © MyBB