<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Professional PHP &#187; PHP</title>
	<atom:link href="http://www.procata.com/blog/archives/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.procata.com/blog</link>
	<description>PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.</description>
	<lastBuildDate>Fri, 10 Dec 2010 17:23:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>php &#124; tek 2008</title>
		<link>http://www.procata.com/blog/archives/2008/05/20/php-tek-2008/</link>
		<comments>http://www.procata.com/blog/archives/2008/05/20/php-tek-2008/#comments</comments>
		<pubDate>Tue, 20 May 2008 16:17:31 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2008/05/20/php-tek-2008/</guid>
		<description><![CDATA[Well, I&#8217;ve made it to PHP&#124;tek in Chicago.  I flew in last night, had a beer with Jason and then used the WiFi in the lobby to spin up an extra large EC2 instance (via RightScale) to do some benchmarks for one of my talks.  I&#8217;m using the the XL instance because it [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.procata.com/blog/wp-content/uploads/2008/05/elephant.jpg' alt='PHP Elephant' align='right' hspace='20' />Well, I&#8217;ve made it to PHP|tek in Chicago.  I flew in last night, had a beer with <a href="http://blog.casey-sweat.us/">Jason</a> and then used the WiFi in the lobby to spin up an extra large EC2 instance (via <a href="http://www.rightscale.com/m/">RightScale</a>) to do some benchmarks for one of my talks.  I&#8217;m using the the XL instance because it it is <a href="http://oren.blogs.com/praxis/2008/04/the-amazon-ec2.html">not shared</a> with other users.</p>
<p>I&#8217;m still putting the final touches on my slides.</p>
<ul>
<li><a href="http://tek.phparch.com/c/schedule/talk/d1s6/1">Exceptional PHP</a></li>
<li><a href="http://tek.phparch.com/c/schedule/talk/d2s5/0">Coding for Success: Writing Software You&#8217;ll Be Able To Understand Next Month</a></li>
</ul>
<p>I&#8217;m blogging this from <a href="http://www.cdatazone.org/">Rob Richards&#8217;</a> Working With Web Services presentation.  Oh yeah, I work with Rob.  Oh yeah, since, I haven&#8217;t posted anything in six months &#8230;  In January, I moved to San Francisco and started work at <a href="http://www.mashery.com/">Mashery</a>.  I realized from talking with Jason last night that I really haven&#8217;t mentioned that here.  They&#8217;ve been keeping me pretty busy, hence the lack of blogging.</p>
<p>php|tek is <a href="https://twitter.com/phptek">on twitter</a>.  So, I&#8217;ve finally signed up <a href="http://twitter.com/Selkirk">there</a>.  I don&#8217;t get it.  <img src='http://www.procata.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One last thing, Mashery is <a href="http://www.mashery.com/jobs">Hiring</a> good PHP and Javascript programmers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2008/05/20/php-tek-2008/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Keywords and Language Simplicity</title>
		<link>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/</link>
		<comments>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 18:38:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[language-comparison]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming-language]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/</guid>
		<description><![CDATA[Well, I like programming language comparisons, so how could I resist this chart (via) promoting the simplicity of the io language by pointing out how few keywords it has.  The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords.  Perhaps that reflects Java&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I like programming language comparisons, so how could I resist <a href="http://iolanguage.com/about/simplicity/">this chart</a> (<a href="http://programming.reddit.com/info/2z11k/comments">via</a>) promoting the simplicity of the io language by pointing out how few keywords it has.  The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords.  Perhaps that reflects Java&#8217;s heritage as a simplification of C++ (63 keywords) and PHP&#8217;s heritage as an amplification of C (37 keywords) toward a specific purpose?  As usual, Perl is the poster child for language complexity.  Ruby does well with 40 keywords. But, before the Ruby fans get too uppity about the simplicity of their language, they should contemplate the <a href="http://www.zenspider.com/Languages/Ruby/QuickRef.html#18">cat walked across the keyboard while I was holding down the shift key</a> predefined variables that they inherited from Perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>php&#124;tek Slides</title>
		<link>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/</link>
		<comments>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/#comments</comments>
		<pubDate>Sat, 19 May 2007 19:41:20 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[conference]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/05/19/phptek-slides/</guid>
		<description><![CDATA[Well, php&#124;tek is over.  It was a great conference and I&#8217;m really glad I went.  This was my first PHP conference.
One of my main goals was to meet some of the folks at php&#124;architect.  I&#8217;ve been writing the Test Pattern column for them for over a year now.  I was finally [...]]]></description>
			<content:encoded><![CDATA[<p>Well, php|tek is over.  It was a great conference and I&#8217;m really glad I went.  This was my first PHP conference.</p>
<p>One of my main goals was to meet some of the folks at php|architect.  I&#8217;ve been writing the Test Pattern column for them for over a year now.  I was finally able to put faces to the names that I keep seeing in my email box.  Actually, one of the cooler things about the conference was meeting people who I&#8217;m familiar with from online, either from forums, IRC, mailing lists or blogs.</p>
<p>I&#8217;d like to thank everyone who attended my sessions.  Here are the slides from each session:</p>
<ul>
<li><a href="http://www.procata.com/talks/phptek-may2007-maintainable.pdf">Writing Maintainable PHP Code</a> (PDF)  &#8211; based on my <a href="http://www.phparch.com/issue.php?mid=76">March 2006</a> column.</li>
<li><a href="http://www.procata.com/talks/phptek-may2007-dependency.pdf">Dependency Injection</a> (PDF) &#8211; based on my <a href="http://www.phparch.com/issue.php?mid=82">June 2006</a> column.</li>
<li><a href="http://www.procata.com/talks/phptek-may2007-exceptional.pdf">Exceptional PHP</a> (PDF) &#8211; based on my <a href="http://www.phparch.com/issue.php?mid=94">December 2006</a> column.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Delphi for PHP</title>
		<link>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/</link>
		<comments>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 18:55:39 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[delphi-for-php]]></category>
		<category><![CDATA[delphi4php]]></category>
		<category><![CDATA[vcl]]></category>
		<category><![CDATA[vcl4php]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/</guid>
		<description><![CDATA[I have to comment on this week&#8217;s annoucement of Delphi for PHP.  I was a Delphi programmer for about 5 years before taking up PHP about 6 years ago.  What a convergence.
I have a great fondness and respect for the old Object Pascal based Delphi.  Delphi&#8217;s VCL has been influential, inspiring the [...]]]></description>
			<content:encoded><![CDATA[<p>I have to comment on this week&#8217;s annoucement of <a href="http://www.codegear.com/Products/Delphi/DelphiforPHP/tabid/237/Default.aspx">Delphi for PHP</a>.  I was a Delphi programmer for about 5 years before taking up PHP about 6 years ago.  What a convergence.</p>
<p>I have a great fondness and respect for the old Object Pascal based Delphi.  Delphi&#8217;s VCL has been influential, inspiring the GUI components in Java.  And, of course <a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg">Ander Heijlsberg</a> went on to put a huge stamp on C# and .NET that would be familiar to any Delphi programmers.</p>
<p>I&#8217;ve always admired this approach of extending the language syntax to make common things easy and for the integration between the language and the tools. In Delphi, this was evidenced by the excellent properties support.  Six years later, this is the feature I miss the most in PHP.  This language extension approach has seen its culmination in C# and <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx">LINQ</a>.  It almost pains me to say it, but the cutting edge of commercial language design is at Microsoft now.</p>
<p>On the other hand, I&#8217;ve never had that much respect for Borland as a company. We were big enough to have Borland representative&#8217;s come to our office and try sell us their products.  They were terrible at the mechanics of selling into big companies.  I was in their beta programs.  I went to their conferences.  I&#8217;ve never had any sense that they know what they are doing business wise.  Inprise?  What were they thinking?  Now here they are, just having gotten their asses kicked by eclipse in the Java IDE space and what are they working on?  They release an IDE for PHP, just as Zend is embracing Eclipse in the PHP space.  Brilliant!</p>
<p>I don&#8217;t quite know what Delphi means now.  To me, its always been and IDE plus Object Pascal.  What is it now? I also don&#8217;t quite know what Borland has become.  Is it <a href="http://www.codegear.com/">CodeGear</a> now?  I guess that the Delphi for PHP IDE comes from <a href="http://www.qadram.com/">Quadram</a> and their now discontinued QStudio product.  And the VCL is their WCL (no linkage found).  Anytime I&#8217;ve been touched by the corporate entity that was Borland, confusion ensued.  I&#8217;m confused now.</p>
<p>It appears that the <a href="http://sourceforge.net/projects/vcl4php">PHP version of the VCL</a> will be released on open source.  There is nothing at the sourceforge project, yet, but I&#8217;ll be interested to see what it looks like, if only for old times sake.</p>
<p>The Delphi tool approach was to serialize an object based representation of an application, then offer tools to create that serialized representation, and to load that representation at run time.  In Delphi, that serialization was done into the form files (.DFM).  I&#8217;ll be interested to see how Delphi for PHP does it.  Perhaps, this is an area where the <a href="http://www.zend.com/pdt">Eclipse PHP Development Tool</a> can learn. I know that I definitely had Delphi in mind when I was writing my column  on <a href="http://www.phparch.com/issue.php?mid=98">Object Serialization</a> for this month&#8217;s php | Architect.</p>
<p>Meanwhile, if you want to see the Delphi influence in PHP with code that you can download today, take a look at the <a href="http://www.xisc.com/">Prado</a> framework, which I imagine to be like the VCL for PHP, but without the supporting IDE.</p>
<p>This is a space I&#8217;ll definitely be watching.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>OOP is Mature, not Dead</title>
		<link>http://www.procata.com/blog/archives/2007/01/07/oop-is-mature-not-dead/</link>
		<comments>http://www.procata.com/blog/archives/2007/01/07/oop-is-mature-not-dead/#comments</comments>
		<pubDate>Sun, 07 Jan 2007 20:51:16 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[late-static-binding]]></category>
		<category><![CDATA[object-oriented-programming]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[uniform-access-principle]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/01/07/oop-is-mature-not-dead/</guid>
		<description><![CDATA[I ran across an interesting series of blog posts by Karsten Wagner claiming that OOP is dead (part 2 and part 3).  The premise behind these posts is that OOP has failed to deliver and that it is on the decline in favor of more functional or meta programming techniques.  Maybe its true [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across an interesting series of blog posts by Karsten Wagner claiming that <a href="http://kawagner.blogspot.com/2006/08/oop-is-dead.html">OOP is dead</a> (<a href="http://kawagner.blogspot.com/2006/08/oop-is-dead-part-2.html">part 2</a> and <a href="http://kawagner.blogspot.com/2006/08/oop-is-dead-part-3.html">part 3</a>).  The premise behind these posts is that OOP has failed to deliver and that it is on the decline in favor of more functional or meta programming techniques.  Maybe its true that the discussion of the merits of OOP is on the decline.  At least if you read <a href="http://reddit.com/">reddit</a>.</p>
<p>However, OOP is not on the decline.  Quite simply, it has become mature.  The discussion may be on the decline because almost every language that anyone actually uses implements a core set of OOP features.  OOP has won its arguments.  Good luck taking a language mainstream without it.</p>
<p>Oh, yeah, there are some OOP features that are still controversial or unusual.  There is the single versus multiple inheritance debate, or perhaps Ruby&#8217;s open classes.  But, I think these things have a way of cross-pollinating across the popular languages when they make sense.</p>
<p>A good example of this cross-pollination is happening now with properties, accessor methods and the <a href="http://en.wikipedia.org/wiki/Uniform_access_principle">uniform access principle</a>.  Language support for declared accessor method is slowly creeping across all of the major languages.  Not that Objective C is all that popular, but <a href="http://developer.apple.com/leopard/overview/tools.html">Objective C 2.0</a> adds support for &#8216;em.  Even stodgy old Java is considering <a href="http://www.javalobby.org/java/forums/t88090.html">language level property support</a>.</p>
<p>Sadly, PHP does not yet have language support for declared properties with accessor methods.  What are <a href="http://us2.php.net/manual/en/language.oop5.overloading.php">__get and __set</a>?  They&#8217;re property missing handlers, not accessor methods.  You can simulate accessor methods with them, but that is a poor solution for most applications.  There is no way to support differing visibility, for example protected setters and public getters.  Property not found handlers are prohibitively verbose to write, have a poor performance profile, have no capability for reflection, cause interoperability problems, and have inheritance edge case gotchas (not present in the java beans model, for example).  My hope is to see good language support for properties in PHP 6.</p>
<p>Closures may not be object oriented, but they seem to be undergoing that same language cross-pollination.  Thats seems to be a pretty good sign that they are useful.  It doesn&#8217;t have to be closures OR objects, it can be closures AND objects.  We can use each when they make sense.</p>
<p>Closures are another wish list item for PHP 6.  PHP is almost wired for them with its <a href="http://us2.php.net/callback">callback</a> psuedo type.  Everywhere you can use a callback in PHP, you could use a closure.  I&#8217;d like to see the callback Pinocchio become a real boy like integer or boolean.  The cool thing is that with PHP&#8217;s weak typing the string and array forms of the callback pseudo-type can automatically be converted to a native closure type when needed.</p>
<p>As I said, the core OOP features that most programmers use are in all the mainstream languages.  The interesting part is how they handle the OOP edge cases.  This is the space where the framework developers live.  As I wrote in <a href="http://www.procata.com/blog/archives/2006/01/13/building-a-culture-of-objects-in-php/">culture of objects</a>, PHP has some problems here.  In some ways I think Ruby&#8217;s support for edge cases is exactly what allow a framework such as rails to be built in it, although, I&#8217;m not familiar enough with Ruby to say for certain.</p>
<p>I think addressing some of these issues in PHP 6 will make it a Ruby killer for web applications.  It isn&#8217;t necessary to be perfect here, just to be good enough and allow the larger community, distribution, and stability to take over.  Unfortunately, there is a long lead time here.  If PHP 6  were to add support for declared accessor methods, closures, and late static binding &#8212; my top three framework enablers &#8212; it would still be at least 2-3 years before PHP 6 was sufficiently deployed and the frameworks could adapt to the new features.</p>
<p>In the meantime, while the PHP culture may have problems, the Ruby culture may not be without its own problems.  The influx of <a href="http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp">lisp</a> and smalltalk programmers, two languages that did not go &#8220;mainstream&#8221; may <a href="http://beust.com/weblog/archives/000382.html">prevent Ruby from going mainstream</a>.  Take a look at <a href="http://blog.lostlake.org/index.php?/archives/11-The-Impending-Ruby-Fracture.html">The impending ruby fracture</a>.  Isn&#8217;t this one of the things that happened to SmallTalk and Lisp?  I&#8217;m still not convinced that Ruby hasn&#8217;t inherited many of the same maintenance problems from its Perl heritage.  Just like english, huh?  Only time will reveal Ruby&#8217;s maintenance characteristics.  I give it about 2 to 3 years for today&#8217;s Rails systems to hit full legacy mode. How long do you think it will take for top notch unicode support in Ruby?</p>
<p>Obviously PHP 6 is all about teh unicode.  Including an opcode cache is going to be an important performance and adoption driver.  However, I&#8217;d like to see more progress on framework enablers.  I really want to see these in the next major PHP deployment cycle and not in the PHP 7 deployment cycle.  Are there framework enablers other than closures, declared property accessors and late static binding that I have overlooked?</p>
<p>I have high hopes for PHP 6 as a mature and mainstream language.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/01/07/oop-is-mature-not-dead/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>PDO versus MDB2</title>
		<link>http://www.procata.com/blog/archives/2006/12/26/pdo-versus-mdb2/</link>
		<comments>http://www.procata.com/blog/archives/2006/12/26/pdo-versus-mdb2/#comments</comments>
		<pubDate>Tue, 26 Dec 2006 22:26:49 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mdb2]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pdo]]></category>
		<category><![CDATA[prepared-statement]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2006/12/26/pdo-versus-mdb2/</guid>
		<description><![CDATA[I was just putting together a small test program and I thought I would try using PDO.  I really haven&#8217;t done anything serious with PDO, just try it a couple times.  After recompiling PHP to include the mysql driver for PDO, I coded up the first version of my test program:
&#160;
$db = new [...]]]></description>
			<content:encoded><![CDATA[<p>I was just putting together a small test program and I thought I would try using PDO.  I really haven&#8217;t done anything serious with PDO, just try it a couple times.  After recompiling PHP to include the mysql driver for PDO, I coded up the first version of my test program:</p>
<p><pre class="php">&nbsp;
<span style="color: #0000ff;">$db</span> = <span style="color: #000000; font-weight: bold;">new</span> PDO<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'mysql:host=localhost;dbname=example'</span>, <span style="color: #ff0000;">'example'</span>, <span style="color: #ff0000;">'secret'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$tags</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;
    SELECT 
        * 
    FROM 
        bookmark_tags, tags 
    WHERE 
        bookmark_tags.bookmark_id = ? AND 
        tags.id = bookmark_tags.tag_id 
    ORDER BY 
        tags.name&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$bookmarks</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SELECT * FROM bookmarks ORDER BY Title&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$bookmarks</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bookmark</span> = <span style="color: #0000ff;">$bookmarks</span>-&gt;<span style="color: #006600;">fetchObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;li&gt;&lt;a href='{$bookmark-&gt;url}'&gt;{$bookmark-&gt;title}&lt;/a&gt; &quot;</span>;
    
    <span style="color: #0000ff;">$tags</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bookmark</span>-&gt;<span style="color: #006600;">id</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tag</span> = <span style="color: #0000ff;">$tags</span>-&gt;<span style="color: #006600;">fetchObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$tag</span>-&gt;<span style="color: #006600;">name</span>, <span style="color: #ff0000;">&quot; &quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
&nbsp;</pre></p>
<p>Unfortunately, this didn&#8217;t work and it took me a few minutes to figure out why.  Actually, I still don&#8217;t know exactly why it doesn&#8217;t work, but I did find a way to make it work: by using two separate connections, one for each prepared statement.  It doesn&#8217;t seem like you can have two active statements at the same time on the same connection.  I find this hard to believe, so I&#8217;m probably doing something wrong.</p>
<p>The other thing I didn&#8217;t care for with this PDO code is the non-standard method of iteration with the while loop.  Well, the while loop is perfectly standard if you are coming from the PHP 4 style functional DB APIs.  However, it doesn&#8217;t seem to fit in with the PHP 5 Iterator and foreach integration.  PDO doesn&#8217;t seem to provide a distinct result set object, or a method of iterating over a result set using the standard PHP Iterator interface.</p>
<p>Now, I can understand why this may be the case.  The PDO interface seems to be designed to bind to php variables.  Thats not going to work with the Iterator interface.  However, I am not using that mode and don&#8217;t want to use that mode.  It would be nice to be able to acquire an iterator for an example of use such as the one above without having to use fetchAll and ArrayIterator.</p>
<p>Using the Iterator style makes it easier for me to decouple my code from the data source and makes it easier to write test cases for that code.</p>
<p>I was a little bit disappointed.  So I moved on to MDB2 with the same code &#8230;</p>
<p><pre class="php">&nbsp;
<span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">'MDB2.php'</span>;
<span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">'MDB2/iterator.php'</span>;
&nbsp;
<span style="color: #0000ff;">$db</span> = MDB2::<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mysql://example:secret@localhost/example&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$tagLookup</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;
    SELECT 
        * 
    FROM 
        bookmark_tags, tags 
    WHERE 
        bookmark_tags.bookmark_id = ? AND 
        tags.id = bookmark_tags.tag_id 
    ORDER BY 
        tags.name&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">$bookmarkFinder</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SELECT * FROM bookmarks ORDER BY Title&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0000ff;">$bookmarks</span> = <span style="color: #000000; font-weight: bold;">new</span> MDB2_Iterator<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bookmarkFinder</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, MDB2_FETCHMODE_OBJECT<span style="color: #66cc66;">&#41;</span>;
    
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bookmarks</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$bookmark</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;li&gt;&lt;a href='{$bookmark-&gt;url}'&gt;{$bookmark-&gt;title}&lt;/a&gt; &quot;</span>;
&nbsp;
    <span style="color: #0000ff;">$tags</span> = <span style="color: #000000; font-weight: bold;">new</span> MDB2_Iterator<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tagLookup</span>-&gt;<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bookmark</span>-&gt;<span style="color: #006600;">id</span><span style="color: #66cc66;">&#41;</span>, MDB2_FETCHMODE_OBJECT<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$tag</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$tag</span>-&gt;<span style="color: #006600;">name</span>, <span style="color: #ff0000;">&quot; &quot;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
&nbsp;</pre></p>
<p>I have about the same level of non-experience with MDB2 as with PDO, but my code worked perfectly on the first try and allowed me to use Iterator, which will be helpful to the next stage of my test.</p>
<p>I was a bit impressed.  I&#8217;ll see how well it handles the next stage of what I want to do.</p>
<p>(And yes, I know there is no error checking in the above code.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/12/26/pdo-versus-mdb2/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Why is PHP Code Considered Hard to Maintain?</title>
		<link>http://www.procata.com/blog/archives/2006/11/09/why-is-php-code-considered-hard-to-maintain/</link>
		<comments>http://www.procata.com/blog/archives/2006/11/09/why-is-php-code-considered-hard-to-maintain/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 06:37:21 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[maintainability]]></category>
		<category><![CDATA[namespaces]]></category>
		<category><![CDATA[scaleability]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2006/11/09/why-is-php-code-considered-hard-to-maintain/</guid>
		<description><![CDATA[Tobias Schlitt describes Tim Bray&#8217;s talk at the International PHP Conference.  (PDF slides)   Tim compares PHP, Java, and Rails along several dimensions.  One of those dimensions is maintainability.  Tim ranks PHP as least maintainable, Rails in the middle, and Java as most maintainable.  
This is not a surprising ranking. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://schlitt.info/applications/blog/index.php?/archives/508-Tim-Bray-compared-Java,-Ruby-and-PHP.html">Tobias Schlitt</a> describes <a href="http://www.tbray.org/ongoing/">Tim Bray&#8217;s</a> talk at the International PHP Conference.  (<a href="http://www.tbray.org/talks/php.de.pdf">PDF slides</a>)   Tim compares PHP, Java, and Rails along several dimensions.  One of those dimensions is maintainability.  Tim ranks PHP as least maintainable, Rails in the middle, and Java as most maintainable.  </p>
<p>This is not a surprising ranking.  After all, Tim is from Sun, and the maintainability complaint is common in Anti-PHP rants.  I&#8217;m not trying to suggest that Tim is anti-PHP, far from it, it seems.  I&#8217;m just using his ranking as a spring board to ask questions.</p>
<p>Chances are that your average Java jockey or C scientist&#8217;s first exposure to PHP is to download one of the popular PHP applications.  These are usually the product of some open source mega-project with developers of varying degrees of skill.  Our engineer-by-day spends a few evenings with the program.  The code is not technically outstanding. </p>
<p>How can something like this be so popular he asks?  Yet, the software is successful by definition.  Nobody downloads unsuccessful open source applications.  The technocrat, heavily invested in his own technical prowess, faced with successful yet technically inferior code experiences cognitive dissonance.  The only thing to do is to belittle the successful, but surely offensive code.  &#8220;I could write better code than this,&#8221; he says, or &#8220;this code sucks,&#8221; or &#8220;this is unmaintainable.&#8221;</p>
<p>It is easy to dismiss these gripes inside the PHP community.  After all, those of us using PHP professionally can write maintainable code in PHP.  Ask any programmer and they will tell you, &#8220;My code is maintainable.&#8221;  Who writes all of this unmaintainable code, anyway?</p>
<p>Lets take this gripe at face value for a moment.  Why is PHP code considered hard to maintain?  Is it the language that produces code that is hard to maintain, or is it that the popular ambassadors of the language happen to be programs that are hard to maintain?</p>
<p>Another common PHP sucks complaint is that PHP doesn&#8217;t scale.  When you are talking about traffic, there are all sorts of counter examples for this.  Personally, I&#8217;m dying to learn the story behind those .php extensions on YouTube.  But, this post is not about requests per second.</p>
<p>Another kind of scalability is team size.  I think that when some people complain that PHP doesn&#8217;t scale, what they mean is that PHP doesn&#8217;t scale to large development teams or large projects.  Now we are back to the maintainability issue.</p>
<p>What is it about PHP that makes people think that it is not suitable for larger development teams?</p>
<p>The criticisms of maintainability and scalability generally come from outside the PHP community.  But, there is a common complaint from within the PHP community.  </p>
<p>It is hard to find a PHP wish list that doesn&#8217;t include namespaces.  It comes up again and again.</p>
<p>Sometimes users request a feature without explicitly making their true desires and intentions known.  They say &#8220;I want feature X,&#8221; but what they really mean is &#8220;solve problem Y.&#8221;  Good programmers can hear the request for X, but make the jump to solving Y.  </p>
<p>When people ask for the namespace feature, the problem they want to solve is integrating code from multiple parties.  I wonder if the frequency of this request is a signal of a problem in this department?   Perhaps one that requires more than just namespaces to solve?  Is the namespace request a proxy for a larger problem?</p>
<p>What is it about PHP that makes it hard to integrate code written by multiple parties, whether they be different developers or different organizations?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/11/09/why-is-php-code-considered-hard-to-maintain/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Programming Language Trends via Google</title>
		<link>http://www.procata.com/blog/archives/2006/05/10/programming-language-trends-via-google/</link>
		<comments>http://www.procata.com/blog/archives/2006/05/10/programming-language-trends-via-google/#comments</comments>
		<pubDate>Thu, 11 May 2006 02:47:04 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google-trends]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[language-comparison]]></category>
		<category><![CDATA[programming-language]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=185</guid>
		<description><![CDATA[There is a new google toy as of today: Google Trends.  So of course, I wanted to see how PHP is faring on the trendy landscape.  Here is a comparison of PHP, Java, C#, and Perl:


PHP   Java   C#   Perl

PHP seems to be holding steady, or slightly declining. [...]]]></description>
			<content:encoded><![CDATA[<p>There is a new google toy as of today: <a href="http://google.com/trends">Google Trends</a>.  So of course, I wanted to see how PHP is faring on the trendy landscape.  Here is a comparison of PHP, Java, C#, and Perl:</p>
<p align="center">
<img src="http://google.com/trends/viz?q=php,java,c%23,perl&#038;date=all&#038;geo=all&#038;graph=weekly_img" height="260" width="580" alt="PHP, Java, C# and Perl" align="center" /><br />
<font color="#4684ee">PHP</font>   <font color="#dc3912">Java</font>   <font color="#ff9900">C#</font>   <font color="#008000">Perl</font>
</p>
<p>PHP seems to be holding steady, or slightly declining.  But, Java is waning, as I discussed in <a href="http://www.procata.com/blog/archives/2005/09/29/why-isnt-php-the-natural-successor-to-java/">Why isn&#8217;t PHP the natural successor to Java?</a>.  C# seems to be steady and slightly increasing, while Perl is steady and slightly decreasing.  So where are those Java programmers going if not PHP?  Are they going to Ruby and Ruby on Rails?</p>
<p align="center">
<img src="http://google.com/trends/viz?q=java,ruby,ruby+on+rails&#038;date=all&#038;geo=all&#038;graph=weekly_img" height="260" width="580" alt="Java, Ruby and Ruby on Rails" /><br />
<font color="#4684ee">Java</font>   <font color="#dc3912">Ruby</font>   <font color="#ff9900">Ruby on Rails</font>
</p>
<p>It looks like Ruby and Ruby on Rails are tiny fish in Java&#8217;s pond.  Perhaps those Java developers are going to C# or one of Microsoft&#8217;s unsearchable variants.  It would be interesting to see the MSN search trends.  However, there is one area where Ruby on Rails seems to be doing well:</p>
<p align="center">
<img src="http://google.com/trends/viz?q=struts,ruby+on+rails,framework&#038;date=all&#038;geo=all&#038;graph=weekly_img" height="260" width="580" alt="Struts vs. Ruby on Rails" /><br />
<font color="#4684ee">Struts</font>   <font color="#dc3912">Ruby on Rails</font>   <font color="#ff9900">framework</font>
</p>
<p>It used to be that most of the PHP frameworks were cloning Struts.  Now they clone Rails.  There is an increasing interest in frameworks.</p>
<p>There are countries where PHP is more popular.  Here is the PHP vs. Java chart for the Netherlands.  Right at the end, PHP beats out Java.  Search, <a href="http://www.derickrethans.nl/">Derick</a>.  Search.</p>
<p align="center">
<img src="http://google.com/trends/viz?q=php,java&#038;date=all&#038;geo=NL&#038;graph=weekly_img" height="260" width="580" alt="Java vs PHP in the Netherlands" /><br />
<font color="#4684ee">PHP</font>   <font color="#dc3912">Java</font>
</p>
<p>One last Trend.  What is trendier that Ajax these days?  Certainly not JavaScript.</p>
<p align="center">
<img src="http://google.com/trends/viz?q=javascript,ajax&#038;date=all&#038;geo=all&#038;graph=weekly_img" height="260" width="580" alt="Java vs PHP in the Netherlands" /><br />
<font color="#4684ee">Javascript</font>   <font color="#dc3912">AJAX</font>
</p>
<p>Notice how Javascript searches are declining while Ajax is ascending.  Strangely I would have thought that the interest in AJAX would have created an increase in Javascript searches.  It doesn&#8217;t look like the total search volume of the two terms together is increasing that much.  Looking at the news volume graph is striking.  The AJAX press release machine is in full gear.  So is AJAX the thing that everyone is talking about, but nobody is doing?  Can you say Web 2.0 bubble?</p>
<p>Please use the AJAX enabled comment form below to tell me how wrong I am.</p>
<p>DISCLAIMER: These graphs and conclusions are for entertainment purposes only. Opinions expressed should not be construed as trendy advice.  The particulars of any person&#8217;s concerns and circumstances should be discussed with a qualified trend spotting practitioner prior to making any decisions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/05/10/programming-language-trends-via-google/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>PHP Games</title>
		<link>http://www.procata.com/blog/archives/2006/04/06/php-games/</link>
		<comments>http://www.procata.com/blog/archives/2006/04/06/php-games/#comments</comments>
		<pubDate>Thu, 06 Apr 2006 18:57:57 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ajax-games]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php-games]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=180</guid>
		<description><![CDATA[Earlier this morning, I ran across the Heroes of might and magic online mini-game (via digg).  The game is written in PHP and uses the prototype and scriptaculous java script libraries.  The interface is very drag and drop oriented and it uses Ajax to update game status.  The graphics are very good. [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this morning, I ran across the <a href="http://www.heroesmini.com/">Heroes of might and magic online mini-game</a> (via digg).  The game is written in PHP and uses the prototype and scriptaculous java script libraries.  The interface is very drag and drop oriented and it uses Ajax to update game status.  The graphics are very good.  No flash as far as I can tell.</p>
<p>Their server is getting crushed right now, intermittently not responding and running out of MySQL connections.  The javascript crashed my browser a couple times. Still, I was intrigued by the combination of Ajax and PHP and I liked the interface.  Definitely one to bookmark  for later.  (I&#8217;d like to track down that crasher when I get more time.)</p>
<p>What is the state of Ajax games?  of PHP games?  Are there other PHP/Ajax games that I should bookmark?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/04/06/php-games/feed/</wfw:commentRss>
		<slash:comments>64</slash:comments>
		</item>
		<item>
		<title>James Gosling on PHP</title>
		<link>http://www.procata.com/blog/archives/2006/03/11/james-gosling-on-php/</link>
		<comments>http://www.procata.com/blog/archives/2006/03/11/james-gosling-on-php/#comments</comments>
		<pubDate>Sat, 11 Mar 2006 16:07:50 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[james-gosling]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[language-comparison]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scripting-languages]]></category>
		<category><![CDATA[simplicity]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/?p=176</guid>
		<description><![CDATA[James Gosling, the &#8220;father of Java,&#8221; recently commented on PHP:

&#8220;PHP and Ruby are perfectly fine systems,&#8221; he continued, &#8220;but they are scripting languages and get their power through specialization: they just generate web pages. But none of them attempt any serious breadth in the application domain and they both have really serious scaling and performance [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/James_Gosling">James Gosling</a>, the &#8220;father of Java,&#8221; recently <a href="http://java.sys-con.com/read/193146.htm">commented on PHP</a>:</p>
<blockquote><p>
&#8220;PHP and Ruby are perfectly fine systems,&#8221; he continued, &#8220;but they are scripting languages and get their power through specialization: they just generate web pages. But none of them attempt any serious breadth in the application domain and they both have really serious scaling and performance problems.&#8221;<br />
&#8230;<br />
PHP (for example) is able to make things simpler because it&#8217;s 100% aimed at web pages, Gosling explained. Whereas with Java, he said, &#8220;We have a balancing act: we need the simplicity but we also need power.&#8221;</p></blockquote>
<p>The headline here should be &#8220;Father of Java says writing web applications in PHP is simpler.&#8221;  This is pretty much what I said in my <a href="http://www.procata.com/blog/archives/2006/02/09/comparing-php-with-other-languages/">Comparing PHP with other languages</a> post:</p>
<blockquote><p>
Why is Java considered so complicated? One reason is that it is designed to run on everything from servers to cell phones, from desktops to dishwashers. It&#8217;s scope is impossibly general. Of course, specialized tools such as Rails and PHP are more productive for their sweet spot applications.
</p></blockquote>
<p>Both .NET and Java have this be all things to everyone mentality.  If you need that generalization, fine, but generalization is not without cost as Gosling points out.</p>
<blockquote><p>
He called Simplicity and Power &#8220;evil twin brothers&#8221; &#8211; &#8220;Building systems that have a lot of power just attract complexity. Because of the way that the world has become so interconnected it helps to have systems where it carries over from one domain to another. You can do web presnentation stuff really well in PHP but you couldn&#8217;t write a library that does, say, interplanetary navigation.
</p></blockquote>
<p>So, if you are writing software for interplanetary navigations, by all means, choose Java. If you  just want to write really good web applications quickly, choose PHP.</p>
<p>Regarding the scalability and performance characterization.  I&#8217;m so tired of that.  PHP performs and scales just fine for many people. Flickr makes an interesting case study of PHP scaling:</p>
<ul>
<li><a href="http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=2e03a43a-535e-49a1-afaa-b47eab5f71c2">Scaling fast and cheap &#8211; how we built flickr</a></li>
<li><a href="http://blog.flickr.com/flickrblog/2005/10/lamp.html">Hardware Layouts for LAMP Installations</a></li>
<li><a href="http://software.newsforge.com/print.pl?sid=05/01/27/170244">Open source helps Flickr share photos</a></li>
<li><a href="http://www.procata.com/blog/archives/2004/10/27/flickr-case-study/">flickr and PHP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/03/11/james-gosling-on-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

