Dipping a Toe into Rapid Application Development for PHP

May 2, 2006

News, Zend Framework

As Andi Gutmans presented at his php|tek keynote, and reinforced by IBM in their showing of QEDWiki, there is indeed a place in PHP for the Rapid Application Development. As part of Andi’s keynote, he spoke about component architectures and showed a quick demo of what that might look like in the future. He did so with a proof of concept called phpBlox. Now, don’t get too excited, it looks nice and worked for the demo, but we are still only at the beginning of the Road to RAD.

h3. Component Architecture

RAD development tools tend to have something in common. Besides text editors, file browsers, project managers, and other fancy ways of trying to out shine “VI”:http://thomer.com/vi/vi.html they also have components that can be assembled into bigger things. These can be visual and non-visual components and the bigger things can be anything from business logic modules to full blown forms or web pages. Some examples of component featured languages and platforms include Delphi (VCL), Visual Basic, .NET/ASP.NET, and Java (JavaBeans). Notice I didn’t list PHP. Even though you may find substantial component libraries such as “Prado”:http://www.pradosoft.com/, you won’t find the full development-time experience to go along with the building blocks. Yet.

h3. Rich Design Experience

The components aren’t just pieces of a framework for you to use, they are also designable objects. They are designed to work hand-in-hand with a visual designer. They emote their properties and functions and expose themselves to the design environment so that you can work with each in detail, customizing them as they allow. Components typically present design-time renderings of themselves so that the WYSIWYG environment is just that, a reasonable representation of what to expect at run-time. Maybe not WYSIWYG, but WYSI-almost-WYG. Either way, I’m all for seeing my page or form in as close to a production representation as possible.

h3. Programmatic Model

A good component architecture does not ignore old fashion coding. You don’t just drag things around, draw wires, set properties, and fiddle with the Z-order; you also want to code against the components, render them dynamically, and work from pure code. The code is as important as the design and must be considered from the ground-up when designing a component model. In fact, many visual designers generate real code rather than the old fashion resource files, and can interpret that code back into the design. Therefore you are always working with code and are not stuck with binary, nonmergeable, hard to recover when destroyed files.

h3. Model / View Separation

Something that hasn’t been as well addressed by past component architectures, but something we shouldn’t forget for PHP is that many people use template engines, even PHP itself to provide a separation of their code logic from the view. They build a model, feed the view, and hit the big red RENDER button. A component architecture needs to consider how it will work in this bigger picture and allow that separation to continue. In fact, let’s get really creative here and imagine that we build a model that we want to work across various pages, from within a service call, and even an offline batch application. Now we’re getting somewhere.

h3. Client and Server Event Models

Since we are no longer in the dark ages. We have stopped arguing over thin client vs. fat client vs. service oriented vs. client server vs. bla bla bla. Well, maybe we haven’t but I like to pretend it doesn’t matter. You, as the person trying to get their application finished, should use what works best for your situation, product, company, and happiness. And that will most likely include needing both client and server event models. Therefore the component architecture must be able to differentiate between the two and allow some components to do one, another component the other, and some really fancy ones to do both. AJAX is in the mix there as well with components that are live on both the client and server at the same time, I’m sure using some dark magic that I can’t begin to fathom.

h3. Play Nice with Others

And of course, we should remember what my mother used to say. “For the last time, GET OUT OF THE FLOWERS WITH YOUR SOCCER BALL!” Or maybe “Play nice with others!” works best for this example. The “others” in this case are those other people you work with on a project (and not those guys on the other side of the island), from web designers to graphics designers and script scripters. Having components render based on CSS in a predictable fashion is key. Having components allow skinning is also key. Avoiding too much invasion into the HTML is nice. Yet keeping the design time rendering in the HTML so that designers can play with it, even in some HTML DEVELOPMENT ENVIRONMENT (HDE?) where it has no concept of the components is also a nice gesture. A modern component model should keep these issues in mind.

h3. So Along Came QEDWiki

QEDWiki from IBM is a Wiki that has an understanding of components and macros to embed them in documents. They have a information channel to pass data between components and a very nice WYSIWYG browser based design surface to construct your interactive pages. This has been shown a few times in the past, with the most current, hot-off-the-presses-using-the-Zend-Framework version being seen at their php|tek keynote. They have some great ideas here that show there is even more to component models that we should file away in the “things we must not forget for PHP RAD” file. IBM has taken some nice first steps in this area.

h3. And then Andi Wanted a Demo

As with all keynotes, a demo is worth a thousand words. It is also worth the pain and suffering to get something put together that you know will be tossed in favor of the real development that is happening on the next set of tracks. And phpBlox is one of those demos. And what was this thing that Andi showed?

Andi showed a proof of concept for what the world might be like in a development environment supporting RAD PHP. Since the Eclipse PHP IDE project isn’t at a point where it is sporting a brand-new visual PHP designer with components, we slung together a proof of concept with duct tape and bailing wire (thanks Chuck J for giving me that phrase to use for the rest of my life). We grabbed IE’s editor, pumped out some lines of C#, grabbed the source editor from SharpDevelop, wrote a wrapper for php5activescript.dll, got some PHP designer support code to introspect and understand a simple component model, generate some code, and made some sample components in PHP that supported design-time rendering. Then after a few prayers to the deity known as Murphy, he went on stage.

h3. So What Does All of This Mean?

First, Andi trusts us too much to use a demo like that, and second, that there just might be something here that is more than just a high-level keynote topic. So as the “PHP Collaboration project”:http://www.zend.com/php_collaboration_project continues, the “Zend Framework”:http://framework.zend.com builds a bigger and stronger base, as the “Eclipse PHP IDE”:http://www.zend.com/phpide/ takes shape, and we blather on about programming and best practice topics on the “Developer Zone”:http://devzone.zend.com; we hope to see components start to find their rightful place in the PHP picture.

