Dipping a Toe into Rapid Application Development for PHP

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”:https://devzone.zend.com; we hope to see components start to find their rightful place in the PHP picture.

A “demo video is now available”:https://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 ]