Codeigniter is wonderful platform, and i am not planing to question it. Everything they say in the documentation is true, and at the moment I am not planing to switch. After I started using it, I am not planing on developing web without it till something better arrives.

However, from my point of view Codeigniter has one major shortcoming, that is lack of data layer reusability. To explain the problem, lets see what reusable parts in codeigniter are.

Code igniter fulfills MVC paradigm requirements, that is separates application into Models, Views and Controlers. Together with the core of the system, it allows creating standalone application. To help code reuse, some other units are introduced. A) libraries b) plugins c) helpers. All of them might be application or system (global, reusable instalation)

I will not fuss about unclear difference between plugins and helpers. However libraries are quite week. The problem is that neither of these modules have clean native access to database layer of the system. Libraries might be a simple class without any inheritance and to be able to access database one has to create a new instance of codeigniter core object. In fact, it is much simpler to just copy application models from one app to another and see if it works. Futuremore, models not always work with databases like it is in CI. Model might be used to perform file operation, or store information somewhere using XML-RPC, etc. The possibilities are endless. So they are not so different semantically.

Why its a problem ? Well, there are plenty tasks, which are identical in application building. A simplest example would be page comments. Or the whole post system. Database layout is the same, functions are almost the same. And you can’t do such library in codeigniter without creating an instance of its core.

The solution? There are couple. Support of system models would be one, though not the best one. Probably it would be best to merge model and libraries into one super-unit, which task would be data processing.

Categories: Programming

Giedrius Majauskas

I am a internet company owner and project manager living at Lithuania. I am interested in computer security, health and technology topics.

1 Comment

Aniket · February 19, 2009 at 6:41 am

Hi,

As per my knowledge we don’t create a new instance of CI super object we actually get the reference. CI implements the Singleton and Decorator design pattern.
I think you are speaking about ORM feature to be implemented ?.
If yes then even i agree about the same. CI should have provided this feature.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *