Categories
CodeIgniter Cool Webapps FOSS Me - Myself MySQL OpenSource PEAR PHP PostgreSQL SQLite

Prelude to foundation: Its time to go for a better PHP Framework

I remember those old days when I had to write everything by myself. I wrote huge libraries to work with MySQL. Then I learned PostgreSQL and SQLite but didn’t rewrote my old library to work with those, I was running short of time. So I forsake the opportunity to write a db library which works with them. What I did was plain code relevant to database specific portions. Oh ya, that was a long time ago.

Soon after that I came to know adoDB which made my dream come true. I was so much happy getting my all db specific works done in a much more smarter way. I get rid of database portability issues. I was very happy that time.

I learned smarty soon after I realize that my codes are getting ugly with all the inline HTMLs and PHPs. Nothing could be smarter than separating the presentation logic from the business layer. I am a big smarty fan since that time. It saves my sleep for many nights.

But again I am recurrently suffering from maintainability issues. I was not surprised to find that my code is becoming huge unmanageable giant and it takes huge time for refactoring the application. I was very sad those days. Oh what a disaster that was.

When working with my team members located remote places, I fall into a deep shit. How can we manage and track the changes done by us? Even I was getting strange code in my routine which I bet was not written by me!! It was a terrific job delivering the project after team working. Team working made our life real hell. I was thinking that one man project was much better than a team. he he he.

Soon after that I learned version controlling and it saves me from more disaster in my life. Because i learned how to taste the flavour of “team working” instead of a “one man only” project. I did a big leap, now I enjoy my life a lot for that.

But I am stuck again to find that my problem of “unmanageable” code still remains unmanageable because a lot of code clutters and redundancy. I used a lot of open source libraries for different tasks. The whole projects getting messy and hard to manage. Its a sad time again.

Immediately after that I realized, shit, what I am doing? Why I am reinventing the wheels everyday? Where has gone the true meaning of OOP? Why am I living in a hell. I study the MVC frameworks and then I was really happy to guess that it might solve all my problems in a smarter way.

So which framework I have to choose? I got FreeForm, Prado, Seagull, Symfony, CakePHP and CodeIgniter. Oops, a whole lot frameworks to choose from. I went thru FreeForm and Prado but i really dont like the flavour of everything widgetized!. I just dont want to loose control over my easy part for the sake of manageability. I also dont want to remember the properties of my easy HTML objects as a widget. I went thru CakePHP and it is a fantastic framework i agree. I learned it from their online documentation list, worked some templates and controller as thier way and damn, It is so intelligent that didn’t leave control to me for some specific tasks. It is much smarter than I can handle, I dont like something which left less flexibility on my hand t solve my own problem.

I got big names likes symfony and I heard that yahoo bookmarks is done using this. But Again it was a hard time for me. So many configurations lead my life to an endless journey to eternity. I found that I am spending much more time in studying the framework than working to deliver my project to client. Ohhhhhhh, what am i doing? All these learning curve for making my project successfull manageable at the cost of “failure” to deliver the project itself? Well, I think I have to go for something else.

Suddenly I got codeigniter and I was able to run a whole lot of controllers, templates and models in minutes (well not in minutes, but much less time than previous ones). A rich , pleasing to read, friendly set of documentation, a bunch of in built libraries and less autonomous control gives me full freedom over my application. It was easy to integrate my old friend smarty with it, in case it comes with it’s own active record, but it gives me chance to add adoDB with it. I fall in love with code igniter soon after i realize that it comes with almost zero learning time (or i better say learning on demand)

Thats the story how I started my journey with CodeIgniter……

A prelude to foundation. I remember the wise saying from Donald Knuth – “Premature optimization is the root of all evil” and I realize, thats true.

Note: The article was done as a story. In real life application development you have to consider many more things like scalability, performance and cost of development. Its not an wise idea to switch to framework just for fun. If you are happy and satisfied with the framework you are working with, I would rather suggest you to stay with that.

31 replies on “Prelude to foundation: Its time to go for a better PHP Framework”

Hi,

i read your Blog since one month and ich found some very helpy stuff. At moment i search for an PHP Framework and you write some interesting stuff linke “just php will give you nothing unless you upgrade yourself” and now this article. My question is. You are a ZCE and not mention something about Zend Framework? I play with the thought to use ist. I need for my project an PHP Framework, Template Engine and Ajax. I plan to use Zend, Smarty, Prototype, scriptaculous. Is that the right choice or what you mean?

