Archive for May 2010

Post Archives
Archive for May, 2010

Yii DAO vs Active Record Performance

May 29th, 2010 10 comments

I’m writing a new app using Yii Framework, but one of my concerns with Yii has been the impact of using ActiveRecord and ORM on the application performance, so I decided to actually compare how the two perform and the results are quite interesting…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Codeigniter Template Layouts

May 28th, 2010 6 comments

All I have to say is WOW… I decided to give CodeIgniter a try as it’s a pretty light weight library and doesn’t try to force you into using ActiveRecord, but guess what?  There isn’t a built-in template layout concept so you can add a consistent header and footer and that’s like the most common thing anyone will do with a website.

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Object Oriented Design Pattern for Database Driven Applications

May 27th, 2010 1 comment

I’ve been working with database driven applications and object oriented programming for a while now and every time I try to marry up the two patterns I cringe.  Many people seem to love ActiveRecord pattern but it has many shortcomings in that it can only deal with very simple applications and everything is in one place.  Likewise DataMapper at the other extreme is quite complex and you end up doing a lot of shuffling of data in the application.  However what’s even worse is that in complex database driven applications you often want to do things like retrieve results which can span multiple tables and you only need to take a little bit of data from each table.  A good example of this is an Order that was placed by a Customer who belongs to an Account.  With a full object oriented domain model you’d have the following options none of which are great…

Read more…

Share
Categories: Programming Tags:

Writing a Fast PHP MVC Framework – Part 1

May 26th, 2010 8 comments

Well, after tossing and turning and considering using Yii and CodeIgniter, I’ve decided to bite the bullet and write my own fast PHP MVC Framework, that’s not bloated with features or compatibility layers I don’t want and takes advantage of PHP5.  Why re-invent the wheel you ask?  Because in my view what’s current out there is bloated and not quite what I want and most importantly ultimately impacts performance, which I very much about.  This framework that I’m writing is going to focus on speed and keeping ways to do something to an absolute minimum and do only what’s required.  For example, Yii is hell-bent on using ActiveRecord for everything and if you look at the code for active record with it’s built in ORM it’s like 2000 lines of code to generate SQL that you can write yourself just as easily.  With or without opcode caching lots and lots of code, lots and lots of files and all the un-necessary logic is still going to slow things down.  In CI’s care it’s nice and all, but it doesn’t play nicely with PHP IDEs atm so you better know the classes and methods pretty well.  Also, I can’t say I see the reason for doing things like defining file extentions (i.e. .php) as a constant, implementing fancy stuff like :any in the router and so on… just un-necessary logic… but as I said the biggest issue is not playing nice with PHP IDEs like NetBeans and Eclipse PDT.  The closest thing I’ve found to what I like has been what Daniel’s implemented in OpenCart which is somewhat based on PHP Pro MVC tutorial.  So to get started…

Read more…

Share
Categories: PHP MVC Frameworks Tags: