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

<channel>
	<title>Laughing Meme &#187; patterns</title>
	<atom:link href="http://laughingmeme.org/tag/patterns/feed/" rel="self" type="application/rss+xml" />
	<link>http://laughingmeme.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 29 Jan 2012 21:54:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Yuiblog: Patterns for Designing a Reputation System</title>
		<link>http://laughingmeme.org/2008/06/11/yuiblog-patterns-for-designing-a-reputation-system/</link>
		<comments>http://laughingmeme.org/2008/06/11/yuiblog-patterns-for-designing-a-reputation-system/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:07:50 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://laughingmeme.org/?p=3887</guid>
		<description><![CDATA[Excellent, pragmatic, Christopher Alexander style patterns for building online community. With really cute graphic.]]></description>
			<content:encoded><![CDATA[<p>Excellent, pragmatic, Christopher Alexander style patterns for building online community.  With really cute graphic.</p>
<p><a href='http://yuiblog.com/blog/2008/06/10/patterns-for-designing-a-reputation-system/'>http://yuiblog.com/blog/2008/06/10/patterns-for-designing-a-reputation-system/</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2008/06/11/yuiblog-patterns-for-designing-a-reputation-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>r0ml.net: History teaches us &#8230;</title>
		<link>http://laughingmeme.org/2007/09/10/r0mlnet-history-teaches-us/</link>
		<comments>http://laughingmeme.org/2007/09/10/r0mlnet-history-teaches-us/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 15:19:49 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tier]]></category>

		<guid isPermaLink="false">http://laughingmeme.org/2007/09/10/r0mlnet-history-teaches-us/</guid>
		<description><![CDATA[r0ml explores the secret Catholic bias present in Java enterprise development. (in case the hair shirts weren&#8217;t a dead giveaway)]]></description>
			<content:encoded><![CDATA[<p>r0ml explores the secret Catholic bias present in Java enterprise development.  (in case the hair shirts weren&#8217;t a dead giveaway)</p>
<p><a href='http://r0ml.net/blog/2007/09/08/history-teaches-us'>http://r0ml.net/blog/2007/09/08/history-teaches-us</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2007/09/10/r0mlnet-history-teaches-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shirky:  A Pattern Language for Moderation Strategies</title>
		<link>http://laughingmeme.org/2006/03/09/shirky-a-pattern-language-for-moderation-strategies/</link>
		<comments>http://laughingmeme.org/2006/03/09/shirky-a-pattern-language-for-moderation-strategies/#comments</comments>
		<pubDate>Thu, 09 Mar 2006 17:16:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[clay shirky]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[participation]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[reputation]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=3285</guid>
		<description><![CDATA[I love pattern languages, and this is an excellent start. E.g. main problems with community can be addressed by MakeIdentityValuable]]></description>
			<content:encoded><![CDATA[<p>I love pattern languages, and this is an excellent start. E.g. main problems with community can be addressed by <a href="http://social.itp.nyu.edu/shirky/wiki/?n=Main.MakeIdentityValuable">MakeIdentityValuable</a></p>
<p><a href='http://social.itp.nyu.edu/shirky/wiki/'>http://social.itp.nyu.edu/shirky/wiki/</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2006/03/09/shirky-a-pattern-language-for-moderation-strategies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fowler adds &#8220;rought cut&#8221; patterns on event collaboration and accounting to PoEAA</title>
		<link>http://laughingmeme.org/2006/01/26/fowler-adds-rought-cut-patterns-on-event-collaboration-and-accounting-to-poeaa/</link>
		<comments>http://laughingmeme.org/2006/01/26/fowler-adds-rought-cut-patterns-on-event-collaboration-and-accounting-to-poeaa/#comments</comments>
		<pubDate>Thu, 26 Jan 2006 19:31:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[fowler]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=3220</guid>
		<description><![CDATA[See also Pattern Oriented Softare Arch., vol 2 for good enterprise event patterns]]></description>
			<content:encoded><![CDATA[<p>See also <a href="http://www.amazon.com/gp/product/0471606952/104-8840841-5744769?v=glance&amp;n=283155">Pattern Oriented Softare Arch., vol  2</a> for good enterprise event patterns</p>
<p><a href='http://martinfowler.com/eaaDev/'>http://martinfowler.com/eaaDev/</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2006/01/26/fowler-adds-rought-cut-patterns-on-event-collaboration-and-accounting-to-poeaa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session &#8220;Flash&#8221; in PHP</title>
		<link>http://laughingmeme.org/2005/12/07/session-flash-in-php/</link>
		<comments>http://laughingmeme.org/2005/12/07/session-flash-in-php/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 07:03:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=3147</guid>
		<description><![CDATA[Doing some PHP hacking tonight, I was missing Rails&#8217; &#8220;flash&#8221;. So I coded up a quick and dirty implementation of the read-once session status notification pattern. The code]]></description>
			<content:encoded><![CDATA[<p>Doing some PHP hacking tonight, I was missing Rails&#8217; &#8220;flash&#8221;.  So I coded up a quick and dirty implementation of the read-once session <a href="http://blog.ianbicking.org/web-application-patterns-status-notification.html">status notification pattern</a>.  <a href="http://laughingmeme.org/code/flash.inc.php.txt">The code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/12/07/session-flash-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>As Seen in the Inbox</title>
		<link>http://laughingmeme.org/2005/11/30/as-seen-in-the-inbox/</link>
		<comments>http://laughingmeme.org/2005/11/30/as-seen-in-the-inbox/#comments</comments>
		<pubDate>Wed, 30 Nov 2005 23:40:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[ai]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[speculation]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=3127</guid>
		<description><![CDATA[my eastern reversible destiny; ebullient barnacle turkey y propitious zeiss novice, coverlet upsilon mausoleum remiss optoelectronic emblematic irritant sesame morphology. ambrosia shim grunt switchblade filigree gait amino caleb duration budge embargoes allied Random gibberish, and yet 100,000 years of pattern matching expertise refuses to let it go that easily, finding primordial poetry, and humor. Has [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>my eastern reversible destiny; ebullient barnacle turkey y propitious zeiss novice, coverlet upsilon mausoleum remiss optoelectronic emblematic irritant sesame morphology. ambrosia shim grunt switchblade filigree gait amino caleb duration budge embargoes allied </p>
</blockquote>

<p>Random gibberish, and yet 100,000 years of pattern matching expertise refuses to let it go that easily, finding primordial poetry, and humor.  </p>

<p>Has anyone wondered what the extreme, cut throat Darwinian pressure of the spam wars might be evolving? </p>

<p>And what kind of AI could such a crucible produce I wonder?  Vicious and deceptive?  Slippery, polymorphic and rentless?  Recent samples seem to suggest a cryptic, Delphian source of Zen koans.</p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/11/30/as-seen-in-the-inbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Runt &#8211; Ruby Temporal Expressions</title>
		<link>http://laughingmeme.org/2005/11/25/runt-ruby-temporal-expressions/</link>
		<comments>http://laughingmeme.org/2005/11/25/runt-ruby-temporal-expressions/#comments</comments>
		<pubDate>Sat, 26 Nov 2005 05:45:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[calendaring]]></category>
		<category><![CDATA[fowler]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=3122</guid>
		<description><![CDATA[an implementation of select temporal patterns by Martin Fowler]]></description>
			<content:encoded><![CDATA[<p>an implementation of select temporal patterns by Martin Fowler</p>
<p><a href='http://runt.rubyforge.org/'>http://runt.rubyforge.org/</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/11/25/runt-ruby-temporal-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lay out of a PHP application</title>
		<link>http://laughingmeme.org/2005/03/15/lay-out-of-a-php-application/</link>
		<comments>http://laughingmeme.org/2005/03/15/lay-out-of-a-php-application/#comments</comments>
		<pubDate>Tue, 15 Mar 2005 20:11:17 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2864</guid>
		<description><![CDATA[Solid advice. I do it a little differently (more structure), but following this advice will make your app better, and make you a better programmer]]></description>
			<content:encoded><![CDATA[<p>Solid advice.  I do it a little differently (more structure), but following this advice will make your app better, and make you a better programmer</p>
<p><a href='http://www.phpguru.org/static/ApplicationStructure.html'>http://www.phpguru.org/static/ApplicationStructure.html</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/03/15/lay-out-of-a-php-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rafe  recommends &#8220;Head First Design Patterns&#8221;</title>
		<link>http://laughingmeme.org/2005/02/15/rafe-recommends-head-first-design-patterns/</link>
		<comments>http://laughingmeme.org/2005/02/15/rafe-recommends-head-first-design-patterns/#comments</comments>
		<pubDate>Tue, 15 Feb 2005 22:23:02 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[ora]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[rafe]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2819</guid>
		<description><![CDATA[I&#8217;ve been boycotting it due to the cover]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been boycotting it due to the cover</p>
<p><a href='http://rc3.org/cgi-bin/less.pl?arg=6774'>http://rc3.org/cgi-bin/less.pl?arg=6774</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2005/02/15/rafe-recommends-head-first-design-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UI Patterns and Techniques</title>
		<link>http://laughingmeme.org/2004/09/20/ui-patterns-and-techniques/</link>
		<comments>http://laughingmeme.org/2004/09/20/ui-patterns-and-techniques/#comments</comments>
		<pubDate>Tue, 21 Sep 2004 05:02:08 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2547</guid>
		<description><![CDATA[Its all about patterns]]></description>
			<content:encoded><![CDATA[<p>Its all about patterns</p>
<p><a href='http://time-tripper.com/uipatterns/index.php'>http://time-tripper.com/uipatterns/index.php</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/09/20/ui-patterns-and-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resign Patterns &#8211; Ailments of Unsuitable Project-Disoriented Software</title>
		<link>http://laughingmeme.org/2004/08/25/resign-patterns-ailments-of-unsuitable-project-disoriented-software/</link>
		<comments>http://laughingmeme.org/2004/08/25/resign-patterns-ailments-of-unsuitable-project-disoriented-software/#comments</comments>
		<pubDate>Wed, 25 Aug 2004 22:02:15 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2488</guid>
		<description><![CDATA[I&#8217;m using the Brig pattern right now.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using the Brig pattern right now.</p>
<p><a href='http://www.agcs.com/supportv2/techpapers/patterns/papers/respat.htm'>http://www.agcs.com/supportv2/techpapers/patterns/papers/respat.htm</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/08/25/resign-patterns-ailments-of-unsuitable-project-disoriented-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL, and the CASE for Class Table Inheritance</title>
		<link>http://laughingmeme.org/2004/08/14/mysql-and-the-case-for-class-table-inheritance/</link>
		<comments>http://laughingmeme.org/2004/08/14/mysql-and-the-case-for-class-table-inheritance/#comments</comments>
		<pubDate>Sun, 15 Aug 2004 01:08:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[case]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[eaa]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[Longer]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=883</guid>
		<description><![CDATA[At work we&#8217;re using Class Table Inheritance to model the core data structures of our as yet nameless open source CRM. (actually it has a code name, but I don&#8217;t like it, so we&#8217;ll pretend it&#8217;s nameless) This week as I learned both the name of this pattern, and the SQL to implement it efficiently [...]]]></description>
			<content:encoded><![CDATA[<p>
At <a href="http://groundspring.org">work</a> we&#8217;re using <a href="http://martinfowler.com/eaaCatalog/classTableInheritance.html">Class Table Inheritance</a> to model the core data structures of our as yet nameless open source <acronym title="Community Relationship Management">CRM</acronym>. (actually it has a code name, but I don&#8217;t like it, so we&#8217;ll pretend it&#8217;s nameless)  
</p>

<p><p>
This week as I learned both the name of this pattern, and the SQL to implement it efficiently in MySQL I thought I&#8217;d share some notes on what we&#8217;ve come up with.
</p>
<span id="more-883"></span>
<p>
<h3>Class Table Inheritance</h3>
<acronym title="Class Table Inheritance">CTI</acronym> is a pattern where your schema  hews closely to the your class hierarchy &#8212; you have a table for each class, and object attributes are stored as columns in the table for that class.  This is as opposed to <a href="http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html">Single Table Inheritance</a>, which stores all attributes for every member of an inheritance tree in a single table, or <a href="http://www.martinfowler.com/eaaCatalog/concreteTableInheritance.html">Concrete Table Inheritance</a> which duplicates the inherited fields to each table.
</p>
<p>
We&#8217;re using CTI for a number of reasons, some excellent, and some because that is how our brains work.  One key benefit is we get the ability to operate on heterogenous collections of object. (i.e. display a sorted list of contact objects irrespective of whether they are individuals, organizations, etc.)  The fact that something as fundamental as polymorphism can be difficult to accomplish using other O/R techniques hilights the general difficulty and <a href="http://www.google.com/search?q=impedance+mismatch" title="6 of the first 10 results are about O/R">impedance mismatch</a> of object to relational mapping.
</p>
<p>
There are, however a few challenges involved. 
</p>
<p>
<h3>The Model</h3>
But quickly a trivial mock up of the data model to give us something to play with.  In this model we have 3 classes, a base Contact class, and 2 types of contacts Individual and Organization which inherit from Contact.  In the database we model this as a Contact table, with a primary id, and any fields which the Contact the parent class provides.  Individual and Organization each get their own table, with class specific attributes, plus the primary id from Contact which is both the primary id, and a foreign key into Contact.  For every contact stored in the database there is a record in the Contact table, and a record in either Individual or Organization.
</p>
<p>
<img src="http://laughingmeme.org/img/simple_contact_model.gif" />
</p>
<p>
<h3>Challenge 1:</h3>
How do you retrieve your data now that it is broken across multiple tables?  The obvious (and obviously wrong) solution would be to first select against the Contact table, examine the resulting data, and select against the appropriate children tables. (remember this example is a drastically simplified data model)
</p>
<p>
<h3>Solution 1:</h3>
My current solution is to do a 3 way left outer join, and then instantiate the objects out of fields which aren&#8217;t null.  It can look a bit ugly with large numbers of columns, but is actually pretty simple, and initial benchmarks against a test data set of 1.3 million records suggests it scales nicely.</p>

<pre>
SELECT 
  c.id as id, c.contactType,
  i.firstName, i.lastName,
  o.name as orgName
FROM
  Contact as c
LEFT JOIN Individual as i ON i.id = c.id 
LEFT JOIN Organization as o ON o.id = c.id
</pre>

<p>(And it&#8217;s pretty easy to coax the necessary SQL out of our modified version of <a href="http://pear.php.net/package/DB_DataObject">DB_DataObject</a>. I&#8217;ll demonstrate that in a future entry)
</p>
<p>
<h3>Challenge 2:</h3>
One of the good reasons (in fact the only concrete one I&#8217;ve given you) to go with CTI and its potential added complexity is the desire to sort a mixed list of contact types.   But what do you do when you want to sort on an amorphous concept like &#8220;Name&#8221;?  Individual might sort by &#8220;Lastname, Firstname&#8221;, while we just use &#8220;orgName&#8221; for an organization.  Where is our polymorphism now?
</p>
<p>
One solution would be select all known records, and do sorting and slicing at the application level.  (This is so wrong it makes my head hurt)  Another solution would be store a field like &#8220;sortName&#8221; on Contact, which you could calculate and save on inserts and updates.  This is on the right track.
</p>
<p>
<h3>Solution 2:</h3>
The solution (which <a href="http://blogs.onenw.org/carl">Carl</a> clued me into while we waited to get into the zoo), is to use the <a href="http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html">SQL CASE statement</a> to calculate &#8220;sortName&#8221; on the fly.  Below is our SQL from below with the new logic in green.</p>

<pre>
SELECT 
  c.id as id, c.contactType,
  i.firstName, i.lastName,
  o.name as orgName<span style="color:green;">,
CASE 
 WHEN c.contactType = 'Individual' THEN CONCAT(i.lastName, i.firstName)
 WHEN c.contactType = 'Organization' THEN o.name
END as sortName</span>
FROM
  Contact as c
LEFT JOIN Individual as i ON i.id = c.id 
LEFT JOIN Organization as o ON o.id = c.id
<span style="color:green;">ORDER by sortName</span>
</pre>

<p></p>
<p>
This simply adds a switch statement to your field list conditionally setting the value of sortName.
</p>
<p>
There is nothing quite so satisfying as finding the right tool for the right job.  I&#8217;m currently totally in love with the CASE statement, and think everyone should know about it. (hence this bit of evangelism)
</p>
<p>
Tip: don&#8217;t forget that &#8216;,&#8217; after orgName, I keep forgetting it and wondering why my SQL isn&#8217;t working.
</p>
<p>
So concludes today&#8217;s edition of &#8220;Enterprise Development with MySQL&#8221; (&#8220;Kellan Learns SQL&#8221; didn&#8217;t sound as impressive).  In the near future I hope to get a chance to write up some of the PHP libs we&#8217;ve been building/modifying to support object rich web development techniques, completing the picture. (<acronym title="Objects Linux Apache MySQL PHP">OLamp</acronym> anyone?)
</p>
<p>
<h3>Mixing Metaphors</h3>
Single, and Concrete <acronym title="Table Inheritance">TI</acronym> both have their places, and the good news is you can mix these patterns without much difficulty.  Still I&#8217;m happy with both the flexibility and &#8220;OO-ness&#8221; of Concrete Table Inheritance, and once again impressed by the speed, and power of MySQL. (N.B. we&#8217;re targeting 4.1.x, but these above examples all work with 4.0.16 and 4.0.20)
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/08/14/mysql-and-the-case-for-class-table-inheritance/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Single Table Inheritance</title>
		<link>http://laughingmeme.org/2004/08/07/single-table-inheritance/</link>
		<comments>http://laughingmeme.org/2004/08/07/single-table-inheritance/#comments</comments>
		<pubDate>Sun, 08 Aug 2004 06:49:19 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[eaa]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2447</guid>
		<description><![CDATA[The power of naming, transmuting bad relational design into a legitimate enterprise pattern.]]></description>
			<content:encoded><![CDATA[<p>The power of naming, transmuting bad relational design into a legitimate enterprise pattern.</p>
<p><a href='http://martinfowler.com/eaaCatalog/singleTableInheritance.html'>http://martinfowler.com/eaaCatalog/singleTableInheritance.html</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/08/07/single-table-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>class HelloWorldEmphasizer extends HelloWorldDecorator</title>
		<link>http://laughingmeme.org/2004/04/15/class-helloworldemphasizer-extends-helloworlddecorator/</link>
		<comments>http://laughingmeme.org/2004/04/15/class-helloworldemphasizer-extends-helloworlddecorator/#comments</comments>
		<pubDate>Fri, 16 Apr 2004 00:47:45 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Aside]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=2211</guid>
		<description><![CDATA[Hello world in Patterns, a cautionary tale]]></description>
			<content:encoded><![CDATA[<p>Hello world in Patterns, a cautionary tale</p>
<p><a href='http://www.phppatterns.com/index.php/article/articleview/103'>http://www.phppatterns.com/index.php/article/articleview/103</a></p>]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/04/15/class-helloworldemphasizer-extends-helloworlddecorator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grooving Up Slowly</title>
		<link>http://laughingmeme.org/2004/03/17/grooving-up-slowly/</link>
		<comments>http://laughingmeme.org/2004/03/17/grooving-up-slowly/#comments</comments>
		<pubDate>Wed, 17 Mar 2004 19:24:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[boston]]></category>
		<category><![CDATA[ice.cream]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[seattle]]></category>
		<category><![CDATA[ted.leung]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=768</guid>
		<description><![CDATA[I finally made it a SeaJUG meeting last night, Ted Leung speaking on Groovy proved to be an irresistible draw (and I was in town for once). This was also my first venture across the 520 bridge, into deepest, darkest suburbia (Bellevue). Wilhelm and Ted took pity on my carless state, and were great company [...]]]></description>
			<content:encoded><![CDATA[<p>I finally made it a <a href="http://www.seajug.org/">SeaJUG</a> meeting last night, <a href="http://www.sauria.com/blog/">Ted Leung</a> speaking on <a href="http://groovy.codehaus.org/">Groovy</a> proved to be an irresistible draw (and I was in town for once).  This was also my first venture across the 520 bridge, into deepest, darkest suburbia (Bellevue).  Wilhelm and Ted took pity on my carless state, and were great company</p>

<p><a href="http://www.seajug.org/">SeaJUG</a> is a great group; smart, friendly, and intellectually curious.  There are several vibrant subgroups including a Scheme group, a GoF study group, a regular language agnostic pair programming night, and a new Eclipse group (first meeting is first Tuesday in April, and I&#8217;ll be out of town, bah).  I can also see that it would be an intimidating group to present to, especially bullshit, and this was confirmed by quiet evil laughter describing their last vendor visit.
<h3>Groovy</h3></p>

<p><a href="http://groovy.codehaus.org/">Groovy</a> has fascinated me since I first heard of it.  I&#8217;m a dedicated &#8220;scripting&#8221; language hacker.  Life is too short, and there are too many interesting problems to solve to slave away in the service of the compiler.  And yet I&#8217;ve definitely felt the pull for more rigor and structure at times (generally when I was having to work with someone else&#8217;s code).  Much of Perl works by consensus, I agree to call a method just so, and you agree not to muck with my internal variables (or the symbol table).  Java works by locks (and shotguns, according to Larry Wall).  Groovy provides a gradient, I can be as dynamic, and loose, and experimental as I want, or as locked down and precise, and I can change my mind, over time, about which way to go.</p>

<p>Groovy is a Java compatible, dynamic language, built on the JVM.  You can pare it down to something it will make a Perl programmer pause (no classes, no methods, objects defined at runtime as closures, no semicolons), or add structure, type declarations, and all sorts of baggage all the way up to Java itself.  Code can be run interactively, or can be compiled to Java bytecode.  (one wag even suggested you could write Groovy, compile, and then use a decompiler to get your Java code.  This is not recommended)  </p>

<p>The Groovy developers have done a lot of work adding the syntactic sugar which makes scripting languages fun.  Primitives are auto-boxed, and collections have been instrumented with a variety of useful methods that will make your functional programmers feel right at home.  They&#8217;ve also been building some powerful domain specific constructs for operating on tree structures (XML/<a href="http://ant.apache.org/">Ant</a>/GUI widgets), building web pages (as ugly as PHP on a bad day, should make it popular!), and marshalling data into and out a relational DB.  And lastly they address the other thing life is too short for, reinventing the wheel (especially as they seem to get more square each time).  Because Groovy is compiling down to Java bytecode you have total, native access to many many high quality Java libraries.</p>

<p>See <a href="http://www.sauria.com/presentations/Groovy%20SeaJUG%202004-03.ppt.pdf">Ted&#8217;s slides</a>. (understanding of closures is <em>highly</em> recommended)</p>

<h3>Would I Use It?</h3>

<p>Not this month.  Not next month either.  The syntax is still somewhat influx (if you&#8217;re a language hacker, that makes now a great time to get involved), and there were part which seemed either undefined or ambigous never a good thing in a programming language.  There also feels like there has been a lack of discipline, too many special cases in the syntax, and a sense that the designers are kids in a candy shop running amok borrowing syntax from all their favorite languages.  Still I&#8217;m excited about it.  Its about 6 months old.  I think 6 more months will tell us how successful its going to be.</p>

<h3>Ted</h3>

<p>Ted is as smart, interesting, and informed as you would expect him to be reading his <a href="http://www.sauria.com/blog">blog</a>.  He kept his cool in the face of <a href="http://www.sauria.com/blog/2004/03/16#864">hardware trouble</a>, and a large contingent of the audience who weren&#8217;t buying it.  As Ted said, &#8220;to fully buy into Groovy, you have to buy into some assumptions about how software should be developed, which is philosophical bordering on religious.&#8221;  He is talking about agile software development, which I occasionally forget still has its detractors, and its unintiated.</p>

<h3>Rabble Rousing</h3>

<p>He ended by addressing the fact that much of programming is mechanical, and that far from happening accidentally, or improving over time this trend is getting worse.  With top heavy, byzantine architectures like EJB, or the ever deepening W3C XML stack, you see the work of the large technology vendors who are interested in keeping entry difficult, work rote (and therefore cheaply offshore-able), and profits up.  As he ended with &#8220;the big corporations are going to solve this for you, we need to solve this for ourselves&#8221; I had a brief moment of cognitive dissonance as my worlds collided and I couldn&#8217;t remember if I was at an anti-globalization meeting, or a software users group.  This is the sort of stuff people should at least bring up at the next <a href="http://cats.protest.net">CATS</a> meeting.</p>

<h3>Chandler</h3>

<p>It was fascinating to get an inside update on <a href="http://www.osafoundation.org/Chandler_Compelling_Vision.htm">Chandler</a>, a project I&#8217;ve watched with fascination since its early days. (Thankfully I&#8217;ve got a job I&#8217;m very happy with, and so I didn&#8217;t have to embarrass myself by pumping him for contacts as the <a href="http://www.osafoundation.org/">OSAF</a>.)  I&#8217;m looking forward to Mitch Kapor&#8217;s keynote at next week&#8217;s <a href="http://www.python.org/pycon/dc2004/">PyCon</a> (not that I&#8217;ll be attending)</p>

<h3>Mixins</h3>

<p>And he addressed the problem I&#8217;ve always had with mixins. (recently reinvented by the AOP crowd apparently as &#8220;static cross cutting&#8221;)  You see when I hear mixins the first thing I think about (or the second, after I think about too many late nights struggling with Mailman) is ice cream from <a href="http://www.herrells.com/">Herrell&#8217;s</a>.  Herrell&#8217;s is a Boston (and Northampton) ice cream shop that will pound your ice cream out flat, mix all sorts of wonderful things into it, and roll it up again.  Turns out that that <b>is</b> the origin of the term.  Back when it was Steve&#8217;s and the MIT hackers were working on the original Lisp machine.  Wow.</p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2004/03/17/grooving-up-slowly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Development with Perl.</title>
		<link>http://laughingmeme.org/2002/09/10/web-development-with-perl/</link>
		<comments>http://laughingmeme.org/2002/09/10/web-development-with-perl/#comments</comments>
		<pubDate>Wed, 11 Sep 2002 01:19:00 +0000</pubDate>
		<dc:creator>Kellan</dc:creator>
				<category><![CDATA[Longer]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[state.of.the.art]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://lm.quxx.info/?p=145</guid>
		<description><![CDATA[In preparation for doing the Protest.net re-write I&#8217;m doing some research on web frameworks. I find myself rewriting the same central dispatcher code, adding refinements, like a redirect method (similiar to the forward() method in servlets) and in general missing some of the refinements of Java&#8217;s web environments (servlets, Struts, bundles for i18n) while refusing [...]]]></description>
			<content:encoded><![CDATA[<p>
In preparation for doing the Protest.net re-write I&#8217;m doing some research on web
frameworks.  I find myself rewriting the same central dispatcher code, adding
refinements, like a redirect method (similiar to the forward() method in
servlets) and in general missing some of the refinements of Java&#8217;s web
environments (servlets, <a href="http://jakarta.apache.org/struts/index.html">
Struts</a>, bundles for i18n) while refusing to give up
Perl, CPAN, and <a href="http://www.tt2.com">Template Toolkit</a>.
</p>

<p><p></p>

<p>This is my brain dump so far.  Lots of questions, a few answers. The next step will be firing up the text editor
and looking under the hood.
</p>
<p>
<h3>Steal from the Best</h3>
Applications I&#8217;m going to examine for ideas to steal, particularily framework
ideas (error handling, inner loop, etc.)</p>

<ul>
<li><a href="http://moveabletype.org">Moveable Type</a> &#8211; in my few glaces at
the code its seemed intelligent, and well structured.  Runs under mod_perl and
CGI, handles some complex UI demands like pages that use redirects to update
progress bars, and re-entrant forms.</li>
<li><a href="http://bricolage.cc">Bricolage</a> &#8211; based on Mason, I&#8217;ve been
hearing good things about this CMS, particular about its clever <em>Burners</em>
abstraction, hope to find other good things under the hood.  Don&#8217;t really know
much about <a href="http://masonhq.com">Mason</a>, not sure if that is going to
be barrier</li>
<li><a href="http://fsck.com/projects/rt">RT</a> &#8211; popular, mod_perl and Mason,
ticket tracking software. Also supports email, and command line interfaces.</li>
<li><a href="http://scoop.kuro5hin.org">Scoop</a> &#8211; haven&#8217;t looked at Scoop in a
while, but I remember it seemed well done (having just come from looking at
Slashcode 1.0), I wonder if it will stand the test of time.  Not expecting to
find anything all that relevant, but maybe.  Will probably do a quick skim of
the CMS parade: <a href="http://slashcode.com">Slash</a>, <a
href="http://everydevel.com/">Everything2</a>, and maybe <a
href="http://livejournal.com/developer/">LiveJournal</a>.  Definitely want to look at 
<a href="http://www.livejournal.com/developer/embedding.bml">LiveJournal&#8217;s embedding instructions.</a>
<li><b>??</b> Do you any Perl web applications you would consider examples of best
practices<b>??</b></li>
</ul>

<p></p>
<p>
<h3>Perl Frameworks</h3>
<ul>
<li><a href="http://www.openinteract.org">OpenInteract</a> seems popular, and uses
TT2, but leaves me cold, partially because I&#8217;m just not crazy about persistence
layers.  But I should probably spend some time looking at it.  <b>??</b> Any expirences using it <b>??</b>
</li>
<li>
<a href="http://www.masonhq.com">Mason</a> natively uses an embedded, page based
execution model, which seems PHP-like to me, but
<a href="http://masonhq.com/user/autarch/Comps_vs_modules">Design Issues with
Mason:  What are Components For?</a> seems to be simple guidelines for avoiding
the siren calls.  There is an Oreilly book coming out on it, which will be
<a href="http://masonbook.com">available online</a>, but the author says, <a
href="http://use.perl.org/comments.pl?sid=7183&#038;cid=12705">don&#8217;t expect it until
mid-October</a>.
</li>
<li>
<a href="http://wombat.sf.net">Wombat</a> is billed as an implementation of the
Servlet API in Perl, but I can find exactly zero reference to anyone using it,
never a good sign.
</li>
<li>
<a href="http://axkit.org">AxKit</a> is a web framework built along the lines of
Cocoon.  I bet there are seriously cool ideas to steal in there, but I&#8217;ve been
burned pretty badly playing with XSLT and don&#8217;t want to go back into that water
right now.
</li>
<li>
<a href="http://openframe.fotango.com/">OpenFrame</a> also seems interesting. 
It has the request and response objects ala servlets, and <a
href="http://use.perl.org/~acme">acme</a> is being paid to work on it, and it
has a &#8220;Slot&#8221; concept which seems similiar to Brico&#8217;s Burner concept, and
supports TT2.  However it bills itself as an &#8220;open source application framework
for distributed media applications.&#8221;  Which isn&#8217;t really what we are building.
</li>
<li>
A few others are listed at <a
href="http://perl.apache.org/products/app-server.html">Application Servers and
Toolkits based on mod<em>perl</a>.  Also,
<a href="http://perlmonks.org/index.pl?node=Web%20Application%20Frameworks%20and%20their%20Templating%20Engines%20with%20a%20Comparative%20Study%20of%20Template%20and%20HTML%3A%3ATemplate
">Web Frameworks and their Template Engines</a> is interesting.
</li>
<li>
Last time I was looking at this stuff there was 
<a href="http://snafu.wgz.org/chromatic/jellybean.html">JellyBean</a>, which no
longer seems maintained, and Iadio, which no longer exists.
</li>
<li>
I found a <a href="http://perlmonks.org/index.pl?node_id=157946">simple
home-rolled framework</a> that feels simliar to the one I did for <a
href="http://www.rockwoodleadership.org">Rockwood</a>.  It was mentioned in this
<a href="http://perlmonks.org/index.pl?node_id=157582">interesting thread</a>.
</li>
<li>
The book, <a href="http://www.globalspin.com/thebook/">Perl for the Web</a> from
New Riders, is freely available online and seems interesting if out of date.
</li>
</ul>
</p>
<h3>Piecemealing with Modules</h3>
<ul>
<li>
We&#8217;ll definitely be using <a href="http://www.template-toolkit.org">Template
Toolkit</a>.  Read Perrin&#8217;s <a
href="http://perl.apache.org/docs/tutorials/tmpl/comparison/comparison.html">classic
article on Template engines</a>. (the sequel to his classic article on 
<a
href="http://perl.apache.org/docs/tutorials/apps/scale_etoys/etoys.html">building
the eToys website</a>.)
</li>
<li>
 <a href="http://search.cpan.org/dist/Apache-Session/">Apache::Session</a> is a
 given.  Not finding a good webpage on it, but it has great POD.
 </li>
 <li>
 <a href="http://perl-cache.sf.net">Cache::Cache</a> is a given.  The Perl Cache
 project is one of those tools, like TT2, that makes you never want to leave
 Perl.
</li>
<li>
DBI is an of course, and I think we&#8217;ll be avoiding the DBIx namespace in favour
of having a peer layer with hand written SQL.
</li>
<li>
Many people are reccomending <a
href="http://search.cpan.org/dist/CGI-Application/">CGI::Application</a> as an
implementation of the central dispatchers.  An article on <a href="http://www.perl.com/lpt/a/2001/06/05/cgi.html
">using CGI::Application</a>, and on <a href="http://perlmonks.org/index.pl?node_id=142580
">using CGI::Application with Template Toolkit</a>.  I&#8217;ve looked at it before,
and it was simpler to roll my own, but I&#8217;m going to check it out again.  It runs cleanly under Apache::Registry, but isn&#8217;t really a full blown mod</em>perl app.
</li>
<li>
<a href="http://search.cpan.org/author/MARKSTOS/Data-FormValidator-1.11/lib/Data/FormValidator.pm">Data::FormValidator</a> is
recommended, and includes a <a
href="http://search.cpan.org/author/TBONE/Data-FormValidator-Tutorial-1.3/Tutorial.pm">tutorial</a>,
but some people prefer <a
href="http://search.cpan.org/author/FRAJULAC/FormValidator-0.11/HTML/FormValidator.pm">HTML::FormValidator</a>,
but I don&#8217;t really know what the difference is yet.  Hmmm, they look like they might actually be the same module.  <b>??</b> Any idea <b>??</b>
</li>
<li><b>??</b> Did I leave out your favorite module <b>??</b>
</ul>
</p>
<p>
<b>UPDATE</b>: After looking at the available options, and at 
<a href="http://www.theserverside.com/resources/article.jsp?l=Struts1_1">Struts 1.1</a>, I would go with Java if I didn&#8217;t know I would have an insurrection on my hands.
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://laughingmeme.org/2002/09/10/web-development-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

