

<?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>Tony Bibbs &#187; PHP</title>
	<atom:link href="http://www.tonybibbs.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tonybibbs.com</link>
	<description>Family, Outdoors and Technology</description>
	<lastBuildDate>Thu, 11 Feb 2010 20:48:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Comparing Propel and Doctrine</title>
		<link>http://www.tonybibbs.com/2010/02/comparing-propel-and-doctrine/</link>
		<comments>http://www.tonybibbs.com/2010/02/comparing-propel-and-doctrine/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 20:40:18 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Propel]]></category>

		<guid isPermaLink="false">http://www.tonybibbs.com/?p=329</guid>
		<description><![CDATA[I&#8217;ve recently decided to make the switch to Doctrine as the ORM of choice for any new PHP projects we work on.  I didn&#8217;t make this decision lightly as, until now, I have been a long time user and advocate of Propel having given talks on it at PHP conferences and even a webinar [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently decided to make the switch to <a href="http://www.doctrine-project.org">Doctrine</a> as the ORM of choice for any new PHP projects we work on.  I didn&#8217;t make this decision lightly as, until now, I have been a long time user and advocate of <a href="http://propel.phpdb.org">Propel</a> having given talks on it at PHP conferences and even a webinar or two.  So why the change?  That&#8217;s really not significant, what is significant is I think I can give a very quick punchlist of things about each that other PHP&#8217;er might find useful when evaluating them for themselves.</p>
<p><b>Propel</b></p>
<p><b>Pros</b> &#8211; First, let&#8217;s be clear I&#8217;m not talking about the pros of using an ORM. I&#8217;m talking about the good things that this ORM implementation brings to the table. Those are:</p>
<ul>
<li>Hydration Speed &#8211; You can argue you should never retrieve hydrated PHP objects from query if you don&#8217;t plan on taking some sort of save or delete action on it.  Yes, that&#8217;s true from a performance standpoint, however, if you are building a site where performance simply isn&#8217;t a concern then you&#8217;ll be pleased to know Propel can hydrate a set of objects quickly enough to be used in building a view (i.e. a data grid of some sort).</li>
<li>Classic Getters/Setters &#8211; You get these methods stubbed out in the base classes that Propel generates and you can override them easily.  I should note Doctrine can do similar sorts of things but not in a conventional way.</li>
<li>Support &#8211; The Propel mailing lists and IRC channel on freenode are pretty active, thought, not near as active as Doctrine&#8217;s.</li>
</ul>
<p><b>Cons</b></p>
<ul>
<li>Dependency hell &#8211; Propel has improved this but it&#8217;s still not perfect.  Back in the early days, before PDO, you needed Propel&#8217;s generator, <a href="http://phing.info">Phing</a> and <a href="http://creole.phpdb.org">Creole</a>.  Now you just need the generator and Phing. Phing is very much like Java&#8217;s Ant build tool.  While I understand and get why they use Phing, it adds a layer of complexity that makes it a barrier to new users.  Propel&#8217;s generator isn&#8217;t as bad as it is just a set of Phing targets to do Propel&#8217;s bidding.  If you come from .NET or Java using Phing won&#8217;t be a big deal but if you aren&#8217;t familiar with Ant or nAnt then Phing will come with a learning curve.</li>
<li>Criteria &#8211; Propel&#8217;s way to help ensure portable queries are built is via their Criteria object.  While I get the need for it, not having a explicit way to run native SQL short of getting a PDO connection and doing all the work that way is a short coming.  In fact, I despise Criteria so much I never use it, mainly because it doesn&#8217;t take too much work to hit a situation that Criteria either can&#8217;t handle well or make the code so complicated it&#8217;s not worth it.</li>
<li>No 5.3 namespace support &#8211; Let&#8217;s face it, we are all tired of Really_Long_Class_Names ala PEAR, Zend Framework, et. al.</li>
<li>Community &#8211; This is probably hard to blame on any one person but for a long time no work was done on Propel.  There was a change in project leads which took a long time and the development efforts took a while to get going.  I&#8217;m happy to say the team is active again, but a lot of ground was lost during the downtime.</li>
</ul>
<p><b>Doctrine</b></p>
<p><b>Pros</b></p>
<ul>
<li>No other dependencies.  Doing builds is easy as creating a simple PHP command line file and running it.  No Phing, no other external property files.</li>
<li>Magic finders &#8211; I love this.  Say you have a user table with a user_name field that has a unique index on it.  Retrieving this is as simple as
<pre>Doctrine::getTable('User')->findOneByUserName('janedoe');</pre>
<p>. Propel would require a few more lines setting up a Criteria object and running it.</li>
<li>Named Queries &#8211; This is something I pitched to the Propel development team quite a long time ago that always got a luke warm reception from the community.  I ended up implementing my own named query implementation which worked well enough that I never used Criteria.  With Doctrine you just get it out of the box:
<pre>
$this->addNamedQuery(
    'someQueryName',
    \Doctrine_Query::create()
        ->select('*')
        ->from('User u')
        ->where(user_name = ? AND 'password = ?')
);
</pre>
<p>Now I&#8217;m not totally in love with that syntax, it&#8217;s not much better than Criteria, honestly, however I go through that pain once and then I can just say:</p>
<pre>
$user = \Doctrine::getTable('User')->find('someQueryName', array('janedoe',SHA1($password)));
</pre>
<p>It&#8217;s also worth noting you can also use named queries to issue raw SQL, though, it will only return the raw recordset. Some of you are probably asking WTF? Named Queries?  Read up on them, decide for yourself if they are for you&#8230;all I can say is after having used an implementation for years I&#8217;m sold on it (maybe that can be a future blog post).
</li>
<li>
Documentation &#8211; Their documentation is top-notch.  Only improvement that is needed is comment support to the manuals.
</li>
<li>
Community &#8211; Let&#8217;s face it. Doctrine has gained some traction and all you need to do is follow the mailing lists, IRC and other community resources to see they simply get it.  Their partnership with Zend Framework is a shining example of good strides in this area.</li>
</ul>
<p><b>Cons</b></p>
<ul>
<li>Hydration Override &#8211; This one had me scratching my head the first time I noticed it.  By default, if you fetch an object by the same primary key twice you don&#8217;t get two different copies, you get a pointer to the most recent version.  On the surface that makes sense but there are a number of reasons I don&#8217;t like this as the default setting.  Luckily you can turn this off through a configuration setting when you initialize Doctrine.</li>
<li>Hydration Speed &#8211; This is my biggest complaints with Doctrine.  If you run a query that pulls a parent/child relationship (i.e. a customer and their orders) this take a lot of time with Doctrine&#8217;s hydration method.  The complexity is the circular references you can get.  I don&#8217;t know why Propel handles this so much better but the impact is you can&#8217;t use Doctrine&#8217;s hydrated objects in you views.  The way around this, I&#8217;ll call the Doctrine Way, is to have them hydrated as arrays.  You still get the parent&#8217;s children, you just aren&#8217;t working with a native PHP object.  When you think about it, it make sense, though I still prefer having a choice. The performance hit you take, even on simple queries, makes the array hydration mandatory if you are pulling more than one or two records from the database.</li>
<li>No 5.3 namespace support &#8211; It too doesn&#8217;t support namespaces yet.</li>
</ul>
<p>This isn&#8217;t meant to be a comprehensive review of either system, rather, a punchlist of noteable things.  I don&#8217;t feel this blog post is near comprehensive enough to base your decision on, rather, it can be used in addition to your findings.  I&#8217;d love to hear the other pros and cons from either camps.</p>]]></content:encoded>
			<wfw:commentRss>http://www.tonybibbs.com/2010/02/comparing-propel-and-doctrine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving On</title>
		<link>http://www.tonybibbs.com/2009/12/moving-on/</link>
		<comments>http://www.tonybibbs.com/2009/12/moving-on/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 14:38:10 +0000</pubDate>
		<dc:creator>Tony</dc:creator>
				<category><![CDATA[Geeklog]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tonybibbs.com/?p=285</guid>
		<description><![CDATA[<p>My guess is this will largely go un-noticed but I felt a formal blog post was in order for announcing my decision to stop contributing to AptitudeCMS and Geeklog.]]></description>
			<content:encoded><![CDATA[<p>My guess is this will largely go un-noticed but I felt a formal blog post was in order for announcing my decision to stop contributing to AptitudeCMS and Geeklog.</p>
<p>
I owe quite a bit to <a href="http://www.geeklog.net">Geeklog</a>&#8230;after installing Linux and PHP for the first time over 12 years ago I ran across Geeklog, learned a thing or two about open source development and started <a href="http://www.iowaoutdoors.org">Iowa Outdoors</a> (which I&#8217;ve since sold).  Not long after that I was fortunate enough to serve as the project lead for Geeklog before handing it off to the current lead, Dirk Haun.  Back then, there weren&#8217;t many viable options in the now overcrowded PHP CMS market.  Sadly, I&#8217;ve watched Geeklog&#8217;s popularity slowly decline to its current state.  That said, I have a few constructive things to say to the Geeklog community and the PHP community at large.</p>
<p>
First to the Geeklog community.  You&#8217;ve run into rough times.  WordPress, Joomla, Drupal and company really are the champions in this space.  Without doing more digging than I care to, I know Geeklog is far behind in any of the hard metrics that really matter (code commits, # of active developers, etc).  Just a hint of proof is had by comparing <a href="http://www.ohloh.net/p/geeklog">Geeklog&#8217;s Ohloh stats</a> with <a href="http://www.ohloh.net/p/wordpress">this</a>, <a href="http://www.ohloh.net/p/joomla">this</a> and <a href="http://www.ohloh.net/p/drupal">this</a>.  Then there those things you can&#8217;t quite quantify, the passion of the community and the level of innovation happening.  Right now I feel the Geeklog community is pretty stagnant.  Some of this is likely to be blamed on the <a href="http://www.glfusion.org/">fork of Geeklog</a> (whose <a href="http://www.ohloh.net/p/glfusion">Ohloh stats</a> don&#8217;t speak well either).  Fact is if you combine both glFusion and Geeklog&#8217;s numbers together it still paints a pretty bad picture.  You could argue they don&#8217;t need to aspire to be like WordPress, Joomla and Drupal which is fine but what I think has gotten lost in all of this nobody has consciously said if that&#8217;s the game they want to play and, if not, what differentiates Geeklog from the rest?  In the meantime, the set of features added over the past year or two suggest, in fact, they are playing catch-up to some of the features found in those other systems.  That&#8217;s not bad, but my point is Geeklog seems to lack a tangible goal. I guess that is part of the nature of open source&#8230;the perpetual, organic, itching of scratches but I still feel open source projects need to have long term visions far beyond the next commit, next point release and even next major release. With that said here&#8217;s some suggestions for Geeklog&#8217;s community in no particular order:</p>
<ul>
<li>Change your name &#8211; I attempted to address this with <a href="http://www.aptitudecms.org">AptitudeCMS</a> and failed but something has to be done.  I&#8217;m not sure if there is a precedent for a name change in a well established open source project but it has to happen for Geeklog.  To me it is branding 101.  For anybody outside of a blogger or hobbyist, it&#8217;s hard to take the Geeklog brand seriously.  Pointy haired managers scoff at such a name (I&#8217;ve seen it). Sure you risk confusing or alienating people but I feel Geeklog, as a brand, is hard to sell.  That said, even without a name change the remaining points are crucial.</li>
<li>Change your image &#8211; The Geeklog homepage screams mid-1990&#8217;s era design.  It&#8217;s the first impression we give users.  Even if you don&#8217;t want to compete directly with the bigger kids on the block, you can&#8217;t argue that <a href="http://www.joomla.org/">Joomla</a>, <a href="http://wordpress.org/">WordPress</a> and even the <a href="http://www.glfusion.org/">Geeklog fork</a> looks better.  It&#8217;s the first impression a user gets.  I think improving the Geeklog homepage will lead to more interest.  Once captivated, I have now doubt the codebase speaks for itself but, for now, the Geeklog homepage is forgettable for new users.</li>
<li>Get social &#8211; Geeklog is no where to be found on Twitter, Facebook, etc.  The missed opportunities here are, frankly, staggering.  The PHP community (as well as Drupal, Joomla, etc) all have a strong presence in these areas and I have no doubt the Geeklog community could benefit by joining the conversation.</li>
<li>Blog &#8211; Let&#8217;s face it, there isn&#8217;t much in the way of active Geeklog developers.  The ones there really need to blog about what&#8217;s going on behind the scenes.  What are you working on?  What&#8217;s a challenge you are facing? Any good commits lately?  This in part gets back to the goal setting discussion but it is more todo with giving the community a glimpse of what is going on.</li>
<li>Find a partner &#8211; Ok, this is probably one of the more controversial points and one that is often dodged in open source discussions but behind nearly all successful open source projects is an organization.  Sometimes it is not-for-profits but many times it is a private company or two.  Right now there isn&#8217;t a single Geeklog developer paid to work full time or even half-time on the core of the system.  Geeklog&#8217;s current codebase, in my opinion, has to be worth that investment.  I think part of the problem here has to do with the name, image and branding issues I brought up. That said, I know of a lot of organizations making selfish use of Geeklog without giving anything back.  No bugs, no code, no testing, no translations nada.  Zilch.  Now before the hardcore OSS supporters flame me, I&#8217;m not suggesting the project be effectively run by a company or an organization, rather, there should be enough of a community still where they can contribute developer hours to the project.  I believe strongly the project itself needs to remain organic able to change with the needs of those who lead&#8230;but that some investment by industry is needed.  Who will stand up?</li>
</ul>
<p>
Now to the PHP community at large.  As I look at AptitudeCMS, I see a body of work that started before there were any other PHP frameworks around.  I started with an MVC implementation.  I incorporated a simple template engine.  Later added an ORM.  Much of this happened over many employers and well before anybody uttered Zend Framework for the first time.  AptitudeCMS as a project is a failure in large part because it was never really released as a &#8220;formal&#8221; project until well after current PHP framework space became cluttered.  Fine, it is what it is.  However, to see this stuff rot and be used only when I have a new project come up seems silly.  I&#8217;m pleading, for my own sanity, don&#8217;t let this code go to waste.  Feel free to dissect it, borrow anything you find useful and laugh at any bad code you dig up.  Some areas of focus:</p>
<ul>
<li>MVCnPHP &#8211; It&#8217;s a viable alternative to Zend Framework&#8217;s MVC implementation.  It&#8217;s small, configureless and doesn&#8217;t present file contention issues common with ZF controllers.  I&#8217;m sure a Zender can point out ways around this but most ZF projects I&#8217;ve seen have all the logic in the controller which seems really wrong to me and is a bit painful when you have multiple developers working in the same controller.  Sure SVN, etc can handle the merge but you end up with a lot of merges.  MVCnPHP is much more atomic, view logic goes in a simple, small view class.  Command logic goes in a similar command class.  The controller is only responsible for routing requests between views and commands.  An upside to this is MVCnPHP also has basic support for tainted variables.  For the unaware, it&#8217;s a simple feature that notifies developers with exceptions when an unsanitized GET or POST variable is used.</li>
<li>Filtering &#8211; I built a filter class on top of Zend Framework that can easily be added to MVCnPHP views and commands.  Without much work it could also be incorporated into Zend Framework MVC implementations.  Look first <a href="http://www.aptitudecms.org/wiki/page/ACMSFIEO/">here</a> then see the &#8220;cool code&#8221; in the <a href="http://www.aptitudecms.org/trac/browser/AptitudeCMS/trunk/plugins/kernel/system/Filter.php">Filter class</a> which is nothing more than a class that passes calls thru to Zend&#8217;s library and then the <a href="http://www.aptitudecms.org/trac/browser/AptitudeCMS/trunk/plugins/kernel/system/views/ViewAbstract.php#L1010">abstract view that uses it</a>. I doubt the code will tickle you as is but I think conceptually it has merit for someone out there.</li>
<li>ORM->Form and Form->ORM &#8211; Because we use Propel we were able to dream up a way where we could hand a view an object and have it pre-fill from that object without us having to explicitly set the form field values.  Similarly, in our commands we found a handy way of creating the same ORM objects from the submitted form without having to explicitly map and set the ORM object&#8217;s values.  This was a huge time saver.  I think with a little work this code could be modified for Doctrine. Here&#8217;s how we map <a href="http://www.aptitudecms.org/trac/browser/AptitudeCMS/trunk/plugins/kernel/system/commands/CommandAbstract.php#L303">a form submission to a set of object(s)</a> and here is <a href="http://www.aptitudecms.org/trac/browser/AptitudeCMS/trunk/plugins/kernel/system/pear/apteno/mvcnphp/ViewFlexyAbstract.php#L738">mapping a object to the form</a></li>
</ul>
<p>
One thing I want to warn the community at large about is I&#8217;m seeing what feels to me like a trend in PHP to conform.  You could argue that this very blog post is me, in a way admitting defeat and conforming, but I want to state the obvious that you always have a choice.  It seems like many people are choosing to use part of a framework they have already installed instead of challenging whether or not it is the best tool for the job.  Just because a filter class is included in Zend Framework doesn&#8217;t mean you have to use it.  Just because ezComponents has a workflow component doesn&#8217;t mean you must employ it. Fact is AptitudeCMS includes Zend Framework, has some PEAR libraries and even some things like MVCnPHP.  You can argue bloat, file sizes, which is valid but I&#8217;m confident you can still cherry pick the best parts of a framework to give you something you can work with long term.  I&#8217;ve used Flexy instead of Smarty, MVCnPHP instead of Zend Framework and Propel instead of Doctrine.  Some could see those as one bad decision after another but it&#8217;s simply the result of a cherry picking exercise I did long ago.  Today I&#8217;d likely make different decisions but I can tell you I wouldn&#8217;t put all my eggs in one basket.  Nor should you.</p>
<p>
This blog entry, a self admission to failure, hopefully didn&#8217;t upset anybody along the way.  To be clear I&#8217;m the only one who failed here.  Maybe &#8220;fail&#8221; is too harsh a word as I&#8217;m quite happy to make this transition but I want to be clear to Dirk Haun, the Geeklog Project and those of you whom I&#8217;ve brushed IDE&#8217;s with are all people I very much respect.  I hate &#8220;losing&#8221; and this feels like a loss and will always feel that way.  If anybody makes use of any of these suggestions please pass that along in an email to me.  It will take a bit of the sting off.</p>]]></content:encoded>
			<wfw:commentRss>http://www.tonybibbs.com/2009/12/moving-on/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
