# PHP RADness

Published: 2005-12-02

<p>Now, we all love (or hate, or don't give a <a href="http://images.google.pt/images?hl=pt-PT&q=rats%20bottom&btnG=Pesquisa+Google&sa=N&tab=wi">rats bottom</a>) <a href="http://www.php.net">PHP</a> and despite <a href="http://gridpt1.fe.up.pt/mlopes/blog/index.php/2005/11/25/some-interesting-links/">Mario's optimistic claim that PHP as any resemblance to</a> <acronym title="Rapid application development">RAD</acronym> the truth is that it isn't so all by it's self (think <a href="http://www.ruby-lang.org">Ruby</a> <a href="http://www.rubyonrails.org/">derailed</a>) (and yes, Mario probably didn't mean the way I'm saying it ;) ) , for that, we need tools and strategies to help us get into <a href="http://en.wikipedia.org/wiki/Rapid_application_development">RADness</a> gear, and here are two of them :) .</p>
<h3><a href="http://www.ezpdo.net/">EZPDO</a></h3>
<p>So, accessing data ranges from non-existing to being Da Thing on an application. The usual fire and forget take on things is direct usage of file functions, or DBMS API functions smack in the middle of that magical PHP file that spews HTML for a living, now, don't get me wrong, I might not like it (I don't, actually :) ) but when push comes to shove and things get practical ... that's as practical as things get. <a href="http://www.ezpdo.net/">EZPDO</a> on the other hand is for that gentler, more structured approach to things, it's basically a <a href="http://www.service-architecture.com/object-relational-mapping/">Object-Relational Mapping</a> tool and it seems pretty cool and easy. It generates classes that handle your Database Tables, generates the Database Tables if you don't have them, uses <a href="http://www.martinfowler.com/eaaCatalog/lazyLoad.html">Lazy Loading</a> and might actually save lives ... then again it may not, but here, you know have the option of trying it out :).</p>
<p>Why don't I use it? (who asked that??) Well, I've been sort of implementing my own version of the <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">DataAccessObject Pattern</a> even before I knew it was an official Pattern :D .. that's the thing with patterns, they emerge, they're not invented :) , and it has a few resemblances and differences (for one, I don't care what the DataStore is, from a FlatFile to a SOAP Service passing through DBMS I can have a DAO for each one) , but it's my baby and I'll stick with it for a while longer (I'm trying to stabilize the System Approach so that I can build some CodeGeneration Tool) BUT .... I'll certainly keep an eye on this one, if nothing else to look for validation :D (I know, if I want validation, I should look at <a href="http://www.hibernate.org">Hibernate</a> :D ).</p>
<h3><a href="http://sourceforge.net/projects/xmi2php">xmi2php</a></h3>
<p>
<blockquote>XMI2PHP is a tool for automatic generation PHP class files from XMI files. It is not only able to generate new files but also to update previously generated files for which it preserves changes made since first generation or previous update.</p></blockquote>
<p>War, what is it good for? Well, it's good for those of you who are <a href="http://www.uml.org/">UML</a> geeks and use,for example ,<a href="http://argouml.tigris.org/">ArgoUML</a>. Now, the whole idea is that you visually create your Class and Packages (errr, ok, leave the Packaging for <a href="http://www.zend.com/zend/week/week250.php">PHP 6.0</a> :( ), export everything to an <a href="http://www.omg.org/technology/documents/formal/xmi.htm">XMI</a> file, run them through <a href="http://sourceforge.net/projects/xmi2php">xmi2php</a> and pufff (no, no little chocolate breakfast cereals appear) PHP files filled with code show up at your doorstep ... how RAD is that? ;)</p>
<p></p>
<p>Cool? Not Cool?? Say so, I'm very interested in hearing about your own Data Layer and RAD strategies, not just on the PHP side (but please, we all know how cool M$ VisuaStudio is, so none of that :) ), so share it here, and if you do use the ones I've talked about, tell me about your experience ... just don't ask me for money or try to sell me pills (of any color), ok? :D, cheers</p>
