February 11, 2005

PHP Frameworks

Disclaimers:
Anything written in this particular post is my sole opinion the matters addressed. It's my own judgement and I do not recommend you use anything said here as "recommendation" for system implementation and so on. If you do, do it at your own risk. I rather recommend that you spend some time using the systems addressed here yourself and find what is appropriate in your environment and situation.

Let's get cracking:
So, let's talk about PHP Frameworks. Before diving more into the main subject of my post, I would like to spend explain what *I* think a framework is and why *I* think it is important.

I consider an application framework to be a set of standardized methods, settings, filesystem structure, code library and templates to build applications. I think using an application framework is important because it helps the developing team maintain a set of standards when it comes to coding but also it helps a lot in code reuse: the framework keeps growing till it's got in it enought classes or code library to build applications in just a few declarations and configuration modifications.

What I particularly found important when I started using frameworks was the fact that it made my life so much easier by *really* breaking my applications in a 3-tier. So basically, I have my data store, application or business logic and presentation layer truly separated.

A few years ago when I started programming in PHP, I would write the *normal* spaghetti code where a mix of HTML and PHP makes a good meal and I have to say that it always worked till I started dealing with slightly larger projects: because I wanted to sort out bugs easily as well as be able to build applications really fast, I spent sometime building my own framework (tinyCMS as I called it at the time). It worked really well and there is quite an impressive number of applications using it and even some people developing it further till date. But it had one big problem: it was a *2-tier* application, that is the data-store was separated but the presentation and business logic were still tied together. The design didn't *really* allow for easy maintenance, easy debugging and the likes.

About a few months ago, although I always wanted to work with it (but never did), I discovered PHP-OOP or Object Oriented Paradigm in PHP. It took me a while to get through it but once I did, it was awesome. For the past 4 months, I've built quite some skills working with PEAR (http://pear.php.net), ADOdb, the Smarty templating engine (http://smarty.php.net) and a custom framework built by SIP. With all those components together, it has been possible to build truly scalable, maintainable and 3-tier applications where the origin of the data didn't matter and the presentation layer could be anything I wanted (HTML, XHTML, XML, text, etc...). This also gave me the opportunity to learn and use MVC (Model-View-Controller) paradim.

I have now gotten so used to it that it's rather difficult to see myself programming *spagetthi* PHP again (I even tried and I just couldn't do it).

Getting to the point, I wanted to be able to use the same powerful model in my own applications. I spent almost a week now evaluating and studying the various possibilities out there. Here are some of the PHP frameworks I've had a look at:

Those are some of the frameworks I really liked but they had a few downfalls: some of them were way too complex but I could deal with that. What I couldn't however deal with is the fact that a majority of them were poorly documented (how the *fuck* am I supposed to know what classes to use, what functions to call, the way the controller worked, etc...). But one obviously stand out: Mojavi. The number one thing about Mojavi3 is that it works only with PHP5 and is fully OOP. Besides that it was easy to implement and although I was not running PHP5 and never ran it as a matter of fact because I didn't want to get rid of my PHP4 installation, I found a way to have both version of PHP running simultaneously on the same machine (see here). In no time yesterday night (which was my first encounter with Mojavi), around 2.50 Am I was running my first small application. Mojavi has turned out to be the best framework I've come accross so far and it totally kicks ass compared to its competitors (IMHO).

To finish up on PHP frameworks, if you need ease of deployment, easy learning curve, OOP based and 3-tier layer applications, Mojavi might be the way forward. But then again, your needs might not be the same as mine.

If you have had experiences with other frameworks, it would hurt to leave your impressions and thoughts in the comment section of this post. ;-)

4 comments:

  1. Did you evaluate the Yellow Duck Framework as well?

    http://www.yellowduck.be/ydf2/

    pieter

    ReplyDelete
  2. Did you evaluate the Yellow Duck Framework as well?

    http://www.yellowduck.be/ydf2/

    pieter

    ReplyDelete
  3. Did you evaluate the Yellow Duck Framework as well?

    http://www.yellowduck.be/ydf2/

    pieter

    ReplyDelete
  4. Did you evaluate the Yellow Duck Framework as well?

    http://www.yellowduck.be/ydf2/

    pieter

    ReplyDelete