• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recommendation...Modular Extensions or Matchbox?

#11
[eluser]lancemonotone[/eluser]
[quote author="wiredesignz" date="1204742925"]Actually Modular Extensions is CI, same methods classes etc. The only difference is, it isn't URL aware. Yet Tongue[/quote]

OK, I'm getting the idea... Can you give an example of what URL awareness is? Does that mean that I should be able to say www.example.com/controller, instead of www.example.com/module/controller?

My purpose in looking into modularity is that placing my controllers into subfolders is throwing my application into a tizzy and I can't seem to get my default controller to work anymore, not to mention the MV portion of the app is spread out all over. I like the idea of self-containment. I am understanding that shared resources such as models left in the default model directory will still be accessible with no configuration.

Another question comes to mind with regard to Matchbox: $config['directories'] = array('modules')...do I need to add my submodule directories to this array? array('modules','modules'=>'modules_admin')? ** EDIT: No, I didn't need to change anything in this file. **

OH, yeah...What is the H in HMVC? And where would I find the best info about partial views? I apologize, the more I think the more I think I annoy.

You guys have been very helpful.

#12
[eluser]lancemonotone[/eluser]
I just tried both and got Matchbox to work immediately. Maybe I'm missing something crucial with ME but unfortunately, I could not figure out from the documentation how to get even my default controller to display. The doc doesn't seem to be written for those of us with little CI experience. Many thanks to you both for your explanations.

**EDIT - I hope no offense was taken. I'm sure the problem is with me and my lack of solidity on CI. **

#13
[eluser]Avatar[/eluser]
If you want a good starting point for using modular extensions and smarty together check out my thread:

http://ellislab.com/forums/viewthread/73367/

I will see about getting matchbox in there as well. I just haven't tried it yet. Plan on that today sometime.

#14
[eluser]esra[/eluser]
[quote author="lancemonotone" date="1204751032"]OH, yeah...What is the H in HMVC? And where would I find the best info about partial views? I apologize, the more I think the more I think I annoy.
[/quote]

'H' is for Hierarchial as in Hierarchial-Model-View-Controller. Note that ME is technically not HMVC by any means, so use of that term is misleading. HMVC and MVC are separate architectural design patterns, each of which is based on a collection of subordinate design patterns. ME changes the behavior of the MVC design pattern but does not use the Chain of Resposibility design pattern or Observer pattern to handle inter-module communication. For a detailed description of HMVC by the original authors, read the JavaWorld article announcing the architectural design pattern (i.e., do a web search for 'JavaWorld HMVC').

Matchbox allows CI to support an alternate file system and uses custom routing code designed to route to modules in that alternate file system. It does a few other file system oriented things (study the code).

ME allows a single module to be loaded as a page controller using CI's standard Router library (usual CI-MVC approach). The big distinction between Matchbox and ME is ME's support for simultaneously loading additional MVC triads (modules) within the same template. Those additional MVC triads are loaded into regions within the template without using the Router because the router is not necessary if those additonal MVC triads don't have to be loaded directly via the URL (i.e., no routing is necessary). So in a sense, ME modules have a dual personality--they can behave as a Matchbox module (standard MVC triad loaded from a modular file system) and they can behave like independent widget-like entities which can be loaded at the same time as a module (in various combinations). When a ME module is loaded as a module, it could be said to have focus like in a desktop application because it is loaded via the Router. Any other ME modules loaded as widgets within the same template are loaded rather than routed based on code inserted into template regions. You might note that those widgets could probably populate those regions based on loops inserted into those template regions, assuming that widgets could be assigned to template regions within a database table). Thus, it's possible to associate sets of widgets with various modules (e.g., load forum-specific widgets when routing to a forum and e-commerce widgets when routing to a ecommerce catalog).

Derek Allard wrote a nice tutorial as a forum message shortly after 1.6 was released with a good explanation of how to load multiple view fragments (partial views) using th updated Loader library.

#15
[eluser]wiredesignz[/eluser]
Quote:ME changes the behavior of the MVC design pattern but does not use the Chain of Resposibility design pattern or Observer pattern to handle inter-module communication.

