PHP Prado, Yii, and Building UI Architecture in the Right Place
I've been spending a minuscule amount of time as of late scrutinizing PHP frameworks - largely because it's so damn difficult to build anything that can be deployed to a cheap hosting provider in Java or .Net. In my travels these last few years, my conclusion is that Java is just terrible at handling web UI architecture and that the servlet architecture is horribly broken. But you already knew that.
ASP.Net is fascinating in that it really tries to port good classic MVP modeling to a web architecture. But we live in a world today that needs two models of web application development - one that focuses intently on transactional operations and can adhere to the infrastructure that ASP.Net or even Java Server Faces provide, or one that is totally dependent on the faclities of the browser. Where Microsoft and Sun/JBoss/OSS have gone totally off the deep end is in the latter case by trying to solve client side issues on the server.
So I looked at PHP Prado the other day, and saw that it's more or less a direct port of the ASP.Net architecture. Fair enough. I can't see how it can be performant or scale - it's taking the pig of ASP and adding a significant hassle in backing it with a scripting language. But as I dove deeper and tried to find out how it supported AJAX, I saw that it made the same mistakes that ASP and JSF had made by trying to adapt the server-supported client UI architecture into a model where the server really had very little to do with the presentation.
I'm now off and looking for a PHP framework that doesn't attempt to solve the problem in this way. Microsoft has already figured out that it's incredibly complicated to accomodate both paradigms of web development throug a UI architecture that was initially developed to run from the server and has built ASP.Net MVC and WCF to support a model where the coupling is much looser. Maybe someday, Java will get it (though I will cop to not knowing what people in the Spring world are doing, and they tend to be a bit ahead of the curve in these matters). I'm now looking at PHP Yii, and it looks like another dreaded rails-inspired framework. However, if it's not trying to boil the ocean with complex UI architecture and tell the browser to handle things as it may, perhaps I can be won over to the rails-religion yet.
February 8th, 2009 - 17:04
Ryan – thought I might also point you in the direction of the Recess PHP Framework (http://www.recessframework.org/) It’s a young, RESTful PHP framework which draws inspiration from a number of other sources. Currently the UI layer is really simplistic and does not impose much architecturally. We’ve got some plans for doing a better job on the front-end and will be going in the direction you suggest (moving UI logic to Javascript + REST). It’s still early but I think we’ve got an exciting start.
Cheers – Kris Jordan
February 8th, 2009 - 17:35
Thanks for the heads up, Kris. I’m intrigued by the annotation approach you’re taking – very interested to see how that performs. I generally like the idea of “convention over configuration,” but I do think rails-like frameworks definitely move the bar a lot closer to chaos than something scalable. As I evaluate PHP frameworks for some work I’m doing for Medullan, I’ll definitely poll your project to see if it can deliver something that we can rapidly deploy.
April 1st, 2009 - 09:26
I’m curious to know what technologies you use. You seem to dislike almost all of them…
April 1st, 2009 - 09:34
I think on the PHP platform that there are just a lot of options. It’s not that I dislike all of them – I just think there’s a certain amount of ambiguity about best practice, and that affects technology selection. At the end of the day, I’m pretty interested in finding the best tool for the job. I might not think the tool is particularly portable though (Drupal, for instance helped my company get a site up for a client pretty quickly – but it’s not a dev platform I would use for a workflow management application, for example).
The last few years I’ve been pretty immersed in Java and .Net – so I’ve seen the impact that a base set of standard APIs can have on a platform – as well as some generally accepted ones. Spring is an ad hoc framework, and it’s architecture has allowed for numerous packages to extend and decorate it (I spoke to a company about a Wicket/Spring-based platform a few weeks ago). But nothing in PHP really matches the impact that Sun or Apache has had on finding a primary direction for the extension of the Java platform. Maybe one day Zend will be that beast – but even they are just looking to create competing frameworks. I think PHP could benefit from some standard API development that the various frameworks could code to to ensure portability of solutions, and compete on value-adds rather than approaches.