views:

250

answers:

2

This might sound like a silly topic, but I'm curious what your opinions are regarding coding an application using Joomla or CodeIgniter, within the context of them being MVC frameworks.

I've spent a lot of time coding in CI, and I've gotten pretty used to the strict separation of business logic and data gathering (i.e. I can load up my users model from anywhere in the app flow, allowing me to keep all user-related functions in only one place).

However, now I'm in a situation where I have to use Joomla to build a fairly complex website, so I've spent the last week or so getting down and dirty with the code of this popular CMS. In my short time with it, I've come to realize that this system is very modular, which can, at times (and certainly for users who don't know how to code), be very beneficial. But in its modularity, I've noticed a tendency to repeat data calls from various places in the framework. In the component architecture, it seems that (for the most part) developers user model classes to manage this. Sometimes, however, I notice monolithic blocks of code in controllers that include CRUD actions (see components/com_content/controller.php::editContent in the typical Joomla download). In modules, it seems the data calls are often inline with the logic (or at best a helper class is used).

So what do you prefer? An application-level separation of M, V, and C or the modular approach that Joomla takes? Alternatively, do you think my estimation of Joomla is in some way flawed? Curious to hear your opinions...thanks!

Edit (2010-09-04):

I've decided to come back to this question after having dealt with the innards of Joomla for a while. So what's the verdict? Well, after writing several Joomla modules, components, admin components, and templates, I can honestly say that the difference in organization and coherence between CodeIgniter and Joomla is astounding. After coming from the clean CodeIgniter environment with its great documentation and emphasis on keeping the various abstraction layers separated, Joomla took me by complete surprise with how convoluted it can be.

In CI, much of the minor stuff is abstracted away by the Controller class, whereas in Joomla, I've spent hours trying to track down methods and figuring out what they do. It seems almost as if the MVC is there for the sake of show, as even many native components (see: com_content's controllers) have data calls made directly from the controller. In CI, if you want to access any model, you simply have to load it in a single line, then you will have access to it from anywhere in that controller. In Joomla, if you're in one component or a module and you want to have access to a model in another component, you have to find it in the file system. This type of nonsense permeates the code written by much of the Joomla community, which, as compared to CodeIgniter, I've found generally unhelpful, unresponsive, and often not too knowledgeable (with shining diamonds in the rough, of course).

If you're a guy who just wants to use pre-built components and modules that are moderately difficult to skin or change, but easy to implement, sure...give Joomla a try.

If you're a programmer and you have to get down and dirty with Joomla...just don't use it. Save yourself a million headaches and use a lighter-weight, generic system like CodeIgniter (perhaps with the ExpressionEngine CMS on top of it), or use a great HMVC system like Kohana.

If you're being forced to use Joomla, I send my deepest sympathies to you.

+1  A: 

I work frequently in Joomla and appreciate the modular approach that it takes, although it does a few quirky things with its structure that I don't really approve of. However, it needs to take this approach since Joomla is trying to be an all-in-one package for your web site. You certainly won't use all of the components that they have available but where Joomla's modularity has power is in the fact that you can easily deploy multiple applications within a single site. You can do this in other frameworks, true, but Joomla's component system is my favorite by far.

Joomla has a database class that allows it to do CRUD, after a fashion, but it has always felt very hackish to me and not at all on par with other ORM schemes.

Jarrod
+1  A: 

In most cases it is best to use Joomla and its modules "as is", without any additional coding, since any changes you make (except to the templates or your own custom modules) may cause problems when updating either the Joomla core or the modules.

So if you are forced to use Joomla, I would recommend to look at it with the eye of a "configurator", rather than a "coder". Your task is to find the right extensions for your site's goals, and configure them in such a way that they play nicely with each other.

In CodeIgniter, on the other hand, you are the master of your code, and the framework is only there to help you write it and make it work. For me, this is the main difference (and this is the reason Joomla is called a CMS, it is a more or less ready "system", as opposed to CI being called a framework, since it just roughly defines areas for you to build on).

NPC