A “demo video is now available”:http://devzone.zend.com/content/samples/editor/phpblox2/phpblox2.html showing more about this proof of concept.

[ “Digg this!”:http://digg.com/programming/Dipping_a_Toe_into_Rapid_Application_Development_for_PHP ]

11 Responses to “Dipping a Toe into Rapid Application Development for PHP”

  1. symcbean Says:

    Looks impressive, although the tool pallette seemed rather sparse.

    I couldn’t let this go without plugging PFP Studio (http://pfp-studio.sourceforge.net) which is really a visual form painter.

    I cna see the attraction of being able to convert from the code back to the visual design interface – but in practice how important is this?

  2. phpfanatico Says:

    Recently I found another product (still not released), that can be something similar to PHPBlox and it looks more finished, <A HREF="http://www.qadram.com/products.php">check it out</A> there are several screencasts.

  3. redframe Says:

    I also make myself oop navigation.But some rules when display have to figure out.Not all data can be execute from sql data.Sometimes we need to calculate the variable and the information.
    This my technic oop.
    For Query
    if(empty($_GET[‘offset’])) { $_GET[‘offset’]=0; }
    if(empty($_GET[‘order’])) { $_GET[‘order’]="`aktiviti`.`id` desc"; }
    $sql="select * from `aktiviti`";
    if(empty($_GET[‘date’])) { $_GET[‘date’]=date("Ymd"); }
    if($_GET[‘calendar’]=="day") { $sql=$sql." and `productId`.`dateStart`=’".$_GET[‘date’]."’"; }
    elseif($_GET[‘calendar’]=="month") { $sql=$sql." and month(`productId`.`dateStart`)=’".$month."’ and year(`productId`.`dateStart`)=’".$year."’"; }
    elseif($_GET[‘calendar’]=="year") { $sql=$sql." and year(`productId`.`dateStart`)=’".$year."’"; }
    elseif($_GET[‘calendar’]=="between") { $sql=$sql."and `productId`.`dateStart` between ‘".$_GET[‘date1′]."’ and ‘".$_GET[‘date2′]."’ "; }
    if($_GET[‘type’]=="sort") { $sql=$sql." and `name` like ‘".$_GET[‘value’]."%’"; }
    elseif($_GET[‘type’]=="search") { $sql=$sql."and `name` like ‘%".$_GET[‘value’]."%’"; }
    elseif($_GET[‘type’]=="status") { $sql."and `status`=’".$_GET[‘value’]."’"; }
    else { $sql=$sql; }
    $limitQuery=" order by ".$_GET[‘order’]." limit ".$_GET[‘offset’].",$limit";

    For Query next and prev

    <? $ng->prevPage($_GET[‘offset’],$array1,$array2); ?>
    <? $ng->nextPage($_GET[‘offset’],$limit,$countRecord,$array1,$array2); ?>
    I realy think in mind to auto generate script like just phpblox.If so i willing to share the knowledge.Total Cool.

  4. gcarreno Says:

    The phpBlox is awsome and definitly what I wanted my preferred language (Second to Delhpi), to reach my other preferred language (First from PHP).
    But you guys leave us with a watering mouth :(
    What ?!?! No code, just a bunch of buzzword throwned into a blender and RRRBBRRZZZ comes phpBlox?!?!?
    Show us that IE editor, the C# code the whatever thing and thinguy you guys concocted to do this IDE for a 5 min podcast!!!!

    I’m getting in a frenzy here, please apease this urge to get my hands on some code !!!

  5. devzone_editor Says:

    Yes, I feel sorry now for anyone else using IconExperience graphics in their prototypes, they’ll all look like they are copying the phpBlox proof of concept without even knowing why. (by the way, stacked 3 colored cubes are in Collection 2 if you want any) I knew I should have discarded them back in 2004, but I’ve always loved the cute little bug icons.

  6. solutionsphp Says:

    I haven’t used TurboPHP, though it looks as interesting as phpBlox. phpBlox has certainly borrowed from their identity concept, you can see the similarity between the two product icons: http://www.turbophp.com/images/tp_publish_turbophp.png

  7. devzone_editor Says:

    I have updated the demo to redirect to a more complete version that talks a bit more about the concept and explores it further. The link redirect changed as of Noon PDT today.

  8. devzone_editor Says:

    Sure, TurboPHP is along similar lines: a component model and IDE for PHP that work together. And there are probably others out there as well. And they are examples of the basic idea. But to be clear, TurboPHP is not pure PHP designable components. It is Delphi-wrapped proxies for PHP code that mimic the PHP in the designer. Still, I applaud them for taking a stab at bringing components to PHP.

    A main goal for us was to do full in-place WYSIWYG with real PHP components. Another goal was to show an IDE working with components that it does not have prior understanding of and yet could still control their design behavior. It is not tightly coupled to THOSE components, but to components LIKE them. And just “showing the idea” was the purpose, any real IDE product will come out of the Eclipse PHP IDE work. And that would need a component architecture to work along side, as would any other IDE wanting to do the same.

    To have a successful component model for PHP, the component model and the tooling need to grow up side-by-side so that they support each other, but both sides need to be up to the task. Any shortcut to make one side easier, defeats the ability to have a large ecosystem of components for all of us to benefit from.

  9. justinwoods Says:

    Definitely puts my home-brew solution to shame!

  10. thedude1904 Says:

    Isn’t this a bit a copy of Turbophp? Never used it, but it looks exactly the same

  11. devzone_editor Says:

    For a short time, the demo video will be made available here on the Zend Developer Zone. This is not from the actual keynote but is similar to Andi’s demo and was a prepatory walkthrough. I think Andi is more fun to listen to than I am, but so be it.