<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>techPortal</title>
	
	<link>http://techportal.ibuildings.com</link>
	<description>Tutorials for better PHP</description>
	<lastBuildDate>Fri, 17 Feb 2012 00:16:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ibuildingstechportal" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="ibuildingstechportal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>DPC Radio: Implementing OAuth</title>
		<link>http://techportal.ibuildings.com/2012/02/08/dpc-radio-implementing-oauth/</link>
		<comments>http://techportal.ibuildings.com/2012/02/08/dpc-radio-implementing-oauth/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 11:06:30 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[apis]]></category>
		<category><![CDATA[Lorna Jane Mitchell]]></category>
		<category><![CDATA[OAuth]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3392</guid>
		<description><![CDATA[Lorna Jane Mitchell With Twitter moving its API to OAuth the idea of using tokens rather than passwords for authentication went mainstream. Many explanations of OAuth make it seem complicated whereas in reality the "OAuth Dance" is a series of simple steps executed in sequence. This talk covers consuming and providing OAuth services, includes implementation [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Lorna Jane Mitchell</strong></p>
<p>With Twitter moving its API to OAuth the idea of using tokens rather than passwords for authentication went mainstream. Many explanations of OAuth make it seem complicated whereas in reality the "OAuth Dance" is a series of simple steps executed in sequence. This talk covers consuming and providing OAuth services, includes implementation examples, and is recommended for all technical leads, architects, and integration specialists.</p>
<p>You can find Lorna's slides at <a href="http://www.slideshare.net/lornajane/oauth-7990565">http://www.slideshare.net/lornajane/oauth-7990565</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F&amp;title=DPC+Radio%3A+Implementing+OAuth" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F&amp;title=DPC+Radio%3A+Implementing+OAuth" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F&amp;title=DPC+Radio%3A+Implementing+OAuth" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F&amp;headline=DPC+Radio%3A+Implementing+OAuth" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Implementing+OAuth&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Implementing+OAuth&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Implementing+OAuth&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Implementing+OAuth&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Implementing+OAuth&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F&amp;title=DPC+Radio%3A+Implementing+OAuth&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F02%2F08%2Fdpc-radio-implementing-oauth%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2012/02/08/dpc-radio-implementing-oauth/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_010.mp3" length="90604303" type="audio/mpeg" />
		</item>
		<item>
		<title>Announcing the DPC12 CfP (and a Mobile Conference)</title>
		<link>http://techportal.ibuildings.com/2012/01/26/announcing-the-dpc12-cfp-and-a-mobile-conference/</link>
		<comments>http://techportal.ibuildings.com/2012/01/26/announcing-the-dpc12-cfp-and-a-mobile-conference/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 14:40:58 +0000</pubDate>
		<dc:creator>Lorna Mitchell</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[amsterdam]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[dmc]]></category>
		<category><![CDATA[DPC]]></category>
		<category><![CDATA[dpc12]]></category>
		<category><![CDATA[dutch php conference]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3551</guid>
		<description><![CDATA[It's that time of year again; the Dutch PHP Conference has announced its dates (7-9th June 2012) and the call for papers is now open! This year, the conference expands into a new dimension with the addition of a new sister conference, the Dutch Mobile Conference, running alongside DPC. All attendees will get access to [...]]]></description>
			<content:encoded><![CDATA[<p>It's that time of year again; the <a href="http://phpconference.nl">Dutch PHP Conference</a> has announced its dates (7-9th June 2012) and the <strong>call for papers is now open</strong>!</p>
<p>This year, the conference expands into a new dimension with the addition of a new sister conference, the <a href="http://mobileconference.nl">Dutch Mobile Conference</a>, running alongside DPC.  All attendees will get access to both events.  The addition of an additional strand to the conference is a response to the situation as we see it in industry.  Our clients need mobile solutions alongside their web applications, and developers increasingly work across both web and mobile disciplines.</p>
<h3>Call for Papers</h3>
<p>The calls for papers for both events are open now and we'd be delighted to hear from you.  You don't necessarily need previous speaking experience (but tell us if you have), you just need a <strong>great topic</strong> - and for these events, <strong>the more technical, the better!</strong>  The URLs you need to submit your talk are <a href="http://www.phpconference.nl/call-for-papers">http://www.phpconference.nl/call-for-papers</a> and <a href="http://www.mobileconference.nl/call-for-papers">http://www.mobileconference.nl/call-for-papers</a> - we can't wait to see what you come up with, but you need to be quick!  The calls for papers <strong>close on Tuesday 31st January</strong>.</p>
<h3>Come to the Conference!</h3>
<p>Hopefully you've been enjoying our DPCRadio series, where we share the recordings from last year's PHP conference (if not, you can catch up on the <a href="http://techportal.ibuildings.com/dpc-radio/">DPCRadio page</a>).  This year will be bigger and better than ever, and we are sure you'll love the new mobile elements of the event as well - so come and join us, <strong>7th-9th June in sunny* Amsterdam</strong>!</p>
<p>To follow along with the news from both events, follow our twitter accounts <a href="http://twitter.com/DPCon">@DPCon</a> and <a href="http://twitter.com/DMConf">@DMConf</a>.</p>
<p><strong>*</strong> <em>sunshine not guaranteed</em></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F&amp;title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F&amp;title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F&amp;title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F&amp;headline=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F&amp;title=Announcing+the+DPC12+CfP+%28and+a+Mobile+Conference%29&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F26%2Fannouncing-the-dpc12-cfp-and-a-mobile-conference%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2012/01/26/announcing-the-dpc12-cfp-and-a-mobile-conference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DPC Radio: Advanced OO Patterns</title>
		<link>http://techportal.ibuildings.com/2012/01/17/dpc-radio-advanced-oo-patterns/</link>
		<comments>http://techportal.ibuildings.com/2012/01/17/dpc-radio-advanced-oo-patterns/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 15:25:28 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[Factory]]></category>
		<category><![CDATA[object oriented]]></category>
		<category><![CDATA[Signal/Observer]]></category>
		<category><![CDATA[Singleton]]></category>
		<category><![CDATA[Tobias Schlitt]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3363</guid>
		<description><![CDATA[Tobias Schlitt You already know Singleton, Signal/Observer, Factory and friends. But, which object oriented patterns are en vogue in the PHP world and how can you seize their power? This talk gives you an overview on Dependency Injection, Data Mapper and more OO patterns the PHP world talks about right know, using practical code examples. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Tobias Schlitt</strong></p>
<p>You already know Singleton, Signal/Observer, Factory and friends. But, which object oriented patterns are en vogue in the PHP world and how can you seize their power? This talk gives you an overview on Dependency Injection, Data Mapper and more OO patterns the PHP world talks about right know, using practical code examples.</p>
<p>You can find Toby's slides under "Advanced OOP Patterns" here: <a href="http://qafoo.com/presentations.html">http://qafoo.com/presentations.html</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F&amp;title=DPC+Radio%3A+Advanced+OO+Patterns" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F&amp;title=DPC+Radio%3A+Advanced+OO+Patterns" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F&amp;title=DPC+Radio%3A+Advanced+OO+Patterns" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F&amp;headline=DPC+Radio%3A+Advanced+OO+Patterns" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Advanced+OO+Patterns&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Advanced+OO+Patterns&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Advanced+OO+Patterns&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Advanced+OO+Patterns&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Advanced+OO+Patterns&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F&amp;title=DPC+Radio%3A+Advanced+OO+Patterns&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F17%2Fdpc-radio-advanced-oo-patterns%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2012/01/17/dpc-radio-advanced-oo-patterns/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_001.mp3" length="93688867" type="audio/mpeg" />
		</item>
		<item>
		<title>Are You Making the Most of MySQL?</title>
		<link>http://techportal.ibuildings.com/2012/01/05/are-you-making-the-most-of-mysql/</link>
		<comments>http://techportal.ibuildings.com/2012/01/05/are-you-making-the-most-of-mysql/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 08:11:43 +0000</pubDate>
		<dc:creator>Hilary Boyce</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[explain]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[prepared statements]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[stored procedures]]></category>
		<category><![CDATA[views]]></category>
		<category><![CDATA[zce]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3515</guid>
		<description><![CDATA[Here at Ibuildings, we encourage our developers to continue to develop themselves professionally and to gain relevant certifications. Most have the Zend PHP Certification (ZCE) and some have the Zend Framework Certification (ZFCE) and/or the MySQL Certifications. I have recently been working to gain the MySQL Certified Developer qualification which is taken as two exams; [...]]]></description>
			<content:encoded><![CDATA[<p>Here at Ibuildings, we encourage our developers to continue to develop themselves professionally and to gain relevant certifications.  Most have the Zend PHP Certification (ZCE) and some have the Zend Framework Certification (ZFCE) and/or the MySQL Certifications.  I have recently been working to gain the MySQL Certified Developer qualification which is taken as two exams; each one is an hour and a half and covering a wide range of topics relevant to developing applications with MySQL (there is a separate qualification for administrators).  I found some of the course material pretty easy as I have used it repeatedly over the years but there was plenty that was fairly new to me; some features that I haven’t been using and haven't noticed other PHP developers using or talking about very much.  Having learned more about them, I thought they were worth highlighting.  I’ve enjoyed finding out about these features and look forward to using some of these elements such as subqueries, views and stored procedures effectively in future projects.<span id="more-3515"></span></p>
<p>As developers, we typically think about the application domain problem and logic and then design our architecture and consequently the database tables from that.  We see the database as merely holding the data and our programs as the part that applies logic and processing to that data.  We develop our scripts in isolation from the rest of the finished system and rarely think about their impact on other processes and whether we are making good use of what PHP and MySQL are good at. There may sometimes be excellent reasons for this, but I suspect it is more often the case that:</p>
<ul>
<li>We are not really aware of what MySQL has to offer, or if we are we are not confident in how to use the features.
</li>
<li>The use of ORM (Object Relational Mapping) is growing and this tends to distance us from the actual database and the SQL.  It is perfectly possible now to create an application without writing an SQL query at all.
</li>
<li>We like to keep control in our hands and using some of these features mean the database doing more and our code a lot less which feels threatening.
</li>
<li>We tend to develop in an isolated environment where the only thing running is our script; where we don’t have to worry about competing for resources and speed over a network.  Increasingly our live applications are actually running on a network of servers and complex applications need all the help they can get to meet the requirements of page load times and to avoid contention for resources.
</li>
<li>As PHP developers we traditionally create a single web application with a database back-end that is just used for that application so re-use doesn’t seem such an issue.  However modular or service-level applications are growing; I’ve worked with several of them in recent years.
</li>
</ul>
<p></p>
<p>If all our programs are doing are simple CRUD (Create, Read, Update and Delete) operations on single tables then just using the most basic features of MySQL is probably sufficient, but if it is more complicated then we could be missing out on features that will really improve the performance and resilience of our applications.  We could also save overall development time through re-use of database elements. Our overall aim is to produce fast, reliable, robust applications and we let ourselves and our clients down if we don’t use all the tools at our disposal.</p>
<h2>MySQL Tips and Features</h2>
<p>So what are these features I’m referring to?  I propose to review the options here and then cover a few of them in a bit more detail.  I’ll start with the things that some of you may already be using and then move on to the more obscure.  As a general rule the aims here are to move less data from database to program, to have each query execute as quickly as possible, and to keep our data as secure as we can.</p>
<h3>Fetch a Limited Dataset</h3>
<p>Limiting the number of columns you select, limiting the number of rows with <code>LIMIT</code> and careful use of the <code>WHERE</code> clause all reduce the amount of data being transferred.  Another useful and often underused option is using the <code>GROUP BY</code> clause along with aggregate functions to read summary data, rather than reading a whole dataset and then performing calculations on it in your program.  Imagine you want to get some summary information about a company’s departments and their members of staff.  You could produce a query that reads all the staff records and then process that in your program, but a more efficient approach is to get MySQL to do it for you by using the <code>GROUP BY</code> feature.</p>
<h3>Link Tables Efficiently</h3>
<p>Use <strong>joins</strong> to read from two or more related tables at once.  Inner joins, either explicitly using the <code>JOIN </code>keyword or by listing tables in a comma separated list, get all the records where there is a matching record in each table.  Outer joins (<code>LEFT</code> or <code>RIGHT</code>) select all the records from one of the tables and then the values for the subsequent tables if found, or give NULL values if there are no matches.  There is also a self join for those occasions when you need to compare the values in different rows of the same table.  Joins are a key concept and well worth mastering if you are not already comfortable with them.  What is less well known is that joins can also be useful when doing multiple table updates and deletes, although they are used implicitly with a comma separated list in this context rather than with the keyword <code>JOIN</code>.</p>
<p><strong>Sub-queries </strong>can also be used in a number of ways to create complex queries that select data from a number of tables.  There can be a lot of overlap with joins, in that often the same query can be written using either a join or a sub-query, and a join may well be more efficient.  A sub-query can produce a scalar value for use in an expression, a column of single field results, a single row with several fields or a whole table of data that takes the place of a regular table. To find out more the mysql documentation is to be found at <a href="http://dev.mysql.com/doc/refman/5.5/en/subqueries.html" title="http://dev.mysql.com/doc/refman/5.5/en/subqueries.html"  target="_blank">http://dev.mysql.com/doc/refman/5.5/en/subqueries.html</a>.</p>
<h3>Analyse Your Queries - Can They Be Improved?</h3>
<p>Use MySQL's <strong>explain keyword</strong> when writing your queries to determine the most efficient way to write them when there are alternative ways of doing the same thing.  <code>EXPLAIN</code> analyses the query and shows how many table rows have to be read to produce the output and which indices are used.  Judicious use of indices can improve performance but poor use of them can actually make things worse, so they are worth giving careful thought to if you have sufficient access to/control of the database. Using <code>EXPLAIN</code> can also help you determine if changing the order of tables in a <code>JOIN</code> may improve the efficiency of a query.</p>
<p>It is very simple to use; when you think you have your query written, just run it with <code>EXPLAIN</code> in front of it.  Then try some alternative ways of achieving the same output, or tweak the indices and compare the results.<br />
eg.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">EXPLAIN</span> 
<span style="color: #993333; font-weight: bold;">SELECT</span> staff<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> department<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> grade 
<span style="color: #993333; font-weight: bold;">FROM</span> departments <span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> staff <span style="color: #993333; font-weight: bold;">ON</span> department<span style="color: #66cc66;">.</span>id <span style="color: #66cc66;">=</span> staff<span style="color: #66cc66;">.</span>department_id ;</pre></div></div>

<h3>Use Prepared Statements</h3>
<p>Any security article covering PHP and MySQL will cover the desirability of using the prepared statements feature in PDO (PHP Data Objects) to guard against SQL injection. This is where the query is defined with place holders for changeable parameters which are then bound to it at execution.  It also improves performance if the query is to be run a number of times with different data, as the query is only parsed when prepared rather than every time it is run as with a normal query repeated.  I would view using these wherever possible as mandatory.</p>
<h3>Transfer Data Efficiently</h3>
<p><code>LOAD DATA INFILE </code>(and the accompanying <code>mysqlimport</code> command line tool) is the most efficient way to insert a number of records into a table.  Next time you need to do some sort of bulk import consider whether it is practical to have an appropriately formatted csv file transferred to the server (perhaps by FTP or equivalent ) and then use <code>LOAD DATA INFILE </code>to process it rather than reading it line-by-line in your script and inserting each record individually.  You will have a much faster script that will have less impact on the server.</p>
<h3>Enforce Data Consistency with Triggers and without Network Traffic</h3>
<p><strong>Triggers</strong> are defined statements that are run either before or after <code>INSERT/UPDATE/DELETE</code> operations on a table.  They can be quite complex operations with the use of a block of statements and conditions.  They can save the programmer having to remember to implement this logic each time the data is used and therefore help to force the integrity of the data.  As an example, related records could also be deleted or updated to reflect the change or an entry created in an archive table when a record is deleted.  They tend to have a bad reputation amongst developers; I suspect it is because they instinctively don’t like something they aren’t controlling.  Perhaps if we thought of them in terms of the observer pattern we would be more at ease with them!<br />
eg.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">delimiter <span style="color: #CC0099;">|</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TRIGGER</span> demo 
  BEFORE <span style="color: #990099; font-weight: bold;">INSERT</span> 
  <span style="color: #990099; font-weight: bold;">ON</span> t1
  <span style="color: #990099; font-weight: bold;">FOR EACH ROW</span> 
  <span style="color: #990099; font-weight: bold;">BEGIN</span>
    <span style="color: #990099; font-weight: bold;">SET</span> full_name <span style="color: #CC0099;">=</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span>NEW.first_name<span style="color: #000033;">,</span> <span style="color: #008000;">' '</span><span style="color: #000033;">,</span> NEW.last_name<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
    <span style="color: #990099; font-weight: bold;">DELETE</span> <span style="color: #990099; font-weight: bold;">FROM</span> t2 <span style="color: #990099; font-weight: bold;">WHERE</span> code <span style="color: #CC0099;">=</span> NEW.code<span style="color: #000033;">;</span>
  <span style="color: #009900;">END</span><span style="color: #000033;">;</span>
<span style="color: #CC0099;">|</span>
&nbsp;
delimiter <span style="color: #000033;">;</span></pre></div></div>

<h3>Pick the Right Database Engine for Your Tables</h3>
<p>Database Engines are an important element to consider when designing a database. A default engine is set for a database, but can be changed per table. Think about what sort of table you are defining, and don’t just let MySQL default to the MYISAM engine.  MYISAM tables are good for tables largely used for lookup and searches but if it is to be updated frequently the INNODB engine which comes with the option of transactions is a better choice as the use of transactions will improve data integrity.</p>
<h2>Take Advantage of MySQL Views in Your Application</h2>
<p><strong>Views are stored select statements</strong> that can then be used in a query as if it was an ordinary table.  They can select data from tables and also other views using most of the constructs available to any <code>SELECT</code> query.  The only proviso is that there has to be some solid data behind it, so temporary constructs such as user variables and temporary tables are not available in views. The <code>SELECT</code> statement in the view is actually run when the view is used in a query; either the <code>SELECT</code> criteria merged with those of that query or run first to produce a temporary table which is then queried further by the end query.</p>
<p>Views can also be used to hide table structure changes, such as a table split into two.  A view could be created with the old table name and effectively the same data, and then users would be able to query that as before without disruption.</p>
<p>Views particularly come into their own when reports are being generated.  The view can be designed to select the base data the report(s) are based on, and then a report query can select and perform calculations based on this set of data - without the writer of that query having to know all the ins and outs of where the data is obtained.  If the temporary table option is used then the underlying data tables are not being tied up for longer than necessary and are free for other users.  A standard <strong>temporary table</strong> could be created for the same purposes but that has the disadvantage of being more likely to get out of date and using a view also means that the SQL for creating the "temporary table" is kept in the database and is accessible by all users with the relevant permission.  Depending on the exact circumstances, this may or may not be appropriate.</p>
<p>To illustrate a view in action (although there are doubtless better ways of achieving what this does!)</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">ALGORITHM</span> <span style="color: #CC0099;">=</span> <span style="color: #990099; font-weight: bold;">TEMPTABLE</span> <span style="color: #990099; font-weight: bold;">VIEW</span> engineering_staff <span style="color: #FF00FF;">&#40;</span>name<span style="color: #000033;">,</span> location<span style="color: #000033;">,</span> grade<span style="color: #000033;">,</span> manager_id<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">AS</span>
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span>staff.firstname<span style="color: #000033;">,</span> <span style="color: #008000;">' '</span><span style="color: #000033;">,</span> staff.lastname<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> department.location<span style="color: #000033;">,</span> staff.grade<span style="color: #000033;">,</span> staff.manager_id<span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">FROM</span> department <span style="color: #000099;">LEFT</span> <span style="color: #990099; font-weight: bold;">JOIN</span> staff <span style="color: #990099; font-weight: bold;">on</span> department.id <span style="color: #CC0099;">=</span> staff.department_id
<span style="color: #990099; font-weight: bold;">WHERE</span> department.name <span style="color: #CC0099;">=</span> <span style="color: #008000;">'Engineering'</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SELECT</span> name<span style="color: #000033;">,</span> location<span style="color: #000033;">,</span> grade
<span style="color: #990099; font-weight: bold;">FROM</span> engineering_staff
<span style="color: #990099; font-weight: bold;">WHERE</span> grade <span style="color: #CC0099;">&gt;</span> <span style="color: #008080;">5</span>
<span style="color: #990099; font-weight: bold;">ORDER BY</span> grade<span style="color: #000033;">;</span></pre></div></div>

<p>If there is a clear one-to-one correlation between a view’s output rows and the underlying data then views can also be used in <code>UPDATE</code> and <code>DELETE</code> statements.</p>
<h2>Procedures and Functions in MySQL</h2>
<p>A few years ago, before joining Ibuildings, I spent some months working on a major application that used PHP with the Oracle database and the application made very heavy use of Oracle's procedures and functions; the SQL in the code itself was largely confined to call statements to use the procedures.  This functionality was new to me as it wasn’t available in MySQL at that time (it was introduced with version 5), so MySQL developers don’t have a history of using these in the same way that users of other databases do.</p>
<p>The MySQL documentation defines a stored routine as:</p>
<blockquote><p><em>A stored routine is a set of SQL statements that can be stored in the server. Once this has been done, clients don't need to keep reissuing the individual statements but can refer to the stored routine instead.<br />
</em></p></blockquote>
<p>It is effectively a mini SQL program that is stored in the database; it has inputs, outputs and processing. Stored Routines is a term used to refer to two constructs that have many similarities but also some important differences. </p>
<p>Whilst MySQL provides a <strong>wide range of built in functions</strong> such as <code>CONCAT()</code> or <code>YEAR()</code>, it is also possible to <strong>write your own</strong>.  Just like stored procedures, they can take input parameters and do some complicated processing but they must return a single value of a declared type.  A function is used in an expression within an SQL statement just as the built-in functions are, for example:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> id<span style="color: #66cc66;">,</span> name<span style="color: #66cc66;">,</span> MYFUNC<span style="color: #66cc66;">&#40;</span>grade<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> dept <span style="color: #993333; font-weight: bold;">FROM</span> staff <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> name;</pre></div></div>

<p>A stored procedure is more complex, it has both input and output parameters and the results of a <code>SELECT</code> statement are returned to the calling code if not part of a cursor, just as with a standard <code>SELECT</code> query.  It is actioned by using the <code>CALL</code> statement.  Quite simply it would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CALL</span> my_procedure<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h3>What do Stored Procedures Have to Offer?</h3>
<p>In a nutshell:</p>
<ul>
<li>You can write considerably more complicated SQL than in a simple query, expressing more complex logic.  There are control structures available, such as if/else and loops. With cursors you can iterate through the output of a SELECT statement.
</li>
<li>By doing the logic processing within the database less data needs to be transferred from the database server, improving performance, although it does make more demands on the database server’s memory.
</li>
<li>There is error handling available, so a failure doesn’t have to be a show-stopper, improving robustness.
</li>
<li>The code can be re-used by a range of applications and each developer does not have to re-invent the wheel.  With the use of parameters both in and out the procedures can be written to be context dependent, increasing their flexibility and usefulness.
</li>
<li>As with the client/server contract between classes the calling program doesn’t have to know how the database is organised so it is easier to change this without breaking applications or spending a considerable amount of time tracking down where the data is used.
</li>
<li>The procedure can be written to use the privileges of the user who creates it so enabling securer use of sensitive data which can be processed without being returned to the client and without the script’s users needing to have the level of privileges needed to access the data directly.
</li>
</ul>
<p></p>
<p>How to write a stored procedure is a tutorial subject in it's own right, so I don't propose to go into it here. The mysql documentation at <a href="http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html" title="http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html" target="_blank">http://dev.mysql.com/doc/refman/5.5/en/create-procedure.html</a> is a useful starting point.</p>
<p>There are many different options for using MySQL with PHP; here I will give a quick example of calling a stored procedure from PHP using PDO, which is my preferred method.  Suppose we had a stored procedure which takes an input string, does some clever stuff with some tables and then returns a single output value and a set of records from a select within the routine.  In PHP you might see something like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PDO<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql:dbname=test;host=localhost'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'testuser'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'testpassword'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CALL my_procedure(‘input string’, @output);&quot;</span><span style="color: #009900;">&#41;</span>
                  <span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_ASSOC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT @output;&quot;</span><span style="color: #009900;">&#41;</span>
                       <span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_ASSOC</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Getting the results of the select will look familiar, but getting the output value is a bit more complicated this makes use of MySQL’s user variables - denoted by <code>@</code>. This can be initialised beforehand with a SET query (<code>SET @output := 0;</code>).  However using it without prior initialisation will initialise it to null and then the procedure populates it with a value.  To get the contents of a user variable you need to select it.</p>
<h2>Making the Most of MySQL</h2>
<p>Although this has been a lightening tour, I hope I've given you a taste of the features in MySQL that I'll be using in my applications in the future - and that I've whetted your appetite to find out more about them and to be more adventurous with MySQL.  If there's a particular feature that you think belongs on the list, or you can personally recommend a tutorial site, then leave us a comment and tell us what it is and why!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F&amp;title=Are+You+Making+the+Most+of+MySQL%3F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F&amp;title=Are+You+Making+the+Most+of+MySQL%3F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F&amp;title=Are+You+Making+the+Most+of+MySQL%3F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F&amp;headline=Are+You+Making+the+Most+of+MySQL%3F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Are+You+Making+the+Most+of+MySQL%3F&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Are+You+Making+the+Most+of+MySQL%3F&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Are+You+Making+the+Most+of+MySQL%3F&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Are+You+Making+the+Most+of+MySQL%3F&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Are+You+Making+the+Most+of+MySQL%3F&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F&amp;title=Are+You+Making+the+Most+of+MySQL%3F&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2012%2F01%2F05%2Fare-you-making-the-most-of-mysql%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2012/01/05/are-you-making-the-most-of-mysql/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DPC Radio: Profiling PHP Applications</title>
		<link>http://techportal.ibuildings.com/2011/12/14/dpc-radio-profiling-php-applications/</link>
		<comments>http://techportal.ibuildings.com/2011/12/14/dpc-radio-profiling-php-applications/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 09:57:21 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[derick rethans]]></category>
		<category><![CDATA[optimising]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[PHP applications]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[xdebug]]></category>
		<category><![CDATA[xhprof]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3402</guid>
		<description><![CDATA[Derick Rethans The web is full of useful advice focussed on pushing out the last bit of performance of your code. They mention trivial changes. like changing every occurrence of print with echo even suggesting to use for instead of foreach. These optimisations help, but you are not going to notice it unless they're in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Derick Rethans</strong></p>
<p>The web is full of useful advice focussed on pushing out the last bit of performance of your code. They mention trivial changes. like changing every occurrence of print with echo even suggesting to use for instead of foreach. These optimisations help, but you are not going to notice it unless they're in a tight loop with many iterations. It is also a wrong approach for tackling performance issues. Before you can optimise, you need to find out if your codeis actually slow; then you need to *understand* the code; and *then* you need to find out where you can optimise it. This talk introduces tools and concepts to optimise the optimisation of your PHP applications.</p>
<p>You can find Derick's talk slides <a href="http://derickrethans.nl/talks/profiling-dpc11.pdf">over on his site</a> [PDF]</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F&amp;title=DPC+Radio%3A+Profiling+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F&amp;title=DPC+Radio%3A+Profiling+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F&amp;title=DPC+Radio%3A+Profiling+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F&amp;headline=DPC+Radio%3A+Profiling+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Profiling+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Profiling+PHP+Applications&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Profiling+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Profiling+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Profiling+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F&amp;title=DPC+Radio%3A+Profiling+PHP+Applications&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F12%2F14%2Fdpc-radio-profiling-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/12/14/dpc-radio-profiling-php-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_015.mp3" length="48234937" type="audio/mpeg" />
		</item>
		<item>
		<title>DPC Radio: Distributed Couch Apps - Embracing eventual consistency</title>
		<link>http://techportal.ibuildings.com/2011/11/21/dpc-radio-distributed-couch-apps-embracing-eventual-consistency/</link>
		<comments>http://techportal.ibuildings.com/2011/11/21/dpc-radio-distributed-couch-apps-embracing-eventual-consistency/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 14:30:26 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[Kore Nordmann]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[qafoo]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3371</guid>
		<description><![CDATA[Kore Nordmann CouchDB is a prominent representative of the NoSQL movement. Using its integrated web server and eventual consistent replication you can not only distribute data, but also full application code. This even works for clients which are not always connected to the internet, like e.g. mobile devices. This session gives you an insight Couch [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Kore Nordmann</strong></p>
<p>CouchDB is a prominent representative of the NoSQL movement. Using its integrated web server and eventual consistent replication you can not only distribute data, but also full application code. This even works for clients which are not always connected to the internet, like e.g. mobile devices. This session gives you an insight Couch apps, their beauty and pitfalls.</p>
<p>You can find Kore's slides over on <a href="http://talks.qafoo.com/">http://talks.qafoo.com/</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F&amp;title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F&amp;title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F&amp;title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F&amp;headline=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F&amp;title=DPC+Radio%3A+Distributed+Couch+Apps+-+Embracing+eventual+consistency&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F21%2Fdpc-radio-distributed-couch-apps-embracing-eventual-consistency%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/11/21/dpc-radio-distributed-couch-apps-embracing-eventual-consistency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_006.mp3" length="82204155" type="audio/mpeg" />
		</item>
		<item>
		<title>DPC Radio: Developing and Deploying High Performance PHP Applications</title>
		<link>http://techportal.ibuildings.com/2011/11/10/dpc-radio-developing-and-deploying-high-performance-php-applications/</link>
		<comments>http://techportal.ibuildings.com/2011/11/10/dpc-radio-developing-and-deploying-high-performance-php-applications/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 11:15:41 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[Christopher Jones]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[high performance php applications]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3369</guid>
		<description><![CDATA[Christopher Jones This session starts with a brief but important overview about the growing Oracle technology eco-system. It shows what Oracle's direction means for PHP application development and deployment. The majority of the talk then highlights techniques on building high performance PHP applications with the very widely used Oracle Database. Techniques include connection pooling, application [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Christopher Jones</strong></p>
<p>This session starts with a brief but important overview about the growing Oracle technology eco-system. It shows what Oracle's direction means for PHP application development and deployment.</p>
<p>The majority of the talk then highlights techniques on building high performance PHP applications with the very widely used Oracle Database. Techniques include connection pooling, application monitoring, automatic data privacy for PHP application users, online application upgrades, caching for performance, and how to suspend and resume database transactions to effectively build stateful web applications.</p>
<p>You can find Chris' slides <a href="http://www.oracle.com/technetwork/topics/php/highperf-php-preso-405765.pdf">on oracle's technetwork</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F&amp;title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F&amp;title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F&amp;title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F&amp;headline=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F&amp;title=DPC+Radio%3A+Developing+and+Deploying+High+Performance+PHP+Applications&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F11%2F10%2Fdpc-radio-developing-and-deploying-high-performance-php-applications%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/11/10/dpc-radio-developing-and-deploying-high-performance-php-applications/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_005.mp3" length="50101613" type="audio/mpeg" />
		</item>
		<item>
		<title>Architecture Patterns: Domain Model and Friends</title>
		<link>http://techportal.ibuildings.com/2011/10/31/architecture-patterns-domain-model-and-friends/</link>
		<comments>http://techportal.ibuildings.com/2011/10/31/architecture-patterns-domain-model-and-friends/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 07:53:34 +0000</pubDate>
		<dc:creator>Robert Raszczynski</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[domain model]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[mapper]]></category>
		<category><![CDATA[model]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3421</guid>
		<description><![CDATA[Imagine a workshop of a racing team. The very first thing you will notice is that everything has its own place; spanners hanging on walls sorted by size, other tools placed in drawers, divided by their purpose, bolts and nuts placed in separate dividers and once again sorted by size. Everything is labeled, clean and [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine a workshop of a racing team. The very first thing you will notice is that everything has its own place; spanners hanging on walls sorted by size, other tools placed in drawers, divided by their purpose, bolts and nuts placed in separate dividers and once again sorted by size. Everything is labeled, clean and in order. Now imagine how would it be to work in such an environment, where every single item has its specific place. I reckon that after the first few days, you would be able to point to where everything is with your eyes closed! Such a degree of segregation and organisation makes our lives much easier and it's a pleasure to work with. </p>
<p><a href="http://www.flickr.com/photos/tahini/4047928459/"><img alt="tools wall by Mr Thinktank, on Flickr" src="http://farm3.static.flickr.com/2773/4047928459_b0b07d74a5_m.jpg" class="alignright" width="240" height="180" /></a></p>
<p>Architectural and design patterns help software architects to break systems in to smaller, more maintainable sections organised by their functionality and usage. The biggest benefit of patterns is that someone has already solved problems we may face and by utilising patterns such as Transactional Script, Domain Model or Data Mapper in your application it gives us, as developers, some good guidelines on how it should be designed. <span id="more-3421"></span></p>
<p>Now take a a look at the code in your current project. Is it as well organised as that workshop? Is every class grouped by its purpose, in a nicely organised directory structure? I suspect most of us will answer "just about" to these questions. Most web applications are built of various subsystems, where each one is responsible for different things, such as reading from and writing to a database, retrieving data from a feed, and so on. It's exactly the same as in the workshop, different parts of the system have different purposes; hence they should be grouped in layers. Think about a cake and how it is layered, with sponge at the bottom, jam and cream on the top.</p>
<p>Subsystems, with different responsibilities, are arranged in layers, where each one rests on the layer below it. Higher layers use APIs or services provided by the lower layer, however this lower layer is completely unaware of the fact that there is a layer above it - and it hides another lower placed layer from the layer above. Such architecture encourages separation and decreases coupling between different parts of a system.</p>
<p>There are three major layers in software architecture:</p>
<ul>
<li><b>presentation</b> - the layer contains all the logic responsible for handling interactions between the systems and an user, whether by using GUI or command line. The layer is responsible for displaying information to the user and collecting user input that is passed to domain logic.</li>
<li><b>domain</b> - the domain logic layer is also referred as business logic. This layer is the workhorse of an application, it does all the work the application needs to do. The domain logic does calculations on users’ input or stored data. It passes the data to data source layer so it can be persist, furthermore, the layer validates input passed from the presentation layer. </li>
<li><b>data source</b> - the layer’s purpose is mainly to communicate with other systems, such as databases, messaging systems and transaction managers. In web applications the major communication will be with different database systems.</li>
</ul>
<p></p>
<p>Now that we know what types of layers we can find in software architecture, let's have a look at how we can organize domain logic and data sources layers. </p>
<h3>Organizing Domain Logic</h3>
<p>There are three main design patterns that help us to organize domain logic; these are <strong>transaction script</strong>, <strong>table module </strong>and <strong>domain model</strong>.  The following sections will take each of these patterns in turn and examine their suitability for application in various situations. </p>
<h4>Transaction Script</h4>
<p>The transaction script pattern is the simplest solution for organizing domain logic. There is a collection of scripts that are executed on a server, and every script handles a single procedure that corresponds to a specific request made by a user or another system. The procedure may involve taking user input from the presentation layer, validating it and then storing the data in a database or passing it to external services.  </p>
<p>If you have been using PHP for a while, you may remember the way websites were built in the late 90s and around the beginning of the millennium. You had a massive set of scripts, named as <code>guestbook.php</code>, <code>add_entry.php</code>, and <code>view_entry.php</code>, and each of them did one job. In our example scripts, would present all guest book entries, add a new entry to the guest book and display one single entry.</p>
<p>Transaction script is an ideal solution for systems with only a small amount of logic, because it is very easily understood by developers, it has little performance overhead and it performs well with an elementary data source layer when put into action with patterns such as <strong>Row Data Gateway</strong> or <strong>Table Data Gateway</strong>. However, you will discover transaction script's disadvantages as soon as the complexity of your domain logic increases. Quite often various transactions must perform similar actions, which leads to duplication of code across them. Some of the code can be refactored into separate classes or functions, however it gets harder and harder to keep the application's structure well-organised as the complexity grows.</p>
<h4>Table Module</h4>
<p>The next design pattern for organizing domain logic is Table Module. It presents a database-centric approach; all the business logic is organised around database tables. In Table Module, a single class encapsulates all the domain logic for all records stored in a table or view. It's important to note that there is no translation of data between objects and rows, as it happens in Domain Model, hence implementation is relatively simple when compared to the Domain Model pattern (which is next on the list). Table Module provides an interface to perform operations on all the data, so every time there is a need to work on a particular row, a method expects some kind of identity reference to be passed as one of the parameters.</p>
<p>As mentioned before, Table Module is much simpler than Domain Model, making it an ideal middle ground solution between Transaction Script and Domain Model. With Table Module you gain much more structure and lower level of code duplication comparing to Transaction Script, because the domain logic is organized around tables rather than procedures. Table Module is an ideal candidate when an application makes heavy use of tabular data, which normally is a result of a SQL call, because it supports a Record Set pattern very well. However, if your application requires direct instance to instance relationship, then Domain Model will be much more appropriate choice as it better handles complicated domain logic.</p>
<h4>Domain Model</h4>
<p>The third and more complex solution for organizing domain logic is a design pattern called Domain Model. The pattern provides an object-oriented way of dealing with complicated logic. Instead of having one procedure that handles all business logic for a user action, there are multiple objects and each of them handles a slice of domain logic that is relevant to it. When you start building a model of your application's domain, which in fact is an abstract representation of reality, you will find that initial classes are organised essentially around the nouns in the domain. For instance, when you build an e-commerce solution you will end up with classes such as <em>Customer</em>, <em>Basket</em>, <em>Category</em> and <em>Product</em>; these are the first things you will discuss when thinking about the domain. In a nutshell, each of the classes will incorporate both the data, mainly represented in form of attributes, and all the behaviour that is related to that data. Additionally, Domain Model objects are usually in a one-to-one relationship with records in database tables.</p>
<p>Domain Model is built out of small, loose objects with elegant interfaces, that stay completely free of any external dependencies. Persisting data in Domain Model can be done by implementation of the Data Mapper pattern; this is a great fit, but it will raise the level of complexity. It helps to deal with highly complex business logic in well organised manner, however, it also requires an object-oriented paradigm shift from developers wanting to use it. In fact the Domain Model pattern has a very steep learning curve and the process itself may be very frustrating and time consuming for people new to a rich object model. They can find themselves in a situation where they spend more time jumping from class to class looking for the behaviour they are interested in.</p>
<p>Taking a decision on whether to use Domain Model is highly dependent on the complexity of the business logic. Domain Model handles increasing complexity very well, however, it may take months before developers are fully confident working with the pattern.</p>
<h3>Choosing the right solution for domain logic of your application</h3>
<p>So far we have looked at three architecture design patterns that will help you to organize domain logic. However, the big question is <strong>which pattern you should pick for your application</strong>. Unfortunately, there is no straight answer. The decision-making process will be mainly based on judging the complexity of the application's domain logic. The rule will be that you would pick Transaction Script for applications with a lower complexity level and Table Module or Domain Model for applications where the business logic is more demanding. In general you wouldn't use Domain Model pattern for systems with simple domain logic, because the cost of understanding it and complexity of data source exceeds the benefit of this pattern. At the same time you need to consider changing requirements and how they may influence your application. Transaction Script and Table Module will definitely hit a wall much faster than Domain Model when the complexity of the business logic is increased by adding more features. Below is a chart representing relationship between complexity of domain logic and effort needed to introduce new features.</p>
<p><img src="http://techportal.ibuildings.com/wp-content/uploads/2011/10/graph.png" alt="graph showing complexity and effort" width="635" height="469" class="alignnone size-full wp-image-3457" /></p>
<p><strong>Relationship between effort and complexity for different domain logic architecture design patterns.<br />
Source: <a href="http://www.amazon.com/gp/product/0321127420/ref=as_li_ss_tl?ie=UTF8&amp;tag=lorn-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0321127420">Patterns of Enterprise Application Architecture</a><img src="http://www.assoc-amazon.com/e/ir?t=lorn-20&amp;l=as2&amp;o=1&amp;a=0321127420&amp;camp=217145&amp;creative=399369" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" /> by Martin Fowler.</strong></p>
<p>Remember that even after you take your decision there may be new requirements that could change the application's complexity. In such circumstances it may be worthwhile to upgrade your chosen pattern, for instance refactor Transaction Script to Domain Model. However it won't make sense, in most situations, to go from Domain Model to Transaction Script.</p>
<p>Remember also that there is no rule to say you have to pick one pattern only; you can combine them in your design.  It is common to delegate some business logic to Transaction Script and then use Domain Model or Table Module for other domain logic.</p>
<h3>Organizing Data Source Layer</h3>
<p>The main purpose of the data source layer is to communicate with other systems and to retrieve/persist data. When working with PHP you will find that the data source layer will usually connect to some sort of database. It is desirable, as a good coding practise, to separate database access and all SQL queries from domain logic and place it in separate classes. In most cases classes are organised around the table structure of the database, with each class corresponding to a table. It’s worth mentioning that your choice of data source pattern will be affected by which design solution you chose for the domain logic.  Let's have a look at some options:</p>
<h4>Gateway</h4>
<p>When classes are based on table structure of the database, they act as a gateway to the table, encapsulating the SQL and database connection from any domain logic or presentation. There are two types of gateways: <strong>Row Data Gateway </strong>and <strong>Table Data Gateway</strong>.</p>
<h5>Row Data Gateway</h5>
<p>A class implementing Row Data Gateway pattern contains only data source logic, such as database access and simple conversion from database to in-memory types. An object looks exactly like a record in a table or a view, with each column mapped to a property.</p>
<p>Row Data Gateway should never include any of the business logic. If that's the case then it really an <strong>Active Record </strong> pattern instead.</p>
<h5>Table Data Gateway</h5>
<p>An instance of Table Data Gateway handles and encapsulates all the SQL used to access and modify all the rows in a single table or a view. The class usually provides a simple interface that includes multiple methods for finding data based on a condition, as well as some insert, update and delete methods. Each of the methods will map input parameters into SQL queries and then execute them against database connection.</p>
<p>Table Data Gateway always creates a record set when it returns data retrieved from database, even when there was just a simple find by primary key method executed. That makes the pattern very well suited to work with the Table Module pattern.</p>
<p><b>Editor's Note: </b>Keep reading for code examples including Table Data Gateway.</p>
<h4>Data Mapper</h4>
<p>Very often, domain objects will have some attributes, for instance collections, that are not part of the database schema. This mismatch requires some sort of mechanism that helps structuring and transferring data between the domain logic and the database. This is exactly what Data Mapper does - it is a layer that separates the business logic from the database by moving data from one to the other. A simple implementation of Data Mapper would just map table columns to equivalent attributes of a domain class.</p>
<p>The great benefit of using Data Mapper is the fact that domain objects don't need to know that there is a database present, making it easy to introduce changes to database structure or domain logic. Additionally, the entire Data Mapper layer can be easily substituted with mocks and stubs for testing purposes.</p>
<p>Data Mapper is mostly used together with Domain Model, and we will go on to look at a <strong>code example</strong> of using these together.</p>
<h3>Patterns in Practise</h3>
<p>I would like to present an example showing how you can combine Data Logic and Data Source using design patterns mentioned in the article. I will mainly focus on Domain Model, Data Mapper and Table Data Gateway patterns. For the purpose of this example lets assume that we need to build ecommerce web application.</p>
<h4>Domain Model  </h4>
<p>While analysing requirements you will notice that there are few nouns you talk about repeatedly. It’s your <em>Customer</em>, a <em>Product</em> the customer looks for, and a <em>Basket</em> where the product gets added to by the customer. These three are your domain specific classes. Lets start writing some code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Customer
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$address</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">class</span> Product
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$description</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$price</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">class</span> Basket
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @var ArrayObject collection of products added to basket
     */</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$products</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$customer</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Each of the above classes will include some business logic specific to its domain. The Customer class may have methods for managing shipping address and financial details, the Product class may have methods that calculate taxes or discounts, and so on . The key is to keep these classes small and compact. </p>
<h4>Data Mapper</h4>
<p>As mentioned before, Data Mapper is used to move data between layers. For the purpose of this example we will have three database tables <code>customers</code>, <code>products</code> and <code>baskets</code>. Based on our domain model we know that we need to feed data into three objects, so the mappers we create will map data from the <code>customers</code> table to the <code>\Store\Customer</code> class, from <code>products</code> to <code>\Store\Product</code>, and lastly, from <code>baskets</code> to <code>\Store\Basket</code>. Below is a starting point for <code>\Store\Data\Mapper\Customer</code> data mapper; all the other classes will look pretty similar at this early stage.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store\Data\Mapper<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Customer
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * @var \ArrayObject
     */</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$identityMap</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @var \Store\Data\Gateway
     */</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$gateway</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * By using dependency injection it is much easier to unit test your mapper
     *
     * @param \Store\Data\Gateway $gateway
     * @param \ArrayObject $identityMap
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span>\Store\Data\Gateway <span style="color: #000088;">$gateway</span><span style="color: #339933;">,</span> \ArrayObject <span style="color: #000088;">$identityMap</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gateway</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$gateway</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">identityMap</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$identityMap</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you can see constructor takes two parameters, first is an instance of <code>\Store\Data\Gateway</code> that implements the <strong>Table Data Gateway</strong> pattern. I decided to use the pattern here because it provides additional separation, however, it is entirely up to you how to handle SQL. The second parameter is instance of <code>ArrayObject</code> that acts as an <strong>Identity Map</strong>, which is used by the mapper’s find methods to ensure that every object is loaded only once. Lets have a look how it works:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store\Data\Mapper<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Customer
<span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">...</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * finds customer’s row by primary key
     *
     * @param int $id
     * @return \Store\Customer
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> find<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">identityMap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">offsetExists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">identityMap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">offsetGet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">// By using Table Data Gateway we hide away all SQL</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gateway</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFirstItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$customer</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Store\Customer<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Simple mapping of data from Db to Domain Model</span>
        <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAddress</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'address'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Store customer object in identity map</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">identityMap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">offsetSet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$customer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// And return Customer object</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$customer</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The first thing the find method does is a check whether data has been already loaded from database. If not, the mapper gets the data by using Table Data Gateway and maps it to the domain object. In my example it's a very simple mapping which links column to attribute, however, you can implement more sophisticated, metadata based mapping should you need it.</p>
<p>Lets have a look at how data is persisted when using Domain Model and Data Mapper.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Store\Data\Mapper<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Customer
<span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">...</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * save
     *
     * @param \Store\Customer $customer
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> save<span style="color: #009900;">&#40;</span>\Store\Customer <span style="color: #000088;">$customer</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Simple mapping of domain model to table columns</span>
        <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'address'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gateway</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$customer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gateway</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Data Mapper has a <code>save()</code> method that expects an object of the domain model, in this case <code>\Store\Customer</code>. Once again the mapper prepares data and passes it to the database using a Table Data Gateway pattern. The code here is for <code>Customer</code> only but the concept applies to all domain model objects.</p>
<p>I hope that above example will help you analyse the requirements of your next project, and if you decide that these patterns are a good fit, that you will be able to introduce Domain Model, Data Mapper and Table Data Gateway easily.  Are you using these patterns or planning on using them for the next project?  Leave us a comment and let us know where they fit in your current or future applications!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F&amp;title=Architecture+Patterns%3A+Domain+Model+and+Friends" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F&amp;title=Architecture+Patterns%3A+Domain+Model+and+Friends" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F&amp;title=Architecture+Patterns%3A+Domain+Model+and+Friends" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F&amp;headline=Architecture+Patterns%3A+Domain+Model+and+Friends" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F&amp;title=Architecture+Patterns%3A+Domain+Model+and+Friends&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F31%2Farchitecture-patterns-domain-model-and-friends%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/10/31/architecture-patterns-domain-model-and-friends/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PHPNW11 Conference Report - Part II</title>
		<link>http://techportal.ibuildings.com/2011/10/27/phpnw11-report-part-ii/</link>
		<comments>http://techportal.ibuildings.com/2011/10/27/phpnw11-report-part-ii/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 13:19:41 +0000</pubDate>
		<dc:creator>Marco De Bortoli</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[phpnw11]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3443</guid>
		<description><![CDATA[This is the second part of our PHPNW11 conference review. Check out the previous part here. Tutorial Day The conference started on Friday with its first ever tutorial day. I attended the "Security" tutorial by Arne Blankerts as it's very relevant for the project I'm working on at the moment. The talk was very enjoyable, [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is the second part of our <a href="http://conference.phpnw.org.uk/phpnw11/">PHPNW11 conference</a> review. Check out the previous part <a href="http://techportal.ibuildings.com/2011/10/20/phpnw11-conference-report/">here.</a></em></p>
<h2>Tutorial Day</h2>
<p>The conference started on Friday with its first ever tutorial day. I attended the <strong>"Security"</strong> tutorial by Arne Blankerts as it's very relevant for the project I'm working on at the moment. The talk was very enjoyable, especially because for the first time someone put emphasis not only on the software security aspect, but also on the hardware and the physical access control policy. You can put all your efforts and apply all the best practices to make your software secure, but everything can vanish in a moment if anyone can access your data centre without restrictions. My colleague Marco Lopes has reviewed this tutorial in more detail in his <a href="http://techportal.ibuildings.com/2011/10/20/phpnw11-conference-report/">PHPNW11 report</a>.</p>
<p>The second tutorial I attended was <strong>"Maintainable Applications in PHP Using Components"</strong> by Stuart Herbert. It was his first time delivering this content and I have to say he did it in an awesome way. Despite the network connection problems we had (which delayed the tutorial a bit), we got along very well by the time everyone had their environment setup. Stuart's tutorial was full of hands-on code. This course was not only a lot of fun and laughs, but interesting content too. I'm looking forward to using Phix to create my components repository, maybe pairing its workflow with the chef-based one we are already adopting at Ibuildings. Definitely a thumbs up for Stuart's project.</p>
<h2>Main Conference</h2>
<p><span id="more-3443"></span>Ian Barber delivered the PHPNW11 opening keynote - an inspiring talk that gave us all the motivation to get back on track and contribute more to the community.</p>
<p>The day continued with Ben Longden's talk on <strong>"REST and the Hypermedia Constraint: A Case Study"</strong>. Ben showed us how constraints are not necessarily bad, but instead can help you improve the way you implement your software. Talking about REST, he clearly demonstrated how the Hypermedia constraint can be very useful for de-coupling the server, provisioning the information and the client consuming it, reiterating what is REST and what is a RESTful API.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6232003798/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6050/6232003798_f97a9e7b31.jpg" title="REST and HateOAS Talk by Ben Longden (c) Stuart Herbert" class="alignright" width="500" height="338" /></a></p>
<p>Following this, I was in the mood for a bit of PHP internals - and who better than Derick Rethans to talk about them? The talk title <strong>"PHP Extensions, why and what?"</strong> as expected wasn't about how to write extensions but about what they are and how they differ from components (and why and when you should prefer them to anything else). A very insightful talk; I'm now eager to write my own extension, with a better understanding of how they can be improved and how conceptually they should be taken into account.</p>
<p>I started my afternoon with Alistair Stead's talk titled <strong>"Varnish your PHP application, make it fly!"</strong>, trying to gather more information and key points to convince the client I'm currently working for that it's time to seriously think about replacing Squid in favour of Varnish. Alistair is probably one of my favourite speakers; he gave a very well presented talk that covered caching concepts, mechanics and how Varnish can make your life easier. The winning point for most of the audience, myself included, was showing some numbers and graphs from a real use case which left people drooling at the idea of getting the same results with a proper caching strategy implementation.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6232033132/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6163/6232033132_26970170fc.jpg" title="Alistair Stead talking about Varnish (c) Stuart Herbert" class="alignright" width="500" height="332" /></a></p>
<p>BDD is rapidly taking its place amongst the common list of developers' best practices. Ben Waine's talk titled <strong>"Acceptance &#038; Integration Testing Using Behat"</strong> brought his experience directly from the Sky Bet company field where Behat is commonly used to coordinate BAs, testers and developers in the most effective way. The talk went through the use of Gherkin, the language Behat uses, to defining its test scenarios down to the Phabric library used to define fixtures "on the fly" - once again using Gherkin tables saving you the pain of dealing with it. It also maintains all the SQL scripts used. All in all, a lightweight, well-presented talk, good for those who are not that much into the BDD concept.</p>
<p>To complete the first day I attended Thijs Feryn's talk <strong>"CLI, the other SAPI"</strong>. Why? Well, as a command line warrior I'm particularly interested in exploring PHP's potential as a command line tool. It emerged during the talk that using PHP from the command line is not just useful for batch processing or scripting, but also for a development tool, testing your models and your code behaviour straight from the command line - this is not to be underestimated. What I enjoyed most about the talk was Thijs' approach: he involved the audience in the talk, testing attendees' knowledge with some simple command line snippets and asking people for the expected results. This was one of my favourite talks; if you have the chance to see it in the future, don't miss it.</p>
<p>Day 2, Sunday, was perhaps not as good as Day 1 content-wise. In the end, I only went to two talks out of three, preferring to spend some time socialising with some of the speakers in the hotel lounge about different geeky topics.</p>
<p>The first talk I went to was <strong>"Feeling secure? - notes from the field"</strong> by Paul Lemon. As I'd already attended the security tutorial the day before, this was perhaps not so relevant for me. There also wasn't enough time to cover all the topics properly, so the speaker was forced to gloss over the slides rather than talk in detail.</p>
<p>To conclude the conference, I attended <strong>"Teaching (mostly) PHP"</strong> by Clinton Ingrams. Clinton brought his "in the field" experience about how to mentor and teach students programming, especially PHP programming in this case, presenting his teaching framework. During the presentation we debated the effectiveness of the framework and the taught concepts, as they don't necessarily reflect enterprise reality. The general idea and how he categorised the topics within his teaching module seemed reasonable, as generally keeping concepts simple and easy is important. However, I have to agree with the crowd, some of the examples seemed too simple particularly for final year university students who have already had some programming exposure.</p>
<h2>Conclusion</h2>
<p>The venue was great, ignoring the WiFi connectivity problems and the queue for the food. This was a very social event from day one, warm and funny with a horde of geeks trying to mix with "normal people" (yes, that can happen if you attend the PHPNW conference, so try not to miss it next year). The best thing about PHP conferences is knowledge-sharing; you won't leave without a hundred different thoughts and ideas of how to do things better. Once again - definitely a good time, both personally and professionally. If you weren't there, you missed out!</p>
<p><em>If you didn't make it to the conference, the PHPNW11 organisers will be releasing all the main talks from the conference as videos over the next months. Follow <a href="http://twitter.com/#!/phpnw11">@phpnw11</a> on Twitter to be the first to hear when the videos are up.</em></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F&amp;title=PHPNW11+Conference+Report+-+Part+II" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F&amp;title=PHPNW11+Conference+Report+-+Part+II" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F&amp;title=PHPNW11+Conference+Report+-+Part+II" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F&amp;headline=PHPNW11+Conference+Report+-+Part+II" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=PHPNW11+Conference+Report+-+Part+II&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=PHPNW11+Conference+Report+-+Part+II&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=PHPNW11+Conference+Report+-+Part+II&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=PHPNW11+Conference+Report+-+Part+II&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=PHPNW11+Conference+Report+-+Part+II&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F&amp;title=PHPNW11+Conference+Report+-+Part+II&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F27%2Fphpnw11-report-part-ii%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/10/27/phpnw11-report-part-ii/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHPNW11 Conference Report</title>
		<link>http://techportal.ibuildings.com/2011/10/20/phpnw11-conference-report/</link>
		<comments>http://techportal.ibuildings.com/2011/10/20/phpnw11-conference-report/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 08:29:21 +0000</pubDate>
		<dc:creator>Marco Lopes</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[phpnw11]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3433</guid>
		<description><![CDATA[Earlier this month, 27 members of the Ibuildings team attended the PHPNW11 conference in Manchester. We will publish two personal reviews of the event by two of our software engineers - here's the first one. Security Tutorial Beware of the dark side, Luke! For the morning of the tutorial day at PHPNW11, I decided to [...]]]></description>
			<content:encoded><![CDATA[<p><em>Earlier this month, 27 members of the Ibuildings team attended the <a href="http://conference.phpnw.org.uk/phpnw11/">PHPNW11 conference</a> in Manchester. We will publish two personal reviews of the event by two of our software engineers - here's the first one.</em></p>
<h2>Security Tutorial</h2>
<p><b>Beware of the dark side, Luke!</b></p>
<p>For the morning of the tutorial day at PHPNW11, I decided to attend <strong>"Beware of the dark side, Luke!"</strong>, a security tutorial by Arne Blankerts. While web developers tend to give more emphasis to the security issues directly related with their application (such as XSS, CSRF, SQL injection or Session security), Arne's tutorial was very interesting because it focused also on direct machine access, remote OS access, installed software exploiting, and hardware exploits.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6229549921/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6033/6229549921_c1aaedc8be.jpg" title="Security Tutorial by Arne Blankerts (c) Stuart Herbert" class="alignright" width="500" height="332" /></a></p>
<p><span id="more-3433"></span><br />
Security is not an absolute concept, it consists of layers. How secure your data is from someone who's trying to obtain it depends on the effort someone is willing to put in versus the time/money you're willing to spend preventing that access.</p>
<p><b>Local Access</b></p>
<p>This bring us to the first topic of the tutorial, data centre security. Even if you went all the way to prevent remote attacks, can your hosting provider guarantee that someone won't just be able to enter their data centre, and flee with your disk full of client data?</p>
<p>And consider this - if your data is valuable enough to someone, and you have a backup system powered by your hosting company, what if that system is shared by other clients? Can an attacker get a machine and backup service on the same hosting company as you, and use this machine to try to get data from the backup server? </p>
<p>The point here is that there's always something that someone can do to get to your data. How far you need to go to prevent that depends on whether the data is worth that amount of effort. So, the first step towards security is to decide where to host your application. If you deal with very sensitive data that is of great value, you'll probably want to go with a secure data centre, encrypted disks, non-shared backup servers and all data, sent and received, should be encrypted. It's up to you to decide if you need all of this, none of this, or something in between.</p>
<p><strong>Remote Access</strong></p>
<p>The tutorial then proceeded to remote access security. The first step is to disable password-based SSH login and only allow key-based login. This prevents brute force attacks to get your password. Of course, external root access should also be disabled - if you need root access, just give Sudo capabilities to a standard user, or use su.</p>
<p>Under no circumstances should you use FTP. The FTP protocol is very insecure; not only does it send all your data in plain text over the network, but it also sends your login credentials in plain text. It also uses random port numbers for communication, making it easier for an attacker to take over an existing connection and receive/send information to your server.</p>
<p><strong>Apache and PHP</strong></p>
<p>After this, we started taking a look at security from the Apache and PHP perspective. We discussed why PHP's safe_mode is broken and in fact makes you more vulnerable to security issues than protecting you. For this reason, safe_mode should never be on, and is scheduled to be dropped out of PHP soon. On the other hand open_basedir should always be used.</p>
<p>All software exposing, such as Apache version, PHP version, or even if your server is using Apache and PHP, should be hidden from someone accessing your server. Always set  expose_php to off on your php.ini file.</p>
<p>If possible, use php-fpm instead of mod_php. It will give you not only security advantages, but also performance improvements. With mod_php every request will cause Apache to load PHP and all of its modules, even if those requests don't require PHP to prepare the response, as for example static pages, or static images. With php-fpm, a number of PHP processes are always running, ready to reply to Apache requests that happen to need PHP.</p>
<p><strong>Hardware</strong></p>
<p>From here, we moved into hardware issues. Custom hardware issues. Again, this is something that requires your data to have enough value to someone, that they will go all the way to get a piece of hardware into your system. One good example is a modified USB dongle that can be casually dropped on a desk and that eventually someone will plug into their computer, or be social engineered to do it. From this point on, a hacker can have access to that computer.</p>
<p><strong>Web Application Security</strong> </p>
<p>Next we moved into the security issues that PHP web developers are more familiar with - the exploits an attacker can run directly into your application.</p>
<p><strong>XSS</strong></p>
<p>We started by taking a look at Cross Site Scripting attacks. XSS lets an attacker inject content into a page, allowing them to add JavaScript or HTML to the page. We looked into the three different XSS kinds of attacks, which are the DOM based, the non-persistent and the persistent.</p>
<p>Some rules of thumb to avoid being vulnerable to XSS attacks, include making sure to filter input for the right context, always escape output contextually, always prefer whitelisting to blacklisting, and never try to read user intentions and repair their input, which sometimes can make an attack even worse.</p>
<p><strong>Sessions</strong></p>
<p>After XSS, we dived into sessions, and possible attacks through sessions. First we looked into some problems with sessions, such as coming from an untrustworthy source, being outdated or belonging to a user other than the one we’re expecting. We also noted that PHP doesn’t validate session id, which means a session id can contain malicious characters or not point to an actual session.</p>
<p>We then looked into session fixation, where a session id may be provided via a link using PHPSESSID, via XSS by setting a cookie or via plugins like Flash which breaks JavaScript security. Ways to prevent session fixation include validating the session id manually (i.e. writing custom code for it), always changing session id with each status change, such as login, change of permissions, or restart of session. Never use the URL to pass a session id, always use cookies and if possible send the HttpOnly header to the browser.</p>
<p><strong>Session Data</strong></p>
<p>We then proceeded to discuss why session data should never be trusted. Unless specifically overridden, PHP stores all session data on the same path. This means that if your application is running in a shared hosting environment, an attacker sharing hosts with you can read and write to your session data, and this can even lead to code execution.</p>
<p><strong>Session Hijacking</strong></p>
<p>The most effective protection against session hijacking is probably fully switching to HTTPS. In case this is not possible, always use different session ids for HTTP and HTTPS.</p>
<p><strong>CSRF</strong></p>
<p>Typical protection against CSRF includes using tokens. But for the tokens to be safe, you must not use predictable seeds for your token. An md5 of time(), for example, is easy to fake. Assuming that there's a session when comparing the token with the one supposedly stored on the session, can allow for a CSRF attack, if you fail to check whether the session really contains a token.</p>
<p><strong>Session Puzzling</strong></p>
<p>This can happen if your application uses the same name for session variables in different contexts.</p>
<p><strong>Captcha</strong></p>
<p>Captchas are hard to read, and can be easily crowdsourced. They're also vulnerable to the same implementation failure mentioned regarding CSRF. If the code validates the provided value against a value that is supposed to be in the session without checking for its contents, an empty attempt to get into the page, without an active session, can pass the captcha validation.</p>
<p><strong>Database</strong></p>
<p>In addition to using prepared statements, always make sure field names, table names and sorting fields don’t come from user input, use associative arrays as whitelists for those situations. Always make sure the user can’t send values other than int when setting limits on the number of results.</p>
<p>Use PDO instead of the MySQL extension.</p>
<p><strong>Passwords</strong></p>
<p>Never store plain text passwords. Use salt when encrypting a password and reapply hashing multiple times. Do a quality check on user-supplied passwords. If possible, advise your users not to use common words or common words with characters replaced by numbers (for example replacing and O by 0 or an A by 4 and so on).</p>
<p><strong>Clickjacking</strong></p>
<p>And finally we took a look at clickjacking and ways to avoid it, such as setting X-FRAME-OPTIONS to deny for no iframe embedding, or setting it to SAMEORIGIN to allow only frames from the same host.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6231781557/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6049/6231781557_5410a4bb57.jpg" title="PHPNW11 Audience (c) Stuart Herbert" class="alignright" width="500" height="283" /></a></p>
<h2>Web Services Tutorial</h2>
<p>After lunch, I went to the Web Services tutorial, presented by Lorna Mitchell, one of the organisers of PHPNW11. </p>
<p>We started by defining what a web service is: a way for an application to communicate, allowing for integration with other applications, exposing data and/or functionality, letting you refactor your application without the need to change the way others communicate with it. This allows you to have a common API from where different front ends or even 3rd party applications can get data or functionality.</p>
<p>We then discussed JSON vs XML, and why it is preferable to provide both kinds of output if possible. After that, we defined ‘Heartbeat Method’, and what it is used for. It was established that without documentation, examples, and a help point, a Web Service isn’t helpful at all, as people won’t be able to use it. </p>
<p>We then got into HTTP status codes, HTTP verbs and how to use them correctly and in a RESTful way. Still on the subject of HTTP protocol, Lorna spoke of the correct use of HTTP headers and how web services should be stateless, and all information needed should be on the request. Then we looked into some types of web services such as RESTful, RPC (XML-RPC, JSON-RPC or Soap). We looked in more detail into REST resources and collections. On how hypermedia allows a service to be self-documented, and allows URLs to change because they are provided by the API itself.</p>
<p>After a session of questions and answers, the tutorial day was over and everyone headed over to the pre-conference social at Kro Piccadilly to meet other developers and tech people all around.</p>
<h2>Day 1</h2>
<p>The first conference day started with an outstanding keynote by Ian Barber, <strong>"How to Stand on the Shoulders of Giants"</strong>. Ian spoke about how great ideas often come from the wish to solve a personal problem and not from the intention of creating something revolutionary. He also spoke about how innovation often builds upon the work of others, and how any of us can one day build something great, if we just keep trying to build the tools that will help us get where we want.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6231772651/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6152/6231772651_00d5569817.jpg" title="Ian Barber&#039;s Keynote at PHPNW11 (c) Stuart Herbert" class="alignright" width="500" height="332" /></a></p>
<p>After the keynote, I decided to go to Sebastian Marek’s talk <strong>"Magic Behind the Numbers - Software Metrics in Practice"</strong>. Sebastian spoke about metrics to evaluate the complexity of a software project. He presented ways to look for the complexity and try to reduce it. He spoke of sonar, php_depend, php_cpd, phploc, PHPMD and a lot of other tools that can help one get to the bottom of where complexity lies within their application. I then attended Sebastian Bergmann's talk on <strong>"PHP Tester’s Toolbox"</strong>. Sebastian, the author of PHPUnit, covered various testing tools for PHP, reviewing their pros and cons and comparing them to PHPUnit.</p>
<p>After lunch, I went to see my colleague Alistair Stead's talk on <strong>"Varnish your PHP Application, Make it Fly!"</strong> in Track 2. Alistair went through Varnish’s configurations details, how the options one takes during the configuration relate to the type of website on which Varnish is being applied. He showed some actual stats on how Varnish can speed up a Magento ecommerce website, and gave some details on how to use both together.</p>
<p>After Alistair's talk, I headed to Track 1 to watch another Ibuildings colleague - Rowan Merewood’s talk on <strong>"Estimation or 'How To Dig Your Own Grave'"</strong>, which ended up being one of the best of PHPNW11. Rowan’s computer was having issues connecting to the projector, and to make things worse, the previous talk in Track 1 went on longer than expected, leaving Rowan even less time to set things up. After a while the audience started being amused by all these attempts to make the laptop work with the projector, but the solution ended up being the switch of Rowan's laptop for Ben Longden’s MacBook Pro. For some more amusement of the audience, Ben's laptop seemed to be unable to show the slides in fullscreen and the remote control to change the slides wasn't working either. At this point, Rowan recruited Ian Barber to manually change the slides through the talk, and it was time to start. His presentation was flawless, a great choice of images, every detail was taken care of, to the point that his clothes matched the slide theme. The talk focused on how to make project estimates, and how to avoid some common pitfalls that often ruin estimates. During the talk, some Twitter users were rating it as one of the best of the conference, which I will have to agree with.</p>
<p><a href="http://www.flickr.com/photos/stuartherbert/6231661107/in/photostream"><img alt="" src="http://farm7.static.flickr.com/6117/6231661107_c53885aa6f.jpg" title="Technical Problems in Rowan Merewood&#039;s Talk (c) Stuart Herbert" class="alignright" width="500" height="332" /></a></p>
<p>In the evening, there was an open tab at the hotel bar, where the more than 350 participants met for some drinks and some more PHP-related talks. Later, a few of us decided to take a walk around Manchester and get to know the city and some of its iconic locations such as the legendary Factory.</p>
<p><em>All photographs in this post copyright (c) <a href="http://www.flickr.com/photos/stuartherbert/">Stuart Herbert</a></em></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F&amp;title=PHPNW11+Conference+Report" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F&amp;title=PHPNW11+Conference+Report" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F&amp;title=PHPNW11+Conference+Report" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F&amp;headline=PHPNW11+Conference+Report" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=PHPNW11+Conference+Report&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=PHPNW11+Conference+Report&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=PHPNW11+Conference+Report&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=PHPNW11+Conference+Report&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=PHPNW11+Conference+Report&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F&amp;title=PHPNW11+Conference+Report&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F20%2Fphpnw11-conference-report%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/10/20/phpnw11-conference-report/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DPC Radio: Searching with Solr - Why, When, and How</title>
		<link>http://techportal.ibuildings.com/2011/10/05/dpc-radio-searching-with-solr-why-when-and-how/</link>
		<comments>http://techportal.ibuildings.com/2011/10/05/dpc-radio-searching-with-solr-why-when-and-how/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 09:05:32 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[Paul Matthews]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[Solr]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3405</guid>
		<description><![CDATA[Paul Matthews With Google constantly pushing the customer expectations of searching, is it time to move away from our database full-text search in pursuit of a more targeted platform? Can implementing Solr offer more than an answer to a search? Implementing a search platform isn’t always suitable for all applications, but in this talk we’ll [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Paul Matthews</strong></p>
<p>With Google constantly pushing the customer expectations of searching, is it time to move away from our database full-text search in pursuit of a more targeted platform? Can implementing Solr offer more than an answer to a search? Implementing a search platform isn’t always suitable for all applications, but in this talk we’ll look at identifying the right search solution, choosing the best way to integrate it into our application and exploring all the benefits a search server can offer.</p>
<p><b>Edit: </b>Paul's slides can be found at <a href="http://www.slideshare.net/paulmatthews86/search-with-solr">http://www.slideshare.net/paulmatthews86/search-with-solr</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F&amp;title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F&amp;title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F&amp;title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F&amp;headline=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F&amp;title=DPC+Radio%3A+Searching+with+Solr+-+Why%2C+When%2C+and+How&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F10%2F05%2Fdpc-radio-searching-with-solr-why-when-and-how%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/10/05/dpc-radio-searching-with-solr-why-when-and-how/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_016.mp3" length="44365913" type="audio/mpeg" />
		</item>
		<item>
		<title>DPC Radio: Let's take over the world with Zend Framework</title>
		<link>http://techportal.ibuildings.com/2011/09/21/dpc-radio-lets-take-over-the-world-with-zend-framework/</link>
		<comments>http://techportal.ibuildings.com/2011/09/21/dpc-radio-lets-take-over-the-world-with-zend-framework/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 08:02:23 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[Martin de Keijzer]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3396</guid>
		<description><![CDATA[Today's episode comes from one of our own Ibuildings employees, covering Zend Framework. Martin de Keijzer Many people use Zend Framework for it's MVC implementation, but it has a lot of hidden gems. Internationalization (i18n) is one of them. We will look how you can create an application that will have the right languages, currencies, [...]]]></description>
			<content:encoded><![CDATA[<p>Today's episode comes from one of our own Ibuildings employees, covering Zend Framework.</p>
<p><strong>Martin de Keijzer</strong></p>
<p>Many people use Zend Framework for it's MVC implementation, but it has a lot of hidden gems. Internationalization (i18n) is one of them. We will look how you can create an application that will have the right languages, currencies, dates and times all based on the location of the visiting user. This session will take away a lot of headaches in international projects and will improve the quality in overall.</p>
<p><b>Edit: </b> You can find Martin's slides <a href="http://www.slideshare.net/Martin82/lets-take-over-the-world-with-zend-framework-8063834">on slideshare</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F&amp;title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F&amp;title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F&amp;title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F&amp;headline=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F&amp;title=DPC+Radio%3A+Let%27s+take+over+the+world+with+Zend+Framework&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F21%2Fdpc-radio-lets-take-over-the-world-with-zend-framework%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/09/21/dpc-radio-lets-take-over-the-world-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_012.mp3" length="82240989" type="audio/mpeg" />
		</item>
		<item>
		<title>DPC Radio: Keynote - First Class APIs</title>
		<link>http://techportal.ibuildings.com/2011/09/13/dpc-radio-keynote-first-class-apis/</link>
		<comments>http://techportal.ibuildings.com/2011/09/13/dpc-radio-keynote-first-class-apis/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 06:43:05 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[apis]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[Helgi Þormar Þorbjörnsson]]></category>
		<category><![CDATA[keynote]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3387</guid>
		<description><![CDATA[This year's DPCRadio returns with one of the keynotes from this year's event as our first episode. Helgi Þormar Þorbjörnsson APIs are commonly an afterthought, like a hot tub awkwardly attached to a house — a shoehorned approach that produces a suboptimal app with scarce support that lacks documentation. In effect, APIs are the ugly stepchild of [...]]]></description>
			<content:encoded><![CDATA[<p>This year's DPCRadio returns with one of the keynotes from this year's event as our first episode.</p>
<p><strong>Helgi Þormar Þorbjörnsson</strong></p>
<p>APIs are commonly an afterthought, like a hot tub awkwardly attached to a house — a shoehorned approach that produces a suboptimal app with scarce support that lacks documentation. In effect, APIs are the ugly stepchild of the Web.</p>
<p>This is a sad reality that we are faced with, because many companies make their living consuming third-party APIs and mixing in their own data to create amazing and interesting mashups. In the initial phases of development, there is rarely enough money to develop the app and its API. By the time there’s both demand and money, it can be hard to fit an API on top of the architecture in such a way that the whole thing won’t fall over. APIs should be first class citizens of the Web. Inconceivable? Possimpible? Not at all!</p>
<p>In this talk we will dive deeper into why APIs are an afterthought, how we can change that. We will also touch on how that can benefit your product down the line in terms of resource savings and infrastructure efficiency, as well as the impact it will have on your infrastructure.</p>
<p>This talk is inspired by my <a href="http://phpadvent.org/201002">phpadvent</a> article. </p>
<p>(You can find Helgi's slides <a href="http://www.slideshare.net/helgith/firstclass-apis-dpc-2011-amsterdam">over on Slideshare</a>)</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F&amp;title=DPC+Radio%3A+Keynote+-+First+Class+APIs" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F&amp;title=DPC+Radio%3A+Keynote+-+First+Class+APIs" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F&amp;title=DPC+Radio%3A+Keynote+-+First+Class+APIs" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F&amp;headline=DPC+Radio%3A+Keynote+-+First+Class+APIs" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F&amp;title=DPC+Radio%3A+Keynote+-+First+Class+APIs&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F09%2F13%2Fdpc-radio-keynote-first-class-apis%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/09/13/dpc-radio-keynote-first-class-apis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2011_007.mp3" length="102960022" type="audio/mpeg" />
		</item>
		<item>
		<title>Beyond TDD with PHPSpec</title>
		<link>http://techportal.ibuildings.com/2011/08/03/outside-in-behaviour-driven-development-in-php-part-2/</link>
		<comments>http://techportal.ibuildings.com/2011/08/03/outside-in-behaviour-driven-development-in-php-part-2/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 09:26:59 +0000</pubDate>
		<dc:creator>Marcello Duarte</dc:creator>
				<category><![CDATA[Planet PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[behat]]></category>
		<category><![CDATA[behaviour driven development]]></category>
		<category><![CDATA[marcello]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[phpspec]]></category>
		<category><![CDATA[quality assurance]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3308</guid>
		<description><![CDATA[This is the second part of a series about Outside-in Behaviour Driven Development in PHP. The first part introduces outside-in development, and how to execute scenarios with Behat. Read this to catch up with the tools and the example we've used so far, then come back to find out how PHPSpec fits into this picture. [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second part of a series about Outside-in Behaviour Driven Development in PHP. The <a href="http://techportal.ibuildings.com/2011/07/21/outside-in-behaviour-driven-development-in-php" title="Part 1">first part</a> introduces outside-in development, and how to execute scenarios with Behat.  Read this to catch up with the tools and the example we've used so far, then come back to find out how PHPSpec fits into this picture.<br />
<span id="more-3308"></span></p>
<p><a href="http://www.phpspec.net" title="PHPSpec">PHPSpec</a> is the first ever PHP BDD framework. It is a port of <a href="http://rspec.info/">RSpec</a> to PHP created back in 2007 by Pádraic Brady and Travis Swicegood. Development in this framework stopped for a while and was reignited last August (2010). PHPSpec can be installed via pear, using these commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear config-set preferred_state beta
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear channel-discover pear.phpspec.net
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--all-deps</span> phpspec<span style="color: #000000; font-weight: bold;">/</span>PHPSpec</pre></div></div>

<p>
If you are accustomed to unit testing, here is a quick translation sheet for xUnit/xSpec terms:</p>
<ul>
<li>In xUnit we <strong>test</strong>; in xSpec we <strong>describe</strong>, so your class names begin with "Describe"</li>
<li>In PHPSpec, the spec file for a class MyClass is named <strong>MyClassSpec.php</strong></li>
<li>In xUnit we group tests in a <strong>TestCase</strong>. In xSpec we have examples that are grouped into <strong>Contexts</strong></li>
<li>In xUnit each method is a test with the prefix <strong>test</strong>. In xSpec each method is an <strong>example</strong>, we use the prefix <strong>it</strong></li>
<li>In xUnit we <strong>assert</strong> that something work as expected. In xSpec we specify how it <strong>should</strong> work</li>
</ul>
<p></p>
<p>We've used Gherkin and Behat to specify how our application is supposed to work. We use PHPSpec to specify the behaviour of our classes. To get you started, let's see a simple example showing this. We are building a class that greets the user with "Hello, World!". The <code>GreeterSpec.php</code> file would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> DescribeGreeter <span style="color: #000000; font-weight: bold;">extends</span> \PHPSpec\Context
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> before<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeter</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">spec</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Greeter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> itGreetsUsingAHelloWorldMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greeter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$message</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">should</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">be</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Hello, World!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>If you already have experience with Unit Testing, the above would look familiar to you. Note that instead of saying: <code>$this->assertEquals('Hello, World!', $message)</code> we say <code>$message->should->be('Hello, World!')</code>. We are describing how we want the behaviour to be, rather than testing it. The <code>before()</code> method is a setup method that would get run before any example is run; the <code>spec()</code> method is a decorator that wraps the object being tested so we call the expectations on the properties and methods results.</p>
<p>To run the spec we use the phpspec command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpspec GreeterSpec.php</pre></div></div>

<p>First we run it and watch it fail. Then we write a Greeter class to satisfy the example.</p>
<h3>PHPSpec and MVC</h3>
<p>Going back to our Video Renting application. The newly released version (1.2beta) includes integration with Zend Framework which enables us to test the MVC (Model, View, Controller) components individually. When we test an MVC application, we should start with the view, because that's what our scenario describes: </p>
<blockquote><p>The text "Revolution OS" was not found anywhere in the text of the current page</p></blockquote>
<p>Let's keep all our specs in a folder called "spec". To write a view spec we first add a folder called <em>views</em> under the spec folder.  In our example, this is a view that corresponds to the <em>index </em>action of the <em>review</em> controller. We need to create an <code>IndexSpec.php</code> for our <code>index.phtml</code> view, containing the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">namespace</span> Review<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// SpecHelper contains the usual ZF bootstrap</span>
<span style="color: #666666; font-style: italic;">// copied from public/index.php</span>
<span style="color: #b1b100;">require_once</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../../SpecHelper.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> \PHPSpec\Context\Zend\View <span style="color: #b1b100;">as</span> ViewContext<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> DescribeIndex <span style="color: #000000; font-weight: bold;">extends</span> ViewContext
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> itRendersTheSelectedVideo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$video</span> <span style="color: #339933;">=</span> \Mockery<span style="color: #339933;">::</span><span style="color: #004000;">mock</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'Application_Model_Video'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'getName'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Revolution OS'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assign</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'video'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$video</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rendered</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">should</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">contain</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Revolution OS'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>Notice that we namespaced our class with the name of the controller. In a modular Zend Framework application you would namespace with the module name and then controller name, e.g. <code>Module\Controller</code>.</p>
<p>If we run the spec we should see an error because we haven't met its description yet.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpspec spec
E
&nbsp;
Exceptions:
&nbsp;
  <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> Review\Index renders the selected video
     Failure\Exception: <span style="color: #007800;">$this</span>-<span style="color: #000000; font-weight: bold;">&gt;</span>runExamples<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$exampleGroup</span>, <span style="color: #007800;">$reporter</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
     Zend_View_Exception: script <span style="color: #ff0000;">'review/index.phtml'</span> not found <span style="color: #000000; font-weight: bold;">in</span> path <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>renting<span style="color: #000000; font-weight: bold;">/</span>application<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.004656</span> seconds
<span style="color: #000000;">1</span> example, <span style="color: #000000;">1</span> exception</pre></div></div>

<p></p>
<p>At this stage we need to create the view to deal with the error we saw. In this example, we will use Zend Tool, which creates the controller/action/view all in one go:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ zf create controller Review
Creating a controller at <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>renting<span style="color: #000000; font-weight: bold;">/</span>application<span style="color: #000000; font-weight: bold;">/</span>controllers<span style="color: #000000; font-weight: bold;">/</span>ReviewController.php
Creating an index action method <span style="color: #000000; font-weight: bold;">in</span> controller Review
Creating a view script <span style="color: #000000; font-weight: bold;">for</span> the index action method at 
<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>renting<span style="color: #000000; font-weight: bold;">/</span>application<span style="color: #000000; font-weight: bold;">/</span>views<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>review<span style="color: #000000; font-weight: bold;">/</span>index.phtml
Updating project profile <span style="color: #ff0000;">'/private/var/www/renting/.zfproject.xml'</span></pre></div></div>

<p>
Now instead of an error, our output shows that we have a failure:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpspec spec
F
&nbsp;
Failures:
&nbsp;
  <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> Review\Index renders the selected video
     Failure\Error: <span style="color: #007800;">$this</span>-<span style="color: #000000; font-weight: bold;">&gt;</span>rendered-<span style="color: #000000; font-weight: bold;">&gt;</span>should-<span style="color: #000000; font-weight: bold;">&gt;</span>contain<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Revolution OS'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
     expected to contain <span style="color: #ff0000;">'Revolution OS'</span>, found no match <span style="color: #7a0874; font-weight: bold;">&#40;</span>using contain<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
     <span style="color: #666666; font-style: italic;"># ./spec/views/review/IndexSpec.php:17</span>
&nbsp;
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.005078</span> seconds
<span style="color: #000000;">1</span> example, <span style="color: #000000;">1</span> failure</pre></div></div>

<p></p>
<p>This output means that the view now exists, but it's not showing the described text. That's what we expect, since we haven't coded the view yet. Let's add some code to do so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">video</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>It should now pass.<br />
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpspec spec
.
&nbsp;
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.001043</span> seconds
<span style="color: #000000;">1</span> example</pre></div></div>

<p>
That's progress! However Behat is still not happy, because our controller is not setting the model for the view yet. Let us turn our focus to the controller, and start by creating a <code>controllers </code>directory and adding a <code>ReviewControllerSpec.php</code>. </p>
<p><code>DescribeReviewController</code> must extend <code>\PHPSpec\Context\Zend\Controller</code>. We also need to specify that our controller will send be accessed by POST and will create the model in it. The controller/action will be routed from "/review" and we can add an example to make sure the route work as expected.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #b1b100;">require_once</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../SpecHelper.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> DescribeReviewController <span style="color: #000000; font-weight: bold;">extends</span> \PHPSpec\Context\Zend\Controller
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> itShouldRouteTheReviewsPageToTheIndexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">routeFor</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'review'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
             <span style="color: #339933;">-&gt;</span><span style="color: #004000;">should</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">be</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/review'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> itShouldDispatchToTheReviewController<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$container</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Yadif_Container<span style="color: #009900;">&#40;</span>
            <span style="color: #000000; font-weight: bold;">new</span> \Zend_Config_Xml<span style="color: #009900;">&#40;</span>APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/configs/objects.xml&quot;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$mapper</span> <span style="color: #339933;">=</span> \Mockery<span style="color: #339933;">::</span><span style="color: #004000;">mock</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Application_Model_VideoMapper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">shouldReceive</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'find'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">andReturn</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$container</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videoModel</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">with</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">once</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$container</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">videoMapper</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getZendTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setContainer</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$container</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/review'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>We'll also want to add the code for the controller itself. Assuming you are using <a href="https://github.com/beberlei/yadif" title="Yadif">Yadif</a> or another IoC (Inversion of Control) container, it would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ReviewController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">video</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMapper</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_request<span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getMapper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$container</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInvokeArg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bootstrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContainer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$container</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getComponent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'videoMapper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We'll see that this now passes, when we run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpspec spec
...
&nbsp;
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.005271</span> seconds
<span style="color: #000000;">3</span> examples</pre></div></div>

<p>This looks much healthier, but if we run Behat, it will still be unhappy. We need to pass real data to the view, and then Behat will point out that the next step now is to describe the model. We need to have the data of our selected movies so we can fetch our view properly. Testing the models should be focused on behaviour, rather than the mechanics of database access. We know Zend_Db works, we need to know if we have made mistakes in our model. We will therefore test for the validation, filtering and business rules that we keep in the model.</p>

<div class="wp_syntax"><div class="code"><pre class="pre" style="font-family:monospace;">class DescribeVideo extends \PHPSpec\Context
{
    function before()
    {
        $this-&gt;video = $this-&gt;spec(new Application_Model_Video);
    }
&nbsp;
    function itIsNotValidWithoutTheName()
    {
        $this-&gt;video-&gt;setName('');
        $this-&gt;video-&gt;shouldNot-&gt;beValid();
    }
}</pre></div></div>

<p></p>
<p>We need to implement a <code>isValid()</code> method in the <code>Video </code>model. PHPSpec does not have a <code>beValid</code> matcher, but it will use predicate matchers and find a method <code>isValid()</code> by magic. Once the <code>isValid()</code> is implemented properly than the spec passes. You can do something similar if the form validation is stored in your (zend) forms. Also note the <code>before()</code> method that will be called before any example is run.</p>
<p>You can describe your mapper's behaviour by inspecting that it calls the Data Access Object (DAO) to fetch to or persist data from the models. At that point you can then add the DAO (e.g. DbTable, Rss, etc).</p>
<h3>Should we Hit the Database?</h3>
<p>In many cases you simply need to verify the business logic and not the database operation. Hitting the database consumes both time and resources, which will slow down the execution. There will be times where we need to expose some database behaviour or just feel more confident that our models work. In those cases we can use a <a href="http://www.c2.com/cgi/wiki?TestDataBuilder" title="Test Data Builder">Test Data Builder</a> pattern (this is a topic on its own, and I will save it for another post).</p>
<p>If you run Behat again after the model specs pass, the view should be displaying the correct data, so your scenario should pass, and a new scenario will be failing. We use Behat to tell us what to do next, and so the outside-in cycle is begins again.</p>
<h3>Final Thoughts</h3>
<p>In BDD, developers are driven by the specification, rather than tests of things they haven’t written yet. That said, the goals of both TDD and BDD are basically the same: making sure the user gets what they want. BDD makes that focus more explicit, and uses a language that invites the user to write their tests as a specification.</p>
<p>Behat and PHPSpec sit at different levels in the Outside-in cycle. Behat provides the outermost layer, allowing the stakeholders and developers to collaborate. PHPSpec provides the inner layer, allowing the specification of how the classes will collaborate with each other.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F&amp;title=Beyond+TDD+with+PHPSpec" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F&amp;title=Beyond+TDD+with+PHPSpec" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F&amp;title=Beyond+TDD+with+PHPSpec" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F&amp;headline=Beyond+TDD+with+PHPSpec" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Beyond+TDD+with+PHPSpec&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Beyond+TDD+with+PHPSpec&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Beyond+TDD+with+PHPSpec&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Beyond+TDD+with+PHPSpec&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Beyond+TDD+with+PHPSpec&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F&amp;title=Beyond+TDD+with+PHPSpec&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F08%2F03%2Foutside-in-behaviour-driven-development-in-php-part-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/08/03/outside-in-behaviour-driven-development-in-php-part-2/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Behaviour Driven Development in PHP With Behat</title>
		<link>http://techportal.ibuildings.com/2011/07/27/behaviour-driven-development-in-php-with-behat/</link>
		<comments>http://techportal.ibuildings.com/2011/07/27/behaviour-driven-development-in-php-with-behat/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 08:00:27 +0000</pubDate>
		<dc:creator>Marcello Duarte</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[behat]]></category>
		<category><![CDATA[phpspec]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3236</guid>
		<description><![CDATA[Outside-in Development is an agile development methodology that places the intention and goals of the stakeholders at the centre of the process. This is achieved by having human-readable user stories and scenarios being invoked as scripts that feed back on the progress, continuously leading the development towards the stakeholders’ goal. Developers will start from this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Outside-in_software_development">Outside-in Development</a> is an agile development methodology that places the intention and goals of the stakeholders at the centre of the process. This is achieved by having human-readable user stories and scenarios being invoked as scripts that feed back on the progress, continuously leading the development towards the stakeholders’ goal. Developers will start from this executable specification, and write the high level controllers that will provide the functionality.  They then go into what they need to provide that functionality by specifying how their library class should work. By the time all classes’ specifications are met, all scenarios will also be fulfilled and the cycle is complete.<br />
<span id="more-3236"></span></p>
<h3>The Evolution from TDD to BDD</h3>
<p>The idea of using the specification to drive the development is an evolution from <a href="http://en.wikipedia.org/wiki/Test-driven_development" title="Test-Driven Development">Test-Driven Development</a>, or TDD. TDD is the practice of writing a test before writing the code to be tested. This is an iterative process; you'd start with red (failing test), write just only enough code to make the result turn green (passing test), then remove or re-organise the code, without causing the test to fail, and start again. As the codebase grows, refactoring becomes the core of the process. TDD plays an important role in allowing the refactoring to happen, allowing good quality code to be passed on to QA.</p>
<p>BDD (<a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" title="Behaviour-Driven Development">Behaviour-Driven Development</a>) emerged from <a href="http://dannorth.net/" title="Dan North">Dan North</a>'s attempt to teach TDD. His pupils would often ask the same questions, and if you've been to talks about testing then you have probably heard these questions yourself: </p>
<blockquote><p><i>What should I test? How should I name this test? What is a unit? Where do I start?</i></p></blockquote>
<p>Dan concluded that a big part of the problem was the word <em>test</em>.</p>
<p>Because of the emphasis on test, developers tend to focus on class structure as opposed to how the system should behave. Ironically the focus on test moves developers away from TDD as it was intended. Quite often, because of the tendency to try to test everything, our tests end up tightly coupled with our implementation. If we change our code, we break our tests, even if the behaviour remains unchanged.</p>
<h3>A Few Words on Words</h3>
<p>If you run <a href="http://github.com/sebastianbergmann/phpunit/" title="PHPUnit">PHPUnit</a> with the <code>-- testdox</code> switch, you'll see that the tests' names are printed in a human-readable form. This feature is inspired by a tool called <a href="http://agiledox.sourceforge.net/" title="agiledox">agiledox</a> developed by Chris Stevenson. In using this tool, Dan realised that he could name his tests in an expressive way, letting others know what he was testing. He started using the word <em>should</em> in the test name, and stopped calling it a <em>test</em>, replacing it by <em>behaviour</em>. Here is an example PHPUnit test case that uses <em>should</em> in the test name:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> PHPSpec_Matcher_BeAnInstanceOf
    <span style="color: #000000; font-weight: bold;">extends</span> PHPUnit_Framework_TestCase
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testShouldPassIfTheObjectNameIsInTheDescription <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matcher</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDescription</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertSame</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;be an instance of 'Foo'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testShouldPassIfAMeaningfulFailureMessageIsReturned<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertSame</span><span style="color: #009900;">&#40;</span>
                    <span style="color: #0000ff;">&quot;expected 'Foo', got 'Bar' (using beAnInstanceOf())&quot;</span><span style="color: #339933;">,</span>
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matcher</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFailureMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testShouldPassIfAMeaningfulNegativeFailureMessageIsReturned <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertSame</span><span style="color: #009900;">&#40;</span>
                    <span style="color: #0000ff;">&quot;expected 'Bar' not to be 'Foo' (using beAnInstanceOf())&quot;</span><span style="color: #339933;">,</span>
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matcher</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNegativeFailureMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></code><br />
</p>
<p>This class lives in BeAnInstanceOfTest.php, and if we run PHPUnit with the <code>--testdox</code> switch:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpunit <span style="color: #660033;">--testdox</span> BeAnInstanceOfTest.php</pre></div></div>

<p>
We get a nice report:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">PHPSpec_Matcher_BeAnInstanceOf
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Should pass <span style="color: #000000; font-weight: bold;">if</span> the object name is <span style="color: #000000; font-weight: bold;">in</span> the description
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Should pass <span style="color: #000000; font-weight: bold;">if</span> a meaningful failure message <span style="color: #000000; font-weight: bold;">if</span> returned
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Should pass <span style="color: #000000; font-weight: bold;">if</span> a meaningful failure message <span style="color: #000000; font-weight: bold;">if</span> returned</pre></div></div>

<p></p>
<p>After this realisation, Dan North started writing a replacement for <a href="http://www.junit.org" title="Junit">JUnit</a>, called <a href="http://jbehave.org/">JBehave</a>. JBehave introduced another important shift in vocabulary, reducing the traditional <a href="http://xunitpatterns.com/Four%20Phase%20Test.html" title="Four-Phase Test">Four-Phase</a> test process (setup, exercise, verify and teardown) pattern into three: <em>Given</em>/<em>When</em>/<em>Then</em>. </p>
<p>Software development is all about communication, and this pattern is more sensible for business analysts, testers and developers alike. Specifying behaviour in a common language means stakeholders can take part in the process by identifying and expressing the scenarios.</p>
<h3>The Gherkin Language</h3>
<p>Gherkin is the language and parser that was created to specify features, as a part of a BDD tool called <a href="http://cukes.info/" title="Cucumber">Cucumber</a>. The language defines the structure of a feature, setting a number of keywords that can be used to describe the feature. The structure contains:</p>
<ul>
<li><a href="#title">A title</a></li>
<li><a href="#story">A story</a></li>
<li><a href="#scenario">Scenarios</a></li>
<li><a href="#steps">Steps</a></li>
</ul>
<p><a name="title"></a><br />
<h4>A Title</h4>
<p>We start by specifying a title. The title of the feature should describe the activity done by a stakeholder in the system. If we were building a software to manage a video club, we might have a feature to record the renting by the members.</p>

<div class="wp_syntax"><div class="code"><pre class="gherkin" style="font-family:monospace;">Feature: Member rents video</pre></div></div>

<p></p>
<p>Note that we chose the title "Member rents video". This indicate that without this feature a member cannot rent any video from the collection. It should not be a topic, or a theme, but an activity performed in the system. A vague, less descriptive name would be "Renting Management" or "Video renting feature". The title should make it explicit what functionality will be implemented.<br />
<a name="story"></a><br />
<h4>A Story</h4>
<p>The next thing is the user story (you can read <a href="http://techportal.ibuildings.com/2011/07/19/how-to-create-user-stories/">an earlier techPortal article about user stories</a> for more information). A story has 3 components to it: an actor, a behaviour and a reason, which outlines the value it brings to the stakeholders.</p>

<div class="wp_syntax"><div class="code"><pre class="gherkin" style="font-family:monospace;">Feature: Member rents video
  As a video-club member
  I want to rent a video
  So that I can take it away with me and watch it conveniently at home</pre></div></div>

<p></p>
<p>Requiring a "so that" clause not only forces the team to think about the reasons for needing this feature, but it also makes it clear that the feature is enough to deliver what we expect from this story.<br />
<a name="scenario"></a><br />
<h4>Scenarios</h4>
<p>Each scenario has a title and a series of steps. The title should distinguish the scenario from all others. By reading the title you should be able to quickly guess how this scenario is different from all others. The steps are a series of pre-conditions, events and results, defined using one or more <em>Given</em>/<em>When</em>/<em>Then</em> clauses.</p>

<div class="wp_syntax"><div class="code"><pre class="gherkin" style="font-family:monospace;">&nbsp;
# Content of file renting.feature
&nbsp;
Feature: Members rents video
  As a video-club member
  I want to rent a video
  So that I can take it away with me and watch it conveniently at home
&nbsp;
  Scenario: Renting single video from oldies section
    Given I am in the &quot;review&quot; page
      And the selected video is &quot;Revolution OS&quot;
     When I click on &quot;Rent&quot;
     Then &quot;£2&quot; is added to my total
&nbsp;
  Scenario: Renting 3 videos from oldies promotion
    Given I am in the &quot;review&quot; page
      And &quot;Revolution OS&quot; is selected
      And &quot;Blade Runner&quot; is selected
      And &quot;The Wall&quot; is selected
     When I click on &quot;Rent&quot;
     Then &quot;£5&quot; is added to my total</pre></div></div>

<p><a name="steps"></a><br />
<h4>Steps</h4>
<p>Steps are the building blocks of scenarios where each of the blocks is a requirement. Given/When/Then steps are intentionally flexible and adaptable. They are there to support the communication between the business and development teams. As the conversation evolves and the understanding of the feature changes we can easily update them. Use <em>Given</em> to state pre-conditions or context; <em>When</em> to describe the interaction with the system and <em>Then</em> is there to describe the expected outcome. You can also use <em>And</em> to combine more conditions, interactions or outcomes, e.g. Given <em>some condition</em> And <em>some other condition</em> When <em>I do something</em> And <em>I do something else</em> Then <em>I obtain this outcome</em> And <em>This also happens</em></p>
<h3>Introducing Behat, Putting Gherkin to use in PHP</h3>
<p>Once you have written your scenarios using Gherkin, you can automate these using a tool such as <a href="http://behat.org/" title="Behat">Behat</a>. Behat is a tool inspired by Cucumber, and written in PHP by Konstantin Kudryashov. At the time of writing, Behat 2.0.3 has been released and the syntax for this version is used in the examples for this article.</p>
<p>First you need to get Behat installed on your system.  It is available from PEAR and you can install it by doing the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear channel-discover pear.behat.org
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear channel-discover pear.symfony.com
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> behat<span style="color: #000000; font-weight: bold;">/</span>gherkin-beta
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> pear <span style="color: #c20cb9; font-weight: bold;">install</span> behat<span style="color: #000000; font-weight: bold;">/</span>behat-beta</pre></div></div>

<p></p>
<p>If you have behat 2.0.3 or greater, then you are ready to go.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ behat <span style="color: #660033;">--version</span>
Behat version 2.0.3</pre></div></div>

<p></p>
<p>Then navigate to your project root and initialise Behat. This will create the necessary directory structure.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>my<span style="color: #000000; font-weight: bold;">/</span>project
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">ls</span>
application	docs		library		public
&nbsp;
$ behat <span style="color: #660033;">--init</span>
+d features - place your <span style="color: #000000; font-weight: bold;">*</span>.feature files here
+d features<span style="color: #000000; font-weight: bold;">/</span>bootstrap - place bootstrap scripts and static files here
+f features<span style="color: #000000; font-weight: bold;">/</span>bootstrap<span style="color: #000000; font-weight: bold;">/</span>FeatureContext.php - place your feature related code here
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">ls</span>
application	docs		features	library		public</pre></div></div>

<p></p>
<p>Time to start adding features. Under the <code>features </code>directory create a new file and name it <code>renting.feature</code> and add the content of "Feature: Member rents video" to the file and save it. At this point, we can let Behat tell you what to do next:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ behat</pre></div></div>

<p></p>
<p>Running this command will result in Behat outputting the code you have to write in PHP for defining your steps, with a message saying "You can implement step definitions for undefined steps with these snippets:". Note that the names of the methods are based on the text in the Given/When/Then from the scenario steps created above:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * @Given /^I am in the &quot;([^&quot;]*)&quot; page$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> iAmInThePage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> PendingException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @Given /^the selected video is &quot;([^&quot;]*)&quot;$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> theSelectedVideoIs<span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> PendingException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @When /^I click in &quot;([^&quot;]*)&quot;$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> iClickIn<span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> PendingException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @Then /^&quot;([^&quot;]*)&quot; is added to my total$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isAddedToMyTotal<span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> PendingException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * @Given /^&quot;([^&quot;]*)&quot; is selected$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isSelected<span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> PendingException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Step Definition Styles</h3>
<p>Now that Behat has generously provided the skeleton of your steps, you can add the code into it. The code should contain examples of how the system should behave. The beauty of Behat is that you can easily model the interaction with the user by using methods like <code>visit($page)</code>, <code>pressButton($button)</code>, <code>clickLink($link)</code>. This is possible because of <a href="http://mink.behat.org/">Mink</a>, a layer on top of Behat that simulates the user interaction with the browser.</p>
<p>For newcomers to tools like Behat or Cucumber, their early questions tend to be: </p>
<blockquote><p>what do I put in the steps? Should I connect to the database via hooks to populate the DB? Should I simulate the user interaction including previous steps to add some data?</p></blockquote>
<p>David Chelimsky[<a href="#ref_one">1</a>] identified three different approaches, or step definition styles, of what to put in the step definitions: Automated Browser, Simulated Browser or DMA (Direct Model Access). The first two styles can be accomplished in Behat by using Mink with a driver; either <a href="http://sahi.co.in/w/sahi">Sahi</a> for the Automated Browser approach or <a href="https://github.com/fabpot/Goutte">Goutte</a> for Simulated Browser. DMA can be achieved by accessing the models directly from the step definition to add or retrieve some data to or from the database.</p>
<p>I am going to use Mink with the default driver, Goutte, however if your pages have Javascript you should use the Sahi driver.</p>
<p>First lets create a <code>RentingFeatureClass</code> which will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> \Behat\Behat\Exception\PendingException<span style="color: #339933;">,</span>
    \Behat\Mink\Behat\Context\MinkContext<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> RentingFeatureContext <span style="color: #000000; font-weight: bold;">extends</span> MinkContext
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// steps snippets here...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>There is just one more step to complete the setup. You need to add a <code>behat.yml</code> to add your context. By default, Behat sets <code>FeatureContext.php</code> as the default context and if you add your steps to that file instead, Behat would be running those. However since you want to add more and more features in separate files, this isn't the best approach. You can add <a href="http://docs.behat.org/guides/4.context.html#using-subcontexts">subcontexts</a> to the main feature context, however for the sake of simplify let's just tell Behat to run our context alone. Also we need to tell Mink where the base URL for our application is. Therefore in the root of your project directory, create a <code>behat.yml</code> with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">default:
  context:
    parameters:
      start_url: http://renting.local/
    class:  RentingFeatureContext
&nbsp;
renting:
  context:
    class:  RentingFeatureContext</pre></div></div>

<p></p>
<p>If you run Behat again you should get</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2</span> scenarios <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> pending<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">10</span> steps <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8</span> skipped, <span style="color: #000000;">2</span> pending<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p></p>
<p>Instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2</span> scenarios <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> undefined<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">10</span> steps <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">10</span> undefined<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p></p>
<p>Behat is now pointing to the first step:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  Scenario: Renting single video from oldies section
    Given I am <span style="color: #000000; font-weight: bold;">in</span> the <span style="color: #ff0000;">&quot;review&quot;</span> page
       TODO: <span style="color: #c20cb9; font-weight: bold;">write</span> pending definition
    And the selected video is <span style="color: #ff0000;">&quot;Revolution OS&quot;</span></pre></div></div>

<p>
You are now up and running. Start by adding some code in the first <em>Given </em>step:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * @Given /^I am in the &quot;([^&quot;]*)&quot; page$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> iAmInThePage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">visit</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>
Behat should now be showing green for the first step and point you to the next step:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  Scenario: Renting <span style="color: #000000;">3</span> videos from oldies promotion
    Given I <span style="color: #000000; font-weight: bold;">in</span> the <span style="color: #ff0000;">&quot;review&quot;</span> page
    And the selected video is <span style="color: #ff0000;">&quot;Revolution OS&quot;</span>
      TODO: <span style="color: #c20cb9; font-weight: bold;">write</span> pending definition
    And <span style="color: #ff0000;">&quot;Blade Runner&quot;</span> is selected</pre></div></div>

<p>At this point we can add a bit more context. The user has already selected some videos. Mink will use a PHPUnit assertion for this. In fact, you can use virtually any assertion family; <a href="http://www.simpletest.org/">SimpleTest</a> would work just as well (<a href="http://trac.symfony-project.org/wiki/LimeTestingFramework">Lime</a> is not ideal however, because it doesn't throw exceptions).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * @Given /^the selected video is &quot;([^&quot;]*)&quot;$/
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> theSelectedVideoIs<span style="color: #009900;">&#40;</span><span style="color: #000088;">$videoName</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertPageContainsText</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$videoName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>
Great! Now we got our first failure.  This might not seem like great news, but as we originally stated, it is the first step in the process.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Scenario: Renting single video from oldies section
    Given I am <span style="color: #000000; font-weight: bold;">in</span> the <span style="color: #ff0000;">&quot;review&quot;</span> page
    And the selected video is <span style="color: #ff0000;">&quot;Revolution OS&quot;</span>
      The text <span style="color: #ff0000;">&quot;Revolution OS&quot;</span> was not found anywhere <span style="color: #000000; font-weight: bold;">in</span> the text of the current page
    When I click <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;Rent&quot;</span></pre></div></div>

<p>
Once you get a failure in Behat, it is time to go deeper and at this point the true outside-in begins. So far we have used Behat to specify how our application would interact with the user. Now it's time to go to our classes and specify how they will work with each other.</p>
<p>This article introduced the idea of BDD and also showed how we can set up scenarios to describe our application and execute these with Behat. Keep watching <a href="http://techportal.ibuildings.com">techPortal</a> for the follow-up article, which will cover how to specify class behaviour with PHPSpec.</p>
<h3>References</h3>
<ol>
<li>Chelimsky, David. <a href="http://pragprog.com/book/achbd/the-rspec-book">The RSpec Book: Behaviour-Driven Development with RSpec, Cucumber, and Friends</a>. The Pragmatic Programmers</li>
</ol>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F&amp;title=Behaviour+Driven+Development+in+PHP+With+Behat" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F&amp;title=Behaviour+Driven+Development+in+PHP+With+Behat" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F&amp;title=Behaviour+Driven+Development+in+PHP+With+Behat" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F&amp;headline=Behaviour+Driven+Development+in+PHP+With+Behat" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Behaviour+Driven+Development+in+PHP+With+Behat&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Behaviour+Driven+Development+in+PHP+With+Behat&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Behaviour+Driven+Development+in+PHP+With+Behat&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Behaviour+Driven+Development+in+PHP+With+Behat&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Behaviour+Driven+Development+in+PHP+With+Behat&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F&amp;title=Behaviour+Driven+Development+in+PHP+With+Behat&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F27%2Fbehaviour-driven-development-in-php-with-behat%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/07/27/behaviour-driven-development-in-php-with-behat/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How To Create User Stories</title>
		<link>http://techportal.ibuildings.com/2011/07/19/how-to-create-user-stories/</link>
		<comments>http://techportal.ibuildings.com/2011/07/19/how-to-create-user-stories/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 08:00:49 +0000</pubDate>
		<dc:creator>Robert Raszczynski</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[project planning]]></category>
		<category><![CDATA[user stories]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3282</guid>
		<description><![CDATA[Gathering requirements for software development is a vital communication process. There are multiple parties involved and a project relies on customers, users, domain experts, and many others, each with their own view of how the system should function. We will look at how user stories can help us to gather the information we need for [...]]]></description>
			<content:encoded><![CDATA[<p>Gathering requirements for software development is a vital communication process. There are multiple parties involved and a project relies on customers, users, domain experts, and many others, each with their own view of how the system should function. We will look at how <strong>user stories can help us</strong> to gather the information we need for a successful project.</p>
<p>For a project to succeed, there needs to be a process in place that gets information as early and often as possible, where decision making happens based on information available at any point in time. Agile methodologies favour face-to-face communication and <strong>use user stories to collect customer requirements</strong> and to respond faster to constantly changing requirements. Use of user stories eliminates a need of extensive upfront requirements gathering and writing comprehensive documentation, allowing to us spread the decision making across the duration of the project.</p>
<h3>What is a User Story?</h3>
<p>In short, <strong>a user story is a chunk of functionality that is valuable to a user </strong>or a customer of the software. In my opinion the most comprehensive definition of a user story was provided by Kent Beck and Martin Fowler in <em>Planning Extreme Programming</em>:</p>
<blockquote><p>"The story is the unit of functionality in an XP project. We demonstrate progress by delivering tested, integrated code that implements a story. A story should be understandable to customers and developers, testable, valuable to the customer, and small enough so that the programmers can build half a dozen in an iteration"</p></blockquote>
<p><span id="more-3282"></span></p>
<h4>Introduction to User Stories</h4>
<p>A user story is a short written description, told from the perspective of a user, used for planning the system and as a reminder to discuss with your customer the details of the functionality. User stories are traditionally hand-written on paper cards and only represent customer requirements instead of documenting them. A user story has three critical aspects: </p>
<ul>
<li><b>Card</b> - as mentioned before a user story is written on a card. The main section includes title/name of a story and description that reminds everyone what the story is. It may optionally include notes such as reference number, estimated duration and priority. The card is handed to developers when the story is scheduled to be implemented.</li>
<li><b>Conversation</b> - all the requirements needed to complete a story are communicated from customer to developers through conversation, usually taking place during iteration planning. Any vital piece of information that helps to concisely explain the functionality can be written on the card as a reminder, but never a full specification.</li>
<li><b>Confirmation</b> - this component is the acceptance criteria. It will be used to determine when a story is complete and whether it meets the goal of users. Acceptance tests are communicated by customer at the beginning of an iteration, they help to ensure the software is fit for its intended purpose.</li>
</ul>
<p></p>
<p>An example of the user story:</p>
<blockquote><p><i>As an account owner, I want to check my balance online</i></p></blockquote>
<h4>How detailed it should be</h4>
<p>The user stories document the high-level details of a feature; these should provide enough information to allow developers to make low-risk estimates of how long it will take to implement each feature. At a time of iteration planning, developers and customer will discuss in detail all requirements for each story. Additionally, developers can add some annotations on a story card based on the results of the discussion.</p>
<p>The user story must only include functional requirements that are valuable and visible to a user. The following example is not a good story:</p>
<blockquote><p><i>The software will be written in PHP</i></p></blockquote>
<p>There is no value for the users in this story, because users would not care about the technical aspect. Users are interested in a unit of functionality, an action they can perform, for instance their checking balance online. </p>
<h4>How long it should be</h4>
<p>A user story must be short and cover just one unit of functionality, it is just “a thing to do”, without going into details, which will be covered in communication with the customer in later. To understand the expectations of a user we use acceptance tests, written on the  back of a story card. These are short and incomplete, they tell us how to test the story. The goal here is to communicate additional details so that developers know the scope of the story.</p>
<h3>Writing User Stories</h3>
<p>The most important aspect of writing user stories is the customer's involvement in the process; only he has the vision how the end product should function. The user story must be written in business language, without using technical jargon, and should state design goals, so that it is understandable to all involved. The customer can then prioritize the stories based on value they add. Moreover, a user story needs to concentrate on the who, what and why of the functionality, never on how. Below you can find a simple template for writing user stories, which you can follow:</p>
<p><strong>Title</strong><br />
One line to help differentiate a story</p>
<p><strong>Narrative</strong><br />
As a<strong> [user role]</strong> I want to <strong>[goal]</strong> so that <strong>[benefit]</strong></p>
<p><strong>Acceptance criteria</strong> </br><br />
List of tests decided by a customer</p>
<p>Start by writing a title/name of a story. This is used by the team to differentiate the story from other stories. The title should describe an activity and be short enough to fit on 3"x5" sticky note when written with a marker.</p>
<p>The description in a form of <i>As a [user role] I want to [goal] so that [benefit]</i> has many useful features.  It implies that all users of the system need to be kept in mind, that developers must take into account what users want to achieve, and that developers need to convert that into a feature that users can benefit from. Additionally, it makes the story writer consider who wants the feature and why. Describing things in this form allows us to communicate the requirement to developers to help them understand it, and it also encourages further collaboration with the customer. </p>
<p>If you struggle to fit the description on a user story card, it is a good indication that narrative may be too long. The story may need splitting into several smaller stories, or it may need to include fewer details.</p>
<p>It is also good to include acceptance tests, which make the story easier to remember and help the team to understand what “done” means.</p>
<h4>INVEST</h4>
<p>The acronym <b>INVEST</b> stands for six attributes of a good user story, which ideally should be <strong>Independent, Negotiable, Valuable, Estimatable, Small </strong>and <strong>Testable</strong>.  This next section describes each of these in turn.</p>
<p><strong>Independent</strong><br />
When you write a user story you should take care to avoid introducing dependencies between stories. Each user story should be a self-contained feature that adds incremental value. Any dependencies created at the story-writing phase will lead to complications while prioritising stories and planning the next iteration. </p>
<p>Every so often, we will find that we cannot avoid having stories depend on one another, for instance you have three stories that each implements different type of payment method. You know that work on the first of these stories will take up to four days, with one additional day for the second and third stories. In such a situation, with highly dependent stories, it is not clear which story should be given the four day estimate. The solution to the problem is to revise these stories and combine them into one bigger (but independent) story, eg:</p>
<blockquote><p><i>As a user I want to make a payment using methods X, Y and Z</i></p></blockquote>
<p>If a story becomes so big that it is not possible to finish it within an iteration, you need to look for other ways of splitting the stories.  In our example, we could instead split these stories into two new ones:</p>
<blockquote><p><i>As a user I want to make a payment with primary method X<br />
As a user I want to make a payment with additional payment methods Y and Z</i></p></blockquote>
<p>If you cannot find a way of combining or splitting dependent stories, a fallback option is to write two estimates on a card; four days for if the story is implemented as the first one, and a one day estimate for if the story is done after.</p>
<p><strong>Negotiable</strong></p>
<p>As I mentioned before, user stories serve as a reminder to have a conversation with your customer about required functionality. The user story card consists of a phrase, in a form of title or description, that aims to remind you to hold the conversation, and has notes clarifying what aspects need to be resolved during conversation. In the process of communication, user story details can be changed or new requirements added. It is important to note that user stories are not contracts, changing them should be flexible up until they become part of an iteration. </p>
<p><strong>Valuable</strong></p>
<p>The feature described by a user story must add business value, meaning that the functionality should be significant to the end user or customer. It is worth mentioning here that not all user stories need to be beneficial to end user of the system. There are many situations where the technical aspects are vital for the customer, for instance the system is distributed across multiple locations and the system purchaser needs to have central point of configuration.  In this instance, your story would look something like this:</p>
<blockquote><p><i>As an administrator I want to have centralised configuration so I can remotely change settings across all units</i></p></blockquote>
<p>The end users do not care where and how system is configured as long as they can use the system without disruptions. However, having a centralized configuration panel saves your customer a lot of valuable time.</p>
<p>How can you guarantee that all user stories are valuable to end user or customer? The solution is to make sure that the customer writes the stories, he is the domain expert and in the best position to specify the required functionality of the end product.</p>
<p><strong>Estimatable</strong></p>
<p>The user stories are written by the customer, but it is the developers' task to estimate the size or amount of time it takes to implement a story based on its complexity. Developers must always be in a position to estimate the story, based on the story’s narrative and any additional notes found on the story card. However, sometimes the development team is not able to estimate a story, usually as a result of one of these three situations:</p>
<ul>
<li>Development team lacks domain expertise.  If this happens, developers must talk to the customer who wrote the story and discuss the functionality in more detail to obtain overall understanding of what is necessary. Not all details need to be understood by developers at the time of estimating, but they need to know enough to enable the team to estimate the story.</li>
<li>Development team lacks technical knowledge.  The customer may require the developers to use an unfamiliar technology. It is nearly impossible to make accurate estimates in these cases. Agile Programming provides us with a strategy for this called <strong>spike</strong>.  A spike is a short experiment, with a defined maximum time frame,  performed by developers with the goal to learn just enough so they can provide an estimate for the story. When using spike, you create an additional story for the spike itself and the estimate is the maximum time frame allowed for the experiment.</li>
<li>Story is too big.  The team may not be able to estimate the story when it is too big. The only solution is to split the story in to smaller, more manageable chunks of functionality and estimate each new story independently.</li>
</ul>
<p></p>
<p><strong>Small</strong></p>
<p>User stories should be appropriately sized for the project environment.  If stories are too small or too big, it makes estimating, prioritizing and iteration planning with any certainty very difficult. To determine the "right" size of story, you must consider the development team, its experience and capabilities, and the technologies in use. To adjust stories to right size you can split epic stories into smaller chunks of functionality or combine small stories into a bigger one.</p>
<p><strong>Testable</strong></p>
<p>Developers must know when work on a user story can be considered "done". The only indicators of "done" are clearly defined acceptance criteria. All tests should be written up front, before work on the story begins. As I already mentioned, acceptance tests should be written by your customer. When the customer struggles to clearly define how a feature should be tested, it may indicate an issue.  The story may be overly complex or unclear, it may not have enough value, or simply the customer may require some help in defining tests.</p>
<h4>Collecting User Stories</h4>
<p>Gathering requirements in a form of user stories is an iterative process. On the first pass you gather the main requirements, to give you the feel of overall system functionality. The first user stories are usually the most valuable to the customer, moreover, they do not need to be clearly define at this point. Some stories can work as a placeholder to remind everyone to have a conversation in the future, for instance you can write following story:</p>
<blockquote><p><i>As a user I want to search for products</i></p></blockquote>
<p>simply because that is all you know at the time. Later the story can evolve and be redefined as a collection of smaller, more concrete stories. Every next iteration will bring smaller and smaller stories, some of them grow or decrease in importance after each iteration. Additionally you can find that lots of stories are missed in first few iterations. </p>
<p>The goal of an iterative approach to writing stories is to get very quickly requirements for a large chunk of a system and have an overall feel how big the application will be, in advance of starting to work on it.</p>
<p>Agile Development provides a set of techniques for collecting user stories that support evolving nature of them. These are:</p>
<ul>
<li><b>User Interviews</b> - this is usually the default approach to gathering stories. The most important aspect of these interviews is to have a good selection of users, preferably performing different roles when using an application.</li>
<li><b>Questionnaires</b> - these are a very effective tool to gather additional details about stories you already have or how to prioritize them. Questionnaires also allow you to easily collect information from large number of users. This approach is inappropriate for gathering initial user stories, because they are one way communication channel and do not lend themselves to follow up conversation.</li>
<li><b>Observation</b> - Agile development guarantees that softwared is release as early as possible; you can use that fact and observe your user when they use the application. This gives you instant feedback how the experience can be improved.</li>
<li><b>Story Writing Workshop</b> - this is a meeting involving all players with an interest in the project; the product customer, developers and end users. During the workshop the team should only focus on brainstorming ideas and writing the stories, the customer will be able to prioritise all of them at later stage. In the story writing workshop, the goal is quantity of collected stories over the quality.  Do not spend much time discussing a story, but make use of the fact that you have entire team in one room and cover as many aspects as you can. Note all stories on paper cards, even when you will later store them electronically, as it speeds up the process. Moreover, some stories may get abandoned as a result of discussion. This technique is a very effective way to rapidly gather initial collection of user stories. </li>
</ul>
<p></p>
<h3>The Distinction Between a User Story and a Use Case</h3>
<p>The basic difference between user story and use case is in the perspective and the intent, which affects the level of captured details. </p>
<p>Use cases focus on the interactions between a system and one or more actors, where an actor can be a user or another system. Use cases describe a process and its steps in sufficient detail they can be understood on their own. The description of interactions is usually in a call-and-response format.</p>
<p>On the other hand, the user story concentrates on the users' values and is much lighter than a use case. It provides just enough detail so that a reader can understand the overall functionality that this user story should accomplish. A use of everyday language is encouraged to make sure user story is understandable by both developers and customers. In contrast to the use case, a user story is a reminder to have a conversation with your customer.</p>
<h3>Summary</h3>
<p>So why would you go to the trouble of dropping your current processes and instead use user stories to collect system requirements? Well, user stories emphasise collaboration with your customer, they encourage a verbal communication rather than tons of documentation. The ensure that the developers and the customer will interpret a statement in the same way. Since all user stories should be estimatable, it makes it very easy to use them in project planning; they are also small enough that you can fit few of them in one iteration. Finally, user stories are collected in iterative process, giving you the flexibility to add, change and drop requirements as your project progresses.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F&amp;title=How+To+Create+User+Stories" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F&amp;title=How+To+Create+User+Stories" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F&amp;title=How+To+Create+User+Stories" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F&amp;headline=How+To+Create+User+Stories" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+To+Create+User+Stories&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+To+Create+User+Stories&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+To+Create+User+Stories&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+To+Create+User+Stories&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+To+Create+User+Stories&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F&amp;title=How+To+Create+User+Stories&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F19%2Fhow-to-create-user-stories%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/07/19/how-to-create-user-stories/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DPC11: Day 2</title>
		<link>http://techportal.ibuildings.com/2011/07/05/dpc11-day-2/</link>
		<comments>http://techportal.ibuildings.com/2011/07/05/dpc11-day-2/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 07:55:37 +0000</pubDate>
		<dc:creator>Marco De Bortoli</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[dutch php conference]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3227</guid>
		<description><![CDATA[We’re sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event. This year as part of the Ibuildings team I attended the Dutch PHP Conference for the first time. What can I say? Well, it was an unbelievable experience; I enjoyed every moment spent there. I found [...]]]></description>
			<content:encoded><![CDATA[<p><i>We’re sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event.</i></p>
<p>This year as part of the Ibuildings team I attended the Dutch PHP Conference for the first time. What can I say? Well, it was an unbelievable experience; I enjoyed every moment spent there. I found it good first of all for the big names of the involved people such as <A HREF="http://sebastian-bergmann.de/">Sebastian Bergmann</A>, <A HREF="http://derickrethans.nl/">Derick Rethans</A>, <A HREF="http://fabien.potencier.org/">Fabien  Potencier</A>, <A HREF="http://www.zimuel.it/">Enrico Zimuel</A> plus many others. There was also the high quality of the presented talks, but also for the great opportunity to spend good time with my colleagues at Ibuildings and people from other companies all around the world.</p>
<p>Day 2 started with <A href="http://helgi.ws">Helgi Þormar Þorbjörnsson's</a> keynote about First Class APIs development, why the API should become a first class citizen in the company development strategy, how to achieve this results in the most effective way possible and what the benefits from this approach can be.</p>
<p>After that I needed to decide which talks to go to and this decision was anything but simple because most of them were very interesting, not forgetting the uncon submissions that were very good too.<br />
<span id="more-3227"></span></p>
<p>I chose first Profiling PHP Applications by Derick Rethans, who is known to be the father of Xdebug, possibly one of the best friends of all the PHP developers out there. The interesting thing in his talk has been not only the way he introduced and talked about profiling with Xdebug, but finally for the first time I enjoyed listening someone mention and talk also XHProf, a tool too many times not properly considered but actually very good especially when you need to profile production environment because of its low impact.</p>
<p>The second talk I attended has been Managing a shared MySQL Farm by <A HREF="http://blog.feryn.eu/">Thijs Feryn</A>, has the title can suggest you he basically presented a use case and a practical solution about how it’s possible to manage a shared MySQL farm with databases distributed on many servers, basics concept related to the standard MySQL user management and the problems you encounter when you have to spread those information across the network. I very much appreciated the comprehensive and complete explanation about using phpMyAdmin on the top of all the provisioning and management system using PMA Single Signon module and custom fallback function to determine database and nodes and properly switch to them. 	</p>
<p>Next I saw Modular Application Architecture by <A HREF="http://kore-nordmann.de/">Kore Nordmann</A> and <A HREF="http://schlitt.info/">Tobias Schlitt</A>, which was interesting as two speakers presented at the same time. The talk was mainly focused on how to achieve code maintainability. So they introduced different solutions and different approaches exposing pros and cons for each one, topped with a good number of code examples. </p>
<p>Last (but not least!) Large-Scale Data Processing with Hadoop and PHP by <A HREF="http://blog.wombert.de/">David Zülke</A> about map reducing implementation, how it can be used and how good it can be when you need to deal with huge amount of data. He introduced his talk with some numbers from Facebook, Yahoo and Twitter, numbers that can really make your eyes water! While Map Reduce itself is not really a new concept, this talk covered hadoop which is a framework to make working with map reduce much easier. What’s cool with it? Well it works with streams and it uses STDIN and STDOUT, which means that even though it is written in Java, you can use it with any language you like able to deal with streams. Luckily for us David already did the hard work for us writing "HadooPHP" (I'll let you guess what it does).</p>
<h3>Overall Impressions</h3>
<p>One thing I really appreciated about DPC was the Open Source and Open Knowledge spirit found there. Speakers were not there just only to talk and present something, they were there more to share their own knowledge and to share ideas and maybe a new solution to their problems.  This, in my opinion, is one of the best things I took with me from DPC.</p>
<p>In the end I had an excellent time, both personally and professionally. If you weren’t there, you missed out!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F&amp;title=DPC11%3A+Day+2" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F&amp;title=DPC11%3A+Day+2" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F&amp;title=DPC11%3A+Day+2" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F&amp;headline=DPC11%3A+Day+2" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC11%3A+Day+2&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC11%3A+Day+2&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC11%3A+Day+2&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC11%3A+Day+2&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC11%3A+Day+2&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F&amp;title=DPC11%3A+Day+2&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F05%2Fdpc11-day-2%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/07/05/dpc11-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DPC11: Distributed Systems Tutorial</title>
		<link>http://techportal.ibuildings.com/2011/07/01/dpc11-distributed-systems-tutorial/</link>
		<comments>http://techportal.ibuildings.com/2011/07/01/dpc11-distributed-systems-tutorial/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 07:48:37 +0000</pubDate>
		<dc:creator>Patrick van der Velden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[distributed systems]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[helgi]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3220</guid>
		<description><![CDATA[We’re sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event. For the morning of tutorial day, I chose to attend Think like an ant, distribute the workload, given by Helgi Þormar Þorbjörnsson. Helgi is a former Ibuildings colleague and now a bigshot at Orchestra.io. [...]]]></description>
			<content:encoded><![CDATA[<p><i>We’re sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event.</i></p>
<p>For the morning of tutorial day, I chose to attend <i>Think like an ant, distribute the workload</i>, given by Helgi Þormar Þorbjörnsson. Helgi is a former Ibuildings colleague and now a bigshot at Orchestra.io. I'm happy to see he's doing well. His presentation started off explaining to us why distributing can be a good thing by pointing out three significant aspects: <strong>budget, efficiency and perception</strong>. </p>
<p><span id="more-3220"></span><br />
Budget-wise, for a distributed application there is no need to invest in a big, expensive and hard to maintain server that runs the entire application by itself. A company can save a significant amount of money investing in a collection of smaller or virtual servers or even use “the cloud”. They are often easier to maintain and combined they can outperform a big server. This brings us to the efficiency aspect. The efficiency gain argument is strengthened by explaining the security-related principle that 1,000 people can exit a room quicker through 10 small exits than through 1 big exit. The perception gain lies in the ability to let other machines do resource-consuming processes so the originating machine can keep the user informed, or even let the user do other tasks while the deferred processes are running. An appropriate quote from Helgi, “Make our fish look like a shark”, was illustrated by a photo of a fish in a bowl with a shark fin strapped to its back. </p>
<p>Indeed, nature already seems to have solved many of our problems for us. Take a look at an ant colony. They are well organized and very efficient in solving problems they might encounter. They benefit from their strength in numbers, their ability to work together and the fact they have specialised types of ants for different tasks. Translated to a distributed application, the application as a whole represents the colony and the components represent ants, doing their specific task to keep the colony running.</p>
<p>Distributing your application involves the following characteristics: decoupling, elasticity, high availability and concurrency. Decoupling means splitting your application into functional pieces, like a database, a frontend, a cache, etc. Elasticity is that if the usage of your application is growing beyond initial expectations, more distributed components can be added to increase the capacity of your application. In order to make such dynamic changes, a certain level of monitoring is required. The initial design of your distributed application should account for this from the start, because it is very hard to implement an expansion strategy when your application is just about to reach its limits. Some monitoring tools are commercial products, some are open source. </p>
<p>Bringing the monitoring and the elastic behaviour of your application together creates a beautiful solution: an application that knows when to add/release extra components (servers) to keep things running smoothly - and actually does so!</p>
<p>There were several pitfalls and proposed solutions mentioned in the session:
<ul>
<li>local sessions; solvable by storing sessions in a db or memcache</li>
<li>local memory; solvable by using networked memcache</li>
<li>local files, uploads, writing to /tmp; solvable by storing on S3 or networked filesystem, serving static files from CDNs.</li>
</ul>
<p></p>
<p>Internal APIs between the components of your application creates a level of abstraction which makes it possible to switch components (servers) without the other components realising it.</p>
<p>Next, Helgi illustrated a number of tools by telling several real-life stories about using these tools to implement distributed solutions for specific problems. Tools like Gearman, CloudSplit, syslogd, internal APIs, CouchDB, supervisord, Map/Reduce technique, Hadoop, ZeroMQ and others are all key items in the toolbox for creating scalable systems.  Each story was an insightful look into real-world problems and distributed solutions. Especially the combination of a distributed application, extensive monitoring and the ability to automatically adapt to certain events was an appealing concept to me. I wish I could recite all his anecdotes right here, but remembering all details from a 3-hour tutorial is nearly impossible. If you have the opportunity to see Helgi speak at a conference or even talk to him in person, don't hesitate to do so!</p>
<p>You can see Helgi's slides <a href="http://www.slideshare.net/helgith/scale-like-an-ant-distribute-the-workload-dpc-amsterdam-2011">over on slideshare</a> - worth a look for the points outlined above and the excellent fish/shark picture!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F&amp;title=DPC11%3A+Distributed+Systems+Tutorial" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F&amp;title=DPC11%3A+Distributed+Systems+Tutorial" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F&amp;title=DPC11%3A+Distributed+Systems+Tutorial" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F&amp;headline=DPC11%3A+Distributed+Systems+Tutorial" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC11%3A+Distributed+Systems+Tutorial&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC11%3A+Distributed+Systems+Tutorial&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC11%3A+Distributed+Systems+Tutorial&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC11%3A+Distributed+Systems+Tutorial&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC11%3A+Distributed+Systems+Tutorial&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F&amp;title=DPC11%3A+Distributed+Systems+Tutorial&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F07%2F01%2Fdpc11-distributed-systems-tutorial%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/07/01/dpc11-distributed-systems-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DPC: Day 1</title>
		<link>http://techportal.ibuildings.com/2011/06/21/dpc-day-1/</link>
		<comments>http://techportal.ibuildings.com/2011/06/21/dpc-day-1/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 08:03:43 +0000</pubDate>
		<dc:creator>Ed van Beinum</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[dutch php conference]]></category>
		<category><![CDATA[edvanbenium]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3138</guid>
		<description><![CDATA[We're sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event On the morning of the conference, I rushed to get the Metro and was slightly confused by the sheer size of the RAI, which meant I didn't get a chance to get a coffee [...]]]></description>
			<content:encoded><![CDATA[<p><i>We're sharing a series of posts from our developers who attended DPC 2011, telling us about their experiences of the event</i></p>
<p>On the morning of the conference, I rushed to get the Metro and was slightly confused by the sheer size of the RAI, which meant I didn't get a chance to get a coffee before the opening keynote. Luckily <a href="http://aralbalkan.com">Aral Balkan</a> bounded onto the stage with more infectious energy than any stimulating beverage could have provided. Aral is both a developer (check out his iOS Twitter client, <a href="http://feathersapp.com/">Feathers</a>) and a UX (user experience) consultant.<br />
<span id="more-3138"></span></p>
<p>Having Aral doing the keynote was a brilliant move.  UX is something we all have to think about and as a developer I love being exposed to design concepts; it improves how I think about the whole software development lifecycle. Although the lines between designers and developers are becoming blurred, we still have lots to learn from each other. Aral suggested that the age of features is dead, and that we are now in the age of user experience - that rather than features differentiating between products, it is how we feel when using them. Do they make you feel like a helpless child (e.g. baffling Windows error messages, or handles on a push door) or Superman (e.g. single swipe credit card entry to the Norwegian Metro). I now realise why, on the flight home, it felt awesome boarding a plane with with just a passport and a QR Code on my phone.  Aral kicked off the conference in fine style and his performance foreshadowed what would be a great conference.</p>
<p>Having 4 tracks at the conference meant I had some difficult decisions to make: for the first talk of day I had to turn down <a href="http://joind.in/talk/view/3219">Ian Barber talking about ZeroMQ</a> (luckily I had seen that at PHP UK and I highly recommend seeing it if you get a chance) and <a href="http://joind.in/talk/view/3218">Rowan Merewood talking about Test-Driven Development</a> and instead opted for <a href="http://joind.in/talk/view/3221">Paul Matthews talking about Solr</a>). Apache Solr is an Apache top level project that builds upon the Lucene engine to provide advanced search capabilities. Paul has extensive experience with Solr and his talk was full of details. His nerves were apparent at the beginning, but by the end he was deftly handling all the questions the audience threw at him. He even wrote a blog post about this <a href="http://86p.paul-matthews.co.uk/post/5691823632/dpc-speaking-experience">first speaking experience</a>, which is a great read for aspiring conference speakers.</p>
<p>After that, I wanted to see Cal Evans (whose <a href="http://voicesoftheelephpant.com">Voices of the Elephpant podcast</a> I've been enjoying). He gave an interesting talk about <a href="http://joind.in/talk/view/3222">Zend Framework from the Command Line</a>.   While using curl or wget  from a Cron task to hit a URL in an existing app is all well and good, and indeed Worpress, Drupal and Magento all use that technique, there are better options available with Zend Framework.</p>
<p>Cal showed his approach using a CLI bootstrap file and CLI controller which can be called from the command line and provides all the components of Zend  Framework. He showed a command line application that would send a text or call a phone from the command line using the <a href="http://tropo.com">Tropo</a> API.  This approach to CLI applications is a great way for us developers to realise the aphorism: 'a great engineer makes tools that help other people' - and by embracing the command line we can now make those tools and distribute them easily.</p>
<p>After a quick caffeine top-up it was onto to see <a href="http://joind.in/talk/view/3227">Alistair Stead talk about automating your development environment</a>. We are accustomed to using source control for our application code, but we can now do the same for the infrastructure we use, by using <a href="http://www.opscode.com/chef">Chef</a>. Chef uses Ruby scripts (yes, Alistair showcased Ruby code at a PHP conference and survived!) to abstract away the vagaries of diverse package management systems across different operating systems. Servers can be built repeatedly and consistently across many machines and even the Ruby code can be versioned to keep track of changes. Alistair also used <a href="http://vagrantup.com">Vagrant</a> to automatically create a local virtual machine as his demo - one command with build and configure a LAMP server on your machine!</p>
<p>In the next session, I saw <a href="http://joind.in/talk/view/3231">Evert Pot talking about REST</a> where he expounded the virtue of using a proper REST interface but to not be too zealous about it.  My inner geek enjoyed the recap of HTTP codes and their groupings, including everyone's favourite: <a href="http://stackoverflow.com/questions/1979722/i-am-a-teapot-http-418-status-code">HTTP 418</a>.</p>
<p>After another quick caffeine break I went to see <a href="http://joind.in/talk/view/3236">Kore Nordmann talk about Distributed Couch Apps</a>. He gave a quick introduction to CouchDB's HTTP API and demonstrated creating a database and adding documents and then returning JSON objects from Couch, but the fun comes when you add CouchApp to the mix. <a href="http://couchapp.org/page/index">CouchApp </a>is  a project built on top of CouchDB that uses CouchDB's server capabilities to deploy an entire web application. This talk was really interesting and certainly piqued my interest in Couch and got me thinking about how I can use it in one of my projects.</p>
<p>To round off the day I saw <a href="http://joind.in/talk/view/3238">Rob Allen talk about Zend Framework 2</a>. And there is lots of awesome stuff! ZF 1 has been around since 2006 which is an eon in Internet terms. The things that have been done with that single API are great, but we have now outgrown it and Zend Framework developers are being limited with the things they can do.  Namespaces, better use of Interfaces, autoloading, revised plugin architechture, Exceptions, Service Locator with DI and improved community interaction are among the many things the are new or improved in ZF2. Rumour has it that ZF2 beta will be released in October with the stable version being released in December - this is still theoretical of course so don't hold Rob Allen or your humble author to that date! </p>
<p>The conference social was held at Club NL kindly sponsored by <a href="http://ibuildings.com">Ibuildings</a>, <a href="http://github.com">Github</a> and <a href="http://sanomamedia.com/">Sanoma Digital</a>.   There was quite a crowd and the free beer was much appreciated, however the venue itself was rather small and the music was loud, which made the 'social' aspect of the event slightly tricky!  We walked back to our hotel with our heads buzzing with new ideas (and the free beer), happy in the knowledge that we could do it all over again the next day!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F&amp;title=DPC%3A+Day+1" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F&amp;title=DPC%3A+Day+1" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F&amp;title=DPC%3A+Day+1" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F&amp;headline=DPC%3A+Day+1" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC%3A+Day+1&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC%3A+Day+1&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC%3A+Day+1&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC%3A+Day+1&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC%3A+Day+1&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F&amp;title=DPC%3A+Day+1&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F21%2Fdpc-day-1%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/06/21/dpc-day-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DPC11: Retrospective</title>
		<link>http://techportal.ibuildings.com/2011/06/14/dpc11-retrospective/</link>
		<comments>http://techportal.ibuildings.com/2011/06/14/dpc11-retrospective/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 09:21:35 +0000</pubDate>
		<dc:creator>matthijs</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Planet PHP]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[dpc11]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[topics]]></category>
		<category><![CDATA[trend]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3146</guid>
		<description><![CDATA[Before our memories get swamped by our daily lives, let's take a look back at the Dutch PHP Conference 2011. For me, two things stand out when I look back on this years DPC. One was the rate at which ideas were exchanged, both during the regular conference days and at the associated social events. [...]]]></description>
			<content:encoded><![CDATA[<p>Before our memories get swamped by our daily lives, let's take a look back at the <strong>Dutch PHP Conference 2011</strong>. For me, two things stand out when I look back on this years DPC.</p>
<p>One was the rate at which ideas were exchanged, both during the regular conference days and at the associated social events. Triggered by the talks they attended, people from many different nationalities were discussing a <strong>broad range of subjects</strong>, ranging from front-end technologies like HTML5, via the pitfalls of API design, to Extreme programming and its merits.  Although this isn’t anything new for conferences like this, I felt that this year was extra dynamic. Many people I talked to were very enthusiastic about their co-attendees and their ideas.</p>
<p>Exchanging ideas is ultimately the goal of a conference like this. When everyone goes home inspired and with a head full of <strong>new ideas and insights</strong>, the conference was a success. This was clearly the case with DPC11. A prime example of a talk that inspired people was Aral Balkan’s keynote: The Art of User Experience. It was easily the most discussed talk of the conference. It was cool to watch all these PHP developers get excited  about UX.</p>
<p>The other thing to stand out was the fact that many talks were <b>not</b> about PHP. That sounds a bit strange for a PHP conference, but to take a closer look at the <strong>subjects of the different talks</strong> let us do a little not-very-scientific analysis.<br />
<span id="more-3146"></span></p>
<p>I started out with determining the ratio was of PHP vs. non-PHP talks. This was what I came up with:</p>
<ul>
<li>Talks about PHP or directly related technology: 16 (37%)</li>
<li>Talks NOT about PHP: 18 (42%)</li>
<li>50/50 (mostly not PHP, but with PHP examples): 9 (21%)</li>
</ul>
<p></p>
<p>As we can see, only 37% of all talks were about PHP-specific subjects, such as Zend Framework, Doctrine 2, PHP extensions, etc. All other talks were about more generic subjects to do with <strong>software engineering</strong> or <strong>web development</strong>, sometimes in a PHP context. What, if anything, does this tell us about the interests of PHP developers? To be able to draw any conclusions we need to have a closer look at the subjects of the talks. To that end, I tried to categorise the talks in a few broad subject categories <i>*</i>:</p>
<ul>
<li>Architecture: 11 (26%)</li>
<li>Methodology: 6 (14%)</li>
<li>Tooling: 5 (12%)</li>
<li>Technical/Coding: 16 (37%)</li>
<li>Front End: 2 (5%)</li>
<li>Framework news: 3 (6%)</li>
</ul>
<p></p>
<p><i> Disclaimer: I understand that my categorisation of the talks is rough and could be subject to discussion. But even if we would shuffle some talks around, I think the general picture stays the same.</i></p>
<p>It is immediately obvious that there were a lot of talks focusing on general software engineering subjects like architecture, methodology and tooling. Together they made up more than half of all talks. Of course there was still a lot of focus on the more <strong>technical talks</strong> with subjects ranging from profiling PHP to handling i18n and l10n with Zend Framework: a decent 37%.  Another thing that is very noticeable is the scarcity of talks about front end technologies such as Javascript and HTML5 or about UX in general: only 5%.</p>
<p>How do these categories share out between the PHP and non-PHP talks then?</p>
<table>
<tr>
<th>Topic</th>
<th>PHP talks (%)</th>
<th>non-PHP talks (%)</th>
</tr>
<tr>
<td>Architecture</td>
<td>2 (13%)</td>
<td>5 (28%)</td>
</tr>
<tr>
<td>Methodology</td>
<td>1 (6%)</td>
<td>5 (28%)</td>
</tr>
<tr>
<td>Tooling</td>
<td>1 (6%)</td>
<td>3 (17%)</td>
</tr>
<tr>
<td>Coding</td>
<td>9 (56%)</td>
<td>3 (17%)</td>
</tr>
<tr>
<td>Framework</td>
<td>3 (19%)</td>
<td>0</td>
</tr>
<tr>
<td>Frontend</td>
<td>0</td>
<td>2 (10%)</td>
</tr>
</table>
<p></p>
<p><img src="http://chart.apis.google.com/chart?chxl=1:|Architecture|Methodology|Tooling|Coding|Framework|Frontend&#038;chxr=0,0,12&#038;chxt=y,x&#038;chbh=a,4,16&#038;chs=540x165&#038;cht=bvg&#038;chco=603966,98839B&#038;chds=0,12,0,12&#038;chd=t:2,1,1,9,3,0|5,5,3,3,0,2&#038;chdl=PHP+Talks|Non-PHP+Talks&#038;chtt=PHP+Topics" width="540" height="165" alt="PHP Topics" /></p>
<p>We can clearly see that most of the talks focusing on architecture, tooling and methodology are <strong>not PHP-specific</strong>. To me this means that the PHP community is becoming even more mature than it already is. We already moved into the enterprise market with the help of decent frameworks and by adopting concepts like continuous integration and continuous deployment. Many developers and companies have already made a choice for their preferred framework and can develop good quality software: <strong>no one is reinventing the wheel</strong> anymore.</p>
<p>Today we want to have efficient development teams and flexible architectures that can easily accommodate changes. This is reflected in the many talks about architectural subjects such as API design, Domain Driven Development, Modular Application Architecture, Test Driven Development, etc. The need for more efficient teams was evident in the subject of talks too: there were no fewer that four talks about agile development or team management.</p>
<p>For today’s PHP development teams, generic <strong>software engineering principles</strong> and technologies allied to PHP have become part of their architectures and daily work routine. It is only logical that we want to know more about them and learn about new ones. It is no surprise then, that we see schedules at PHP conferences which include a good proportion of talks that are not directly about PHP itself.</p>
<p>Having said so much about the diversity of topics, I still found that there was a subject that was conspicuously absent: development for mobile. This is a very hot subject right now and will remain so for the forseeable future.  There were talks about API development, which is crucial for mobile development. But APIs are only one part of publishing to mobile: we also need to talk about the client technology.  Even without talks about Objective C or Java, I would have very much liked to see some talks about <strong>how to go mobile</strong> with technology that we already use - such as PHP, HTML5, CSS3 and Javascript.</p>
<p>Apart from that small nitpick, I think it was a great conference. I enjoyed myself immensely, met a lot of people and learned a lot. I would like to thank all attendees, speakers, organisers and of course my Ibuildings colleagues for their contributions. Hope to <strong>see you all again next year</strong>!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F&amp;title=DPC11%3A+Retrospective" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F&amp;title=DPC11%3A+Retrospective" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F&amp;title=DPC11%3A+Retrospective" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F&amp;headline=DPC11%3A+Retrospective" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC11%3A+Retrospective&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC11%3A+Retrospective&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC11%3A+Retrospective&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC11%3A+Retrospective&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC11%3A+Retrospective&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F&amp;title=DPC11%3A+Retrospective&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F14%2Fdpc11-retrospective%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/06/14/dpc11-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a Custom Magento Shipping Method</title>
		<link>http://techportal.ibuildings.com/2011/06/09/creating-a-custom-magento-shipping-method/</link>
		<comments>http://techportal.ibuildings.com/2011/06/09/creating-a-custom-magento-shipping-method/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 13:10:20 +0000</pubDate>
		<dc:creator>Michael Whitby</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shipping]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3155</guid>
		<description><![CDATA[Magento is a feature rich e-commerce platform which offers several shipping methods out of the box. However, when building large e-commerce sites, you may meet a requirement to develop your own custom shipping methods. This is especially true if your client requires integration with a specific courier or shipping supplier. Explaining The Shipping Architecture Before [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.magentocommerce.com/">Magento </a>is a feature rich e-commerce platform which offers several shipping methods out of the box. However, when building large e-commerce sites, you may meet a requirement to develop your own custom shipping methods. This is especially true if your client requires integration with a specific courier or shipping supplier.</p>
<p><span id="more-3155"></span></p>
<h3>Explaining The Shipping Architecture</h3>
<p>Before making our own module, we’ll look at how Magento’s existing shipping rate functionality operates.  If you are already familiar with this, then you should skip to the next section.</p>
<p>For this walkthrough we’ll use the “Flatrate” shipping method which is available by default with Magento. This method requires two files (excluding inherited classes and so on), these are:</p>
<ul>
<li><code>app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php</code></li>
<li><code>app/code/core/Mage/Shipping/etc/config.xml</code></li>
</ul>
<p></p>
<p>Open Flatrate.php and take a look - there are four elements of the class which are essential to the operation of this rate.</p>
<p><i>app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php</i></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_code</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'flatrate'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_isFixed</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> collectRates<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAllowedMethods<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>The first important element is the <code>$_code</code> property. This is a code which must be unique to your shipping method. It’s important to note this code is specified in other places, so you need to be consistent with its naming (more on this later). The next property, <code>$_isFixed</code>, is telling Magento that this shipping method is a fixed, one time fee - rather than a recurring payment, which is the alternative option here.</p>
<p>The second file is <code>config.xml</code>; this file is for all Magento shipping methods and as such, it is quite large. However, we are only interested in one part of it:</p>
<p><i>app/code/core/Mage/Shipping/etc/config.xml</i></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;carriers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flatrate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sallowspecific<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sallowspecific<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>shipping/carrier_flatrate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fixed<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>5.00<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Flat Rate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>I<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;specificerrmsg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>This shipping method is currently unavailable...(etc)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/specificerrmsg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;handling_type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>F<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/handling_type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flatrate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/carriers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p></p>
<p>Notice how the node is called <code>&lt;flatrate&gt;</code> to match the <code>$_code</code> property in the <code>Flatrate.php</code> class we saw earlier. Most of the nodes above are easy to understand, but some will benefit from a little more explanation:</p>
<table>
<tr>
<td align="right" style="padding-right: 10px"><strong>sallowspecific</strong></td>
<td>set to 1 to limit the countries the rate is applicable to</td>
</tr>
<tr>
<td align="right" style="padding-right: 10px"><strong>title</strong></td>
<td>the courier name</td>
</tr>
<tr>
<td align="right" style="padding-right: 10px"><strong>name</strong></td>
<td>the rate name</td>
</tr>
<tr>
<td align="right" style="padding-right: 10px"><strong>type</strong></td>
<td>an option specific to flatrate, whether the charge is per item or order</td>
</tr>
<tr>
<td align="right" style="padding-right: 10px"><strong>specifierrmsg</strong></td>
<td>a message to show if the method does not apply to this country</td>
</tr>
<tr>
<td align="right" style="padding-right: 10px"><strong>handling_type</strong></td>
<td>whether the handling charge is fixed, per item or a percentage</td>
</tr>
</table>
<p></p>
<p>The <code>&lt;model&gt;</code> node in <code>config.xml</code>, as shown above, tells Magento which shipping class to use; in our example, that is <code>shipping/carrier_flatrate</code>. Magento converts <code>shipping/carrier_flatrate</code> to <code>Mage_Shipping_Model_Carrier_Flatrate</code> (found in <code>app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php)</code>. The class within Magento responsible for loading the correct rate is <code>Mage_Shipping_Model_Shipping</code>. It is a good idea to take a look at this class and familiarise yourself with how Magento handles this.</p>
<p>We can also take a deeper look at the flatrate classfile. This class extends <code>Mage_Shipping_Model_Carrier_Abstract</code> and implements <code>Mage_Shipping_Model_Carrier_Interface</code>.  In fact since all shipping methods must do the same, we can work out which methods require implementation, and which are already there.  In general we will be interested in implementing two methods:</p>
<ul>
<li><code>collectRates()</code></li>
<li><code>getAllowedMethods()</code></li>
</ul>
<p></p>
<p>All other implementation is provided in <code>Mage_Shipping_Model_Carrier_Abstract</code>, so these two methods are all we need to create our own shipping model.</p>
<h3>Creating Your Own Rate</h3>
<p>This example shows how to create a simple shipping rate, which can provide the basis of a more complicated rate should you need to adapt this for your own purposes.  The first step is to make our module skeleton by creating a directory structure along these lines:</p>
<p><code>app/code/local/Foobar/<br />
app/code/local/Foobar/Shipping/<br />
app/code/local/Foobar/Shipping/etc/<br />
app/code/local/Foobar/Shipping/Model/</code></p>
<p>Then we need to add a module activation file to <code>app/etc/modules/Foobar_Shipping.xml</code> with the following contents:</p>
<p><i>app/etc/modules/Foobar_Shipping.xml</i></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Foobar_Shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>local<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/codePool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;depends<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Mage_Shipping</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/depends<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Foobar_Shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p></p>
<p>Next we make the config file; here’s the one I used when creating this example:</p>
<p><i>app/code/local/Foobar/Shipping/etc/config.xml</i></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Foobar_Shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0.1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Foobar_Shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;foobar_shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Foobar_Shipping_Model<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/foobar_shipping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/models<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;default<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;carriers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;foobar_customrate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/active<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foobar_shipping/carrier_customrate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/model<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Foobar Shipping<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Default Rate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/foobar_customrate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/carriers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/default<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p></p>
<p>Finally we add our custom shipping class.</p>
<p><i>app/code/local/Foobar/Shipping/Model/Carrier/Customrate.php</i></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Foobar_Shipping_Model_Carrier_Customrate
    <span style="color: #000000; font-weight: bold;">extends</span> Mage_Shipping_Model_Carrier_Abstract
    implements Mage_Shipping_Model_Carrier_Interface
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_code</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'foobar_customrate'</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_isFixed</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> collectRates<span style="color: #009900;">&#40;</span>Mage_Shipping_Model_Rate_Request <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigFlag</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/rate_result'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/rate_result_method'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrier</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrierTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigData</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethodTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigData</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPrice</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCost</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAllowedMethods<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigData</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>After clearing your cache, go and ahead and add a product to your cart and go to checkout. You should see our shipping method sitting there with a charge (of 5 units of whatever currency your Magento is set up to use). Congratulations - you have a basic shipping module available for use!</p>
<h3>Behind the Scenes</h3>
<p>When we hit the checkout, Magento uses the <code>collectRates()</code> method in our class; via this method you can offer shipping rates (or not) by storing an object in <code>$result</code>, which is <code>Mage_Shipping_Model_Rate_Result</code>. Basically, you add instances of <code>Mage_Shipping_Model_Rate_Result_Method</code> (<code>$method</code> in our example) to this object via the <code>append() </code>method. The rate result object holds all the values such as carrier and method name, as well as the all-important price and cost. In this way it becomes easy to offer multiple rates via the <code>collectRates()</code> method, simply by creating more rate results and calling <code>append()</code> for each one, in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/rate_result'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/rate_result_method'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrier</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrierTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigData</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate_one'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethodTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Rate 1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPrice</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCost</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'shipping/rate_result_method'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrier</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCarrierTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConfigData</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'foobar_customrate_two'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMethodTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Rate 2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPrice</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$method</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCost</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>After using the code above, you will see two shipping methods available for use. Methods are grouped by carrier, and the Carrier Title and Method Title are displayed on the frontend. If your shipping method uses multiple rates then it makes little sense to use the config to specify the names attribute, which is why they are hardcoded here. In this case you are free to remove the <code>&lt;name&gt;</code> node from your <code>config.xml</code>, as it is not used anywhere else.</p>
<h3>Shipping Methods in Magento</h3>
<p>This post outlined the absolute essentials for creating a simple custom shipping method.  You can now go ahead and use or adapt this for use in your own applications.  As with all aspects of Magento, great flexibility is available, once you know how to work with it, and hopefully this post will be useful for anyone dealing with shipping rates.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F&amp;title=Creating+a+Custom+Magento+Shipping+Method" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F&amp;title=Creating+a+Custom+Magento+Shipping+Method" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F&amp;title=Creating+a+Custom+Magento+Shipping+Method" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F&amp;headline=Creating+a+Custom+Magento+Shipping+Method" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Creating+a+Custom+Magento+Shipping+Method&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Creating+a+Custom+Magento+Shipping+Method&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Creating+a+Custom+Magento+Shipping+Method&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Creating+a+Custom+Magento+Shipping+Method&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Creating+a+Custom+Magento+Shipping+Method&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F&amp;title=Creating+a+Custom+Magento+Shipping+Method&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F09%2Fcreating-a-custom-magento-shipping-method%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/06/09/creating-a-custom-magento-shipping-method/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Conference Pass Giveaway</title>
		<link>http://techportal.ibuildings.com/2011/06/08/conference-pass-giveaway/</link>
		<comments>http://techportal.ibuildings.com/2011/06/08/conference-pass-giveaway/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 08:46:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3166</guid>
		<description><![CDATA[We had a great prize in the raffle for DPC this year; a Free Pass for Conference &#038; Awards 2011, organised by eZsystems, which takes place on 16-17 of June in London. The winner of the ticket is unable to attend the event however, so it's up for grabs! If you would be able to [...]]]></description>
			<content:encoded><![CDATA[<p>We had a great prize in the raffle for DPC this year; a Free Pass for Conference &#038; Awards 2011, organised by eZsystems, which takes place on 16-17 of June in London.  The winner of the ticket is unable to attend the event however, so it's up for grabs!</p>
<p>If you would be able to attend and would like the ticket, leave a comment on the post telling us why you want to be there, and we'll pick a winner from the commenters!  Be quick though, the event is next week so we'll be closing this competition very soon ...</p>
<p><strong>Update: And the winner is… Lee Davis!<br />
Congratulations Lee, looks like you’re going to eZ Conference &#038; Awards!</strong></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F&amp;title=Conference+Pass+Giveaway" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F&amp;title=Conference+Pass+Giveaway" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F&amp;title=Conference+Pass+Giveaway" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F&amp;headline=Conference+Pass+Giveaway" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Conference+Pass+Giveaway&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Conference+Pass+Giveaway&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Conference+Pass+Giveaway&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Conference+Pass+Giveaway&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Conference+Pass+Giveaway&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F&amp;title=Conference+Pass+Giveaway&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F06%2F08%2Fconference-pass-giveaway%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/06/08/conference-pass-giveaway/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>DPC11: Sessions and Slides</title>
		<link>http://techportal.ibuildings.com/2011/05/31/dpc11-sessions-and-slides/</link>
		<comments>http://techportal.ibuildings.com/2011/05/31/dpc11-sessions-and-slides/#comments</comments>
		<pubDate>Tue, 31 May 2011 08:30:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3125</guid>
		<description><![CDATA[The Dutch PHP Conference is over for another year - we had a wonderful time hosting you all in Amsterdam and we were delighted so many people were able to join us for 3 days of serious technical learning. While the event itself has finished, the content will live on in our DPC Radio podcast [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://phpconference.nl">Dutch PHP Conference</a> is over for another year - we had a wonderful time hosting you all in Amsterdam and we were delighted so many people were able to join us for 3 days of serious technical learning. While the event itself has finished, the content will live on in our <a href="http://techportal.ibuildings.com/dpc-radio/">DPC Radio</a> podcast series, where we'll be broadcasting audio from the main tracks at the conference through the year. Plenty of the speakers have already uploaded their slides, read on for a breakdown of ratings and links to slides for those talks that have them - and don't forget to rate all the talks you saw on <a href="http://joind.in/event/dpc11">joind.in</a>! </p>
<p><span id="more-3125"></span></p>
<table>
<tr>
<th>Talk</th>
<th>Speaker</th>
<th>Rating and Links</th>
</tr>
<tr>
<td><a href="http://joind.in/3375">Keynote: Making the new Everyday Things</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Aral Balkan </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3218">TDD and Getting Paid</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Rowan Merewood </td>
<td><a href="http://www.slideshare.net/rowan_m/tdd-and-getting-paid">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3219">ZeroMQ is the Answer</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Ian Barber </td>
<td><a href="http://www.slideshare.net/IanBarber/zeromq-is-the-answer-dpc-11-version">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3220">Tips and Tricks for tuning PHP for Windows and IIS</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Mark Brown </td>
<td><a href="http://www.slideshare.net/MarkBrown7/tuning-php-for-windows-iis">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3221">Searching with Solr - Why, When and How</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Paul Matthews </td>
<td><a href="http://www.slideshare.net/paulmatthews86/search-with-solr">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3222">Zend Framework from the CLI</a> <br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Cal Evans </td>
<td><a href="http://blog.calevans.com/wp-content/uploads/2009/10/Zend-Framework-from-the-Command-Line1.pdf">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3223">IPv6 for PHP Developers</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>David Soria Parra </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3224">Pursuing practices of Domain-Driven Design in PHP</a><br /><img src="http://joind.in/inc/img/rating-2.gif"></td>
<td>Giorgio Sironi </td>
<td><a href="http://www.slideshare.net/piccoloprincipe/pursuing-practices-of-domaindriven-design-in-php">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3225">Developing &amp; Deploying High Performance PHP Applications</a><br /><img src="http://joind.in/inc/img/rating-2.gif"></td>
<td>Christopher Jones </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3226">Geolocation and Maps with PHP</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Derick Rethans </td>
<td><a href="http://derickrethans.nl/talks/maps-dpc11.pdf">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3227">Cooking up your Development Environment</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Alistair Stead </td>
<td><a href="http://www.slideshare.net/astead/cooking-up-your-dev-environment-with-chef">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3228">The Hitchhikers Guide to Agile</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Sebastian Sch&uuml;rmann </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3465">Inside DocBlox</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Mike van Riel </td>
<td><a href="http://www.slideshare.net/mikevanriel/inside-docblox">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3230">How XHP revolutionized Front-end Development at Facebook</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Stefan Parker </td>
<td><a href="http://www.cl.ly/76qG">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3231">So you think You know REST?</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Evert Pot </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3232">Simplify you External Dependency Management</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Stephan Hochd&ouml;rfer </td>
<td><a href="http://www.slideshare.net/shochdoerfer/simplify-your-external-dependency-management-dpc11">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3466">Public key encryption 101</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Joshua Thijssen </td>
<td><a href="http://www.slideshare.net/jaytaph/alice-bob-public-key-cryptography-101-uncon-dpc">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3235">Clean PHP</a><br /><img src="http://joind.in/inc/img/rating-2.gif"></td>
<td>Sebastian Bergmann </td>
<td><a href="http://www.slideshare.net/sebastian_bergmann/clean-php-dpc11">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3236">Distributed Couch Apps - Embracing eventual Consistency</a><br /><img src="http://joind.in/inc/img/rating-0.gif"></td>
<td>Kore Nordmann </td>
<td><a href="http://talks.qafoo.com/">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3237">Implementing Comet using PHP</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Jonas Mari&euml;n </td>
<td><a href="http://www.slideshare.net/kingfoo/implementing-comet-using-php">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3467">The missing link between IDE and webserver</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Arne Rudolph </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3228">Zend Framework 2.0: What's New and what's changed?</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Rob Allen </td>
<td><a href="http://akrabat.com/wp-content/uploads/DPC11-ZF2-Whats-new.pdf">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3239">HTML5 for PHP Developers</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Thorsten Rinne </td>
<td><a href="http://www.slideshare.net/mayflowergmbh/html5-for-php-developers-dpc11">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3240">Advanced OO Patterns</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Tobias Schlitt </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3468">Why Google Maps sucks</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Derick Rethans </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3469">PHPSpec - BDD for PHP</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Marcello Duarte </td>
<td><a href="http://www.slideshare.net/marcello.duarte/phpspec-bdd-for-php">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3470">Saving time by applying clean code principles - ranting about documentation</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Volker Dusch </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3241">Keynote: First Class APIs</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Helgi Thormar Thorbj&ouml;rnsson </td>
<td><a href="http://www.slideshare.net/helgith/firstclass-apis-dpc-2011-amsterdam">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3242">Profiling PHP Applications</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Derick Rethans </td>
<td><a href="http://derickrethans.nl/talks/profiling-dpc11.pdf">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3243">Implementing OAuth</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Lorna Jane Mitchell </td>
<td><a href="http://www.slideshare.net/lornajane/oauth-7990565">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3244">The New Era of PHP Frameworks</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Juozas Kaziukenas </td>
<td><a href="http://www.slideshare.net/juokaz/the-new-era-of-php-frameworks-dpc">slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3255">Launching Content in Mobility with REST &amp; eZ Publish</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Nicolas Pastorino </td>
<td><a href="http://www.slideshare.net/jeanvoye/nicolas-pastorino-launchingcontentinmobilitywithrestandezpublish">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3245">Optimising a Zend Framework Application</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Rob Allen </td>
<td><a href="http://akrabat.com/wp-content/uploads/DPC11-Optimising-ZF1.pdf">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3246">Strong Cryptography in PHP</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Enrico Zimuel </td>
<td><a href="http://www.slideshare.net/e.zimuel/strong-cryptography-in-php">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3247">Managing a shared MySQL Farm</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Thijs Feryn </td>
<td><a href="http://www.slideshare.net/combell/managing-a-shared-mysql-farm-dpc11">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3471">Writing documentation the easy way</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-2.gif"></td>
<td>Bram Vogelaar </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3248">Agility and Quality</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Sebastian Bergmann </td>
<td><a href="http://www.slideshare.net/sebastian_bergmann/agility-and-quality-dpc11">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3249">Modular Application Architecture</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Kore Nordman &amp; Tobias Schlitt </td>
<td><a href="http://talks.qafoo.com/">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3250">Character Sets Suck</a><br /><img src="http://joind.in/inc/img/rating-3.gif"></td>
<td>Ligaya Turmelle &amp; Raymond DeRoo </td>
<td><a href="http://www.slideshare.net/ligaya/character-sets">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3472">Bugfixing for Zend Framework</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Bart McLeod </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3473">API driven Zend Framework app</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Michelangelo van Dam </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3474">Tasks, daemons, light bulbs</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Dirk Engels </td>
<td><a href=""></a></td>
</tr>
<tr>
<td><a href="http://joind.in/3251">Practical Git</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>David Soria Parra </td>
<td><a href="http://prezi.com/qggyzxihqjtf/practical-git/">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3252">Large-scale Data Processing with Hadoop and PHP</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>David Z&uuml;lke </td>
<td><a href="http://www.slideshare.net/Wombert/largescale-data-processing-with-hadoop-and-php-dpc11-20110521">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3253">Let's take over the world with Zend Framework</a><br /><img src="http://joind.in/inc/img/rating-4.gif"></td>
<td>Martin de Keijzer </td>
<td><a href="http://www.slideshare.net/Martin82/lets-take-over-the-world-with-zend-framework-8063834">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3475">Phing - a PHP build tool - short introduction</a> (uncon)<br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Michiel Rook </td>
<td><a href="http://www.slideshare.net/michieltcs/phing-dpc-uncon-slideshare">Slides</a></td>
</tr>
<tr>
<td><a href="http://joind.in/3254">Keynote: Open Teams</a><br /><img src="http://joind.in/inc/img/rating-5.gif"></td>
<td>Cal Evans </td>
<td><a href="http://blog.calevans.com/wp-content/uploads/2009/10/Open_Teams.pdf">Slides</a></td>
</tr>
</table>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F&amp;title=DPC11%3A+Sessions+and+Slides" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F&amp;title=DPC11%3A+Sessions+and+Slides" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F&amp;title=DPC11%3A+Sessions+and+Slides" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F&amp;headline=DPC11%3A+Sessions+and+Slides" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPC11%3A+Sessions+and+Slides&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPC11%3A+Sessions+and+Slides&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPC11%3A+Sessions+and+Slides&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPC11%3A+Sessions+and+Slides&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPC11%3A+Sessions+and+Slides&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F&amp;title=DPC11%3A+Sessions+and+Slides&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F31%2Fdpc11-sessions-and-slides%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/05/31/dpc11-sessions-and-slides/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ibuildings Challenge: Results</title>
		<link>http://techportal.ibuildings.com/2011/05/03/ibuildings-challenge-results/</link>
		<comments>http://techportal.ibuildings.com/2011/05/03/ibuildings-challenge-results/#comments</comments>
		<pubDate>Tue, 03 May 2011 10:55:46 +0000</pubDate>
		<dc:creator>Marco De Bortoli</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[four]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3083</guid>
		<description><![CDATA[We recently wrapped up the first Ibuildings challenge of 2011; a contest to create a virtual gamer able to play Four in a Line (you might also know it as Four in a Row, Connect Four or Find Four). Ibuildings provided the gaming field and the abstract player class that everyone needed to extend, and the [...]]]></description>
			<content:encoded><![CDATA[<p>We recently wrapped up the first <a href="http://www.ibuildings.com/challenge/">Ibuildings challenge</a> of 2011; a contest to create a virtual gamer able to play Four in a Line (you might also know it as Four in a Row, Connect Four or Find Four). Ibuildings provided the gaming field and the abstract player class that everyone needed to extend, and the competitors provided the rest.  This post announces the winners and makes some observations based on the submissions we received.</p>
<h3>Tournament key rules</h3>
<ul>
<li>If a player attempts to make any illegal move, they will automatically lose the match. Illegal moves are trying to insert a disc into a column that's full, or trying to insert a disc into a column that doesn't exist.</li>
<li>To keep things fair for everybody, we created 3 categories based on your PHP experience (0-2 years experience, 2-4 years experience, 4+ years experience).</li>
<li>Points were awarded in the following way:
<ul>
<li>3 points for a win</li>
<li>1 point for a tie</li>
<li>no points for a lose</li>
</ul>
</li>
</ul>
<p></p>
<h3>Let the Battle Commence</h3>
<p>Four in a Line as game has been mathematically solved and the advantage lies with the player taking the first turn. To level the playing field, we allowed each player to fight against all the others; in this way, any player had the chance to begin with the first move advantage playing against all the other opponents at least once, sharing the elements of luck and making it easier to spot skill. Each game was played on the official 7 x 6 grid on a basis of three rounds per game. At the end of each qualification session only the players with the highest score moved further in the tournament.<br />
<span id="more-3083"></span></p>
<h3>Competition Entries</h3>
<p>As usual we had 3 categories; Junior developers, Medium developers and Senior developers. In contrast to our previous challenges however, every single submission was successful, with every entry able to play the game within the rules successfully.</p>
<h3>Winners</h3>
<p>The competition is designed to be fun for the participants, but it is also good fun for us too and we have to say that the whole challenge has been very exciting and interesting.  We will comment on the trends we saw but first: <b>the winners</b>!</p>
<h4>Junior category</h4>
<p>In the Junior category we had only two submissions, their games played very fast (all less than 1 second) due to the simplicity of the algorithm implemented; despite this we have to say that the quality of the code was pretty good in this category.</p>
<p><b>Category Winner Junior</b>: Xavier Van Herpe</p>
<h4>Medium category</h4>
<p>We saw 4 submissions for this intermediate section and in general, the execution time increased.  There were plenty of fast games but the average time was about 3 minutes and 30 seconds. Code quality is increased and we started to see some advanced gaming logic and strategy. Players anticipated the play and picked moves with consideration for what their following move would be.</p>
<p>A <b>special mention</b> goes to Tobias Rojahn because with a relatively short implementation in terms of lines of code, his gamer played very well.</p>
<p><b>Category Winner Medium</b>: Piotr Mlocek</p>
<h4>Senior category</h4>
<p>This category for more experienced developers delivered a huge range of submissions, from a very interesting tiny implementation from Klaus Jorgensen, less than hundred lines, to the most complex and much larger proposal by Tomas Creemers. The longest game took exactly 04h 56m 09s on a 2.53Ghz Intel Core 2 Duo. Again we'd like to give a <b>special mention</b> in this category, this time to Tjado Maecke: his virtual player was the only one able to challenge our winner, scoring one win and a couple of draws.</p>
<p><b>Category Winner Senior</b>: Tomas Creemers</p>
<h3>Prizes</h3>
<p>Amongst all the winners, we raffled three prizes: 2 tickets to the <a href="http://www.phpconference.nl">Dutch PHP Conference</a> and an iPad. The prizes go as follows:</p>
<p><b>DPC tickets:</b> Xavier Van Herpe and Piotr Mlocek<br />
<b>iPad:</b> Tomas Creemers</p>
<p>Congratulations to all the winners!</p>
<h3>Observations</h3>
<p>In this challenge, we didn’t impose any strict restrictions regarding performance, code standards or time limits, the only rule was to play and win.  It was interesting to us to see how various programming practices varied across the submissions, and we think that it's important to remark on some basic but very important general notions as we saw it.</p>
<h4>Coding standards</h4>
<p>Whether you are new to PHP programming or a seasoned veteran you can benefit from following a set of coding standards. Such standards haven't always been a key area, but nowadays PHP reaches so many major projects and enterprise organisations that we'd expect to see these consistent standards everywhere the language is used.  Between the 14 developers in this challenge, we saw four general different coding styles plus several personal touches. Personal touch is acceptable in some settings, but a developer must remember that the code is going to be read by someone else and the reader should be comfortable with it.</p>
<p>We have a <a href="http://techportal.ibuildings.com/2009/10/12/usphp_code_sniffer/">previous article about PHP Code Sniffer</a> so check that out if you're looking for a tool to help you with standards. We also advise that one of the existing standards such as Zend or PEAR are better than inventing your own standard for code.</p>
<h4>Performance</h4>
<p>As developers, we often need to find a compromise between complexity and precision versus speed and approximation. We have seen a very good virtual player win and play ten times faster than others, and we also saw games that ran for many hours. As an example, when we ran some contests in simulation mode to see how the AI were working, we saw this scenario:<br />
<code><br />
. X X X . . O<br />
</code></p>
<p>The (X) player was the one supposed to make the next move and the AI took more than 10 minutes to decide what that move should be.  We understand the algorithm has been implemented to be good and successful but in a real scenarios the KISS approach would have helped a lot!</p>
<h3>Conclusions</h3>
<p>For us as organisers, this has been another fun challenge and we look forward to the next (watch this space!) We offer our warm congratulations to all our participants for such a high standard of submission, and especially to our winners who fought off some stiff competition to emerge victorious. Thanks to all of you and we hope you had as much fun as we did!</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F&amp;title=Ibuildings+Challenge%3A+Results" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F&amp;title=Ibuildings+Challenge%3A+Results" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F&amp;title=Ibuildings+Challenge%3A+Results" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F&amp;headline=Ibuildings+Challenge%3A+Results" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Ibuildings+Challenge%3A+Results&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Ibuildings+Challenge%3A+Results&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Ibuildings+Challenge%3A+Results&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Ibuildings+Challenge%3A+Results&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Ibuildings+Challenge%3A+Results&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F&amp;title=Ibuildings+Challenge%3A+Results&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F05%2F03%2Fibuildings-challenge-results%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/05/03/ibuildings-challenge-results/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>DPCRadio: Technical Writing</title>
		<link>http://techportal.ibuildings.com/2011/04/28/dpcradio-technical-writing/</link>
		<comments>http://techportal.ibuildings.com/2011/04/28/dpcradio-technical-writing/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 07:59:42 +0000</pubDate>
		<dc:creator>dpcradio</dc:creator>
				<category><![CDATA[DPCRadio]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[dpc10]]></category>
		<category><![CDATA[Elizabeth Naramore]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://techportal.ibuildings.com/?p=3068</guid>
		<description><![CDATA[Elizabeth Naramore If you've had an idea for writing a blog post or article, but you're not sure where to start, this talk is for you! Maybe you've had difficulty effectively documenting your code, or communicating your ideas to non-techies. This talk will help you, too! In this fun and informative session, we'll discuss the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Elizabeth Naramore</strong></p>
<p>If you've had an idea for writing a blog post or article, but you're not sure where to start, this talk is for you! Maybe you've had difficulty effectively documenting your code, or communicating your ideas to non-techies. This talk will help you, too! In this fun and informative session, we'll discuss the basics of writing and clear communication through the written word. We'll also talk about strategies for keeping your writing interesting and informative at the same time. Finally, we'll discuss resources for improving your writing skills in the future.</p>
<p>This session definitely loses something if you can't see Elizabeth's slides, so <a href="http://naramore.net/slides/DPC10-tech-writing.pdf">download them</a> and follow along</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F&amp;title=DPCRadio%3A+Technical+Writing" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F&amp;title=DPCRadio%3A+Technical+Writing" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F&amp;title=DPCRadio%3A+Technical+Writing" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F&amp;headline=DPCRadio%3A+Technical+Writing" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=DPCRadio%3A+Technical+Writing&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=DPCRadio%3A+Technical+Writing&amp;u=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=DPCRadio%3A+Technical+Writing&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=DPCRadio%3A+Technical+Writing&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=DPCRadio%3A+Technical+Writing&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F&amp;title=DPCRadio%3A+Technical+Writing&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Ftechportal.ibuildings.com%2F2011%2F04%2F28%2Fdpcradio-technical-writing%2F" ><img class="lightsocial_img" src="http://techportal.ibuildings.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://techportal.ibuildings.com/2011/04/28/dpcradio-technical-writing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://dpcradio.s3.amazonaws.com/2010_018.mp3" length="78566583" type="audio/mpeg" />
		</item>
	</channel>
</rss>