You can contact me under my Mail, plz.

Key

@Key

Zend Framework is much more a object library like ezComponents. The MVC of Zend is not matured enough and you can find several rants on it. So I decided not to list that here. But trust me, I like ezComponents more than Zend. but ez dont have any mvc in it.

I would suggest you to go with CodeIgniter as your MVC, Prototype for Ajax and you can use either smarty as ur template engine or you can use CI’s builtin template library. If you prefer Smarty, yu can easily integrate it with CodeIgniter. Unless you want to display some animations in your page, you can go without Scriptaculous.

@nigeljames – sure mate, you can give it a try. It is worth trying CodeIgniter. Wish you good luck on that.

Well.. i respect your choice and it is a good one.
But when you say that CakePHP doesn’t give you enough flexibility you are very wrong.. it is sometimes too flexible :). The learning curve is HUGE as it has many hidden features.. especially 1.2

But since you were actually looking for something that would get you started on your project right away.. you probably made the right choice.

a great comparsion you made in such a polite and strory telling manner, obviously it solved my problem to select an easy to use framework, so realy great and imformative Post you made,

You step over the learning curve of frameworks very easily. Yes, it takes time to learn about all the fine parts of a framework like Symfony, but this a one-time learning curve. After you’ve mastered the concepts of a framework like that (which I did simply by following their Askeet tutorial) then you come to use the power of all these fine parts.

I agree with you that choosing a framework requires a lot of different aspects to be weighed, but learning curve really should not be the factor that stops you from learning something. The knowledge you learn by investing one or two days into learning a framework can be used for the rest of your professional life.

@stefan – agree 100%

But when I was talking about my learning, it was important to deliver the project rather spending time to learn it. and yes, i spend some time in learning, but the learning curve is HUGE in CakePHP (I agree with gribelu) –

Learning is always the best thing..

Thanks for the comment.

Great story, that’s almost same path I took when I worked with PHP.

I loved CodeIgniter after I tried several MVC frameworks, but I still found I was repeating myself many times to build the similar code – it happened a lot when I used CI’s form validation 🙁

Like what you said – I spent a lot of time learning different stuff and searching for the *best* framework to fit all purposes – then I realized I have to stop this endless loop – that’s why I started looking into Ruby on Rails. After spent 3 weeks working (and learning) on a small project, I finally found what I was looking for – I suggest you give RoR a try – it’s really fun to code in RoR, this is the first time I find I am happy in coding since I started my career as a web developer 🙂

Cheers!

Very cool. I am an avid CakePHP user, but I have respect for CI and its framework. I think each framework has different things to offer that attract different users. It’s cool to see you not bashing the other frameworks, but showing you how came to an educated decision.

And RoR is so much more limiting if you need to have the ability to implement your web applications on almost any web host. CI has much more flexibility hands down in that regards (among many others). Tried RoR and was not overly impressed by it… am sticking to CI for our projects.

I personally use CodeIgniter for my web projects. It is an excellent MVC framework. But I would love to see more and more helper libraries, and plugins. The helper and Plugins section is still not matured.

Anyway, I don’t like CakePhp, it is not documented well. Better documentation is always an important part of any framework. One of the reason we use framework is to avoid repeating codes. Without proper documentation it is not possible to find out the already invented wheels, and thus no reusability.

I strongly recommend CodeIgniter over CakePhp, I didn’t inspect other frameworks Hasin Bhai Recommended. The reason was that, still I am forced to use PHP version 4 in many of the existing projects. And , only CakePHP and CodeIgniter Supports Php version 4. Others do not.

I strongly agree with you. CodeIgniter framework is such a arrange full and easy framework so far i have learn and worked. Even i become a fan of CodeIgniter. The day when i first found the CI i am still learning and learning.

Thanks to the CodeIgniter developer team for making such a easy and efficient framework of PHP.

I want something more in CodeIgniter:
1: Cookies Class libraries
2: A class to setup Cron Jobs(Windows/Linux)

thanks

Nice story,
I’ll try it too but I’m just looking for a powerful MVC and to be able to keep the other tools I’m used to.
I hope it will be possible with CI…

Thanks for the article
JD

Leave a Reply

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