ASP-Style Programming in PHP?

An old buddy of mine wants to start using PHP, but the problem is that he’s been working with Microsoft technologies for so long, he doesn’t get “the PHP way”. His background, for many years, has been with ASP.NET, COM, and those sorts of things.

As it turns out, there’s a PHP framework out there that maps well to “the ASP.NET way”: Prado.

http://www.pradosoft.com/

They’re at a 3.0 release as of a week ago, and won the Zend PHP5 competition last year, so that should speak to the quality of the software. From the page about PRADO we can see they base their concepts on a component model, so it’s very like Apache Tapestry, Borland Delphi, and (for the guy who asked me originally) Microsoft ASP:

Most PHP frameworks are trying to establish a loose standard of organizing PHP programming, most preferably the MVC (model-view-controller) model. It is difficult to compare PRADO with these frameworks because they have different focuses. What we can say is, PRADO is more like a high-level language built upon PHP while those MVC frameworks stand for the best programming practices. Both aim to help developers to rapidly complete Web application development. The advantage of PRADO is its rich set of prebuilt powerful components and extreme reusability of the PRADO code, while the advantage of the MVC frameworks is the complete separation of model, view and controller, which greatly facilitates team integration.

I can see that PRADO is very much *not* my style; I don’t know a lot of open-source scripter types (Perl/PHP/Python/Ruby) who would really go for this, as it seems over-architected to me. This is not meant as a critical point against PRADO, because it obviously fills the needs for those who like that style of programming. Personally, I don’t really want another language on top of PHP (this relates back to why I started Savant; i.e., as a response to Smarty). But if you’re used to Microsoft or Java, I can see how this would be an easy way to get on board in the open-source world and start using PHP with your previous non-PHP habits.

Which brings me to a philosophical point: is there a better phrase than “the PHP way” to describe the way we expect PHP apps to be built, or some sort of metaphor that encapsulates the concepts related to “the PHP way”? Not just MVC, because PRADO appears to do that, but some other way of describing succinctly how a PHP app “ought” to be. Maybe there isn’t one single description.

Having said that, I think these template notes from the WACT project might be useful hints; see also here. My bet is that the greater majority of PHP/Perl/Python/Ruby programmers are “imperative” guys than “declarative” guys, and maybe that plays into what a proper metaphor might be. Prado/ASP.NET are clearly more declarative, and Savant/Solar/etc are clearly more imperative. Perhaps Less Code is related to the metaphor we want.

I’d be interested to hear comments and feedback, if for no other reason than to compare and contrast the different approaches.

UPDATE (2006-05-04): Interesting analysis from here; note that it is originally from Dec 2005.

Are you stuck with a legacy PHP application? Subscribe to "Modernizing Legacy Applications in PHP" for tips, tools, and techniques that can help you improve your codebase and your work life!

7 thoughts on “ASP-Style Programming in PHP?

  1. Please, when you think “ASP.NET”, write “ASP.NET”, not “ASP”. It’s quite paradoxical that classic ASP does it “PHP way”.

    But thank you for this article. It’s interesting to see how PHP guy looks on declarative frameworks like ASP.NET or PRADO. Personally, I see advantages of both approaches.

  2. Borek — seeing as I know almost nothing about ASP[.NET], I’ll take your advice here and update the text. Thanks for the tip.

    And yes, I see advantages to the declarative approach too; I just don’t “think” that way most of the time when it comes to programming (data retrieval, sure, but not data manipulation).

  3. […] This post is a response to Paul M. Jones post called “ASP-style programming in PHP?“. Paul is the man behind the Solar system and Savant, a light-weight templating system for PHP. In his post he talks about “the ASP way” and “the PHP way” of web application development in PHP and directly relates “the ASP way” to the PRADO Framework. As it turns out, there’s a PHP framework out there that maps well to “the ASP way”: Prado. […]

  4. Request/Response or Bust

    My friend Paul M. Jones recently wrote about a component-framework called PRADO. The idea of a component framework for PHP is certainly nothing new, with PRADO having won Zend’s coding contest a full year ago. There’s even phpBeans, and …

  5. Nevermind, I don’t like PRADO and never use it. I loves working with the real PHP way. I think another real PHP way framework e.g like yours Solar, Zend Framework, Mojavi etc good to, I dunno which best.

Leave a Reply

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