Actually, the Chain of Resposibility can be initiated via a default controller using the remap() function to determine which Module(s) to run, and Modules themselves can hand off responsibility to other Modules in a chain.

Alternatively (if anyone was clever enough) the Observer Pattern could be implemented using Neophytes' Khaos Events libaries with ME.

Therefore ME is closer to HMVC than you suggest.

Thank you for your time. Wink

#16
[eluser]Edemilson Lima[/eluser]
To better understand what ME is about, you can read about the ideas that makes it arise and what it is capable of:

I did start to ask about the best way to structure my application here:
http://ellislab.com/forums/viewthread/68847/

And we had some other parallel discussions about the same theme:
http://ellislab.com/forums/viewthread/64087/
http://ellislab.com/forums/viewthread/71506/
http://ellislab.com/forums/viewthread/73899/

But the discussion about NESTED MVC started to ignite here:
http://ellislab.com/forums/viewthread/70425/
(I was arguing there why Libraries, Helpers, Plug-ins and Models are not suited for modular needs)

Then born the first version of Modular Extensions:
http://ellislab.com/forums/viewthread/71940/

And soon after, the second version:
http://ellislab.com/forums/viewthread/72123/

And the third version...
http://ellislab.com/forums/viewthread/72580/

Finally, the fourth and last version:
http://ellislab.com/forums/viewthread/73177/

And we have some modules examples:
http://ellislab.com/forums/viewthread/73401/

Modular Extensions is powerful, elegant, well done, very flexible, and solves any problem about modular needs in CI, including a complete HMVC or just for View partials. It was made based in the CI core, so it follows the CI standards, without hacking the core.

With it you can organize your code into separate folders, to write your own plug-and-play modules. But also, it allows you to load how many nested modules you want. The modules are very close to Controllers, so it is the best approach to the HMVC concept.

You can have only one controller for the public part of your application and modularize everything else in your application, if you want. There are many things you can do with it, in many possible ways. It is up to your imagination. Also, new features will come soon.

#17
[eluser]esra[/eluser]
Here is the original article announcing HMVC posted by the authors in JavaWorld magazine.

HMVC: The layered pattern for developing strong client tiers

In reading this article, keep in mind that HMVC was originally designed for Java. Ignore the Java code and focus on the illustrations explaining the architectural structure of an HMVC application and read the text. The GUI Frame terminology could be compared to a PHP template. A GUI Pane could be compared to a MVC triad.

There is reader letter elsewhere on JavaWorld based on a comment about the similarity of HMVC to PAC (the Presentation-Abstraction-Control architectural pattern which is described in detail in the POSA book) along with a reply by one of the authors with an explanation of the differences. I just tried to find it, but could not. Maybe someone else will have better luck.

There is one implementation of an HMVC framework for PHP called Claw by Tomas Varaneckas. The Claw project was abandoned but the code is available on both Tigris.org and phpclasses.org. There are two versions available on the web--the 3.x.x stable version and the 4.x.x svn version. Claw is PHP5 only and licensed as GPL. The latter version is stable, but the PHP Renderer needs some work. The Smarty Renderer works nicely. If you want to experiment with HMVC as a means of porting more ideas over to CI, this is a good solution to play with. If you have an interest in PHP5 coding examples on the framework level, the use of abstract classes and interfaces in Claw should present some interesting ideas for code abstraction. Claw also uses its own approach to namespaces and Claw applications can be loaded by PHP desktop applications. Overall, there are a lot of good ideas in the code.

#18
[eluser]Tony Nash[/eluser]
Zacharias,

Quote:Also, Matchbox handles all your routing so urls will be routed to module controllers when present.

Dose that mean I cannot use

A) following type of URLs?

http://domain.tld/en/controller/method
http://domain.tld/en/module/controller/method

B) or my own extension to Router?

Also has anyone able to work URI Language Identifier with matchbox? I hope it works with Modular Extensions properly.

#19
[eluser]wiredesignz[/eluser]
The URI Language Identifier library has been tested and works well with Modular Extensions. In addition to this, since vesion 4.1 Modular Extensions module controllers are accessible from the URL and there are only a few additional commands to learn.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.