<?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>Dereferenced.com &#187; Metaprogramming</title>
	<atom:link href="http://www.dereferenced.com/tags/metaprogramming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dereferenced.com</link>
	<description>A preponderance of Perl, an excess of XML, and additional alliterations.</description>
	<lastBuildDate>Tue, 17 Jan 2012 17:18:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Embracing the Ungulate</title>
		<link>http://www.dereferenced.com/2009/09/16/embracing-the-ungulate/</link>
		<comments>http://www.dereferenced.com/2009/09/16/embracing-the-ungulate/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 19:00:12 +0000</pubDate>
		<dc:creator>rjray</dc:creator>
				<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Metaprogramming]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Moose]]></category>

		<guid isPermaLink="false">http://www.dereferenced.com/?p=57</guid>
		<description><![CDATA[It&#8217;s long past time I started learning Moose. I have a CPAN module (WebService::ISBNDB) that currently uses Class::Std to do the inside-out object thing, so converting it to Moose would be the perfect candidate for a &#8220;learning experience&#8221;. Can anyone recommend some online resources (tutorials, blog posts, etc.) that resemble what I&#8217;ll be trying to [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s long past time I started learning <a href="http://search.cpan.org/dist/Moose">Moose</a>. I have a CPAN module (<a href="http://search.cpan.org/dist/WebService-ISBNDB">WebService::ISBNDB</a>) that currently uses <a href="http://search.cpan.org/dist/Class-Std">Class::Std</a> to do the inside-out object thing, so converting it to Moose would be the perfect candidate for a &#8220;learning experience&#8221;.</p>
<p>Can anyone recommend some online resources (tutorials, blog posts, etc.) that resemble what I&#8217;ll be trying to do&#8230; i.e., go from a less-favorable inside-out solution to Moose? All pointers greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dereferenced.com/2009/09/16/embracing-the-ungulate/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Muscle Memory, Part 1: The Strain of Repetitiveness</title>
		<link>http://www.dereferenced.com/2009/09/03/muscle-memory-part-1-strain-repetitiveness/</link>
		<comments>http://www.dereferenced.com/2009/09/03/muscle-memory-part-1-strain-repetitiveness/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 17:05:23 +0000</pubDate>
		<dc:creator>rjray</dc:creator>
				<category><![CDATA[Metaprogramming]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.dereferenced.com/?p=44</guid>
		<description><![CDATA[Earlier this morning, I worked a bit on my (other) hobby. Specifically, I fired up my airbrush[1] and painted the road wheels for a WWII Soviet tank that I&#8217;m working on. Ask any modeler who builds armor subjects (assuming you know any, other than myself) and odds are that the road wheels are their least-favorite [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this morning, I worked a bit on <a href="http://www.svsm.org">my (other) hobby</a>. Specifically, I fired up my airbrush<sup>[1]</sup> and painted the road wheels for a WWII Soviet tank that I&#8217;m working on.</p>
<p>Ask any modeler who builds armor subjects (assuming you know any, other than myself) and odds are that the road wheels are their least-favorite part of the model. They&#8217;re numerous, and worst of all, they&#8217;re numbingly repetitive. For this model, I had a total of 36 wheels to paint: on each side of the tank there are 12 road wheels in 6 pairs, plus 3 pairs of smaller wheels that act as return-rollers (keeping the tread from sagging too close to the tops of the road wheels) for a total of 18 per side. For some tank designs, the wheels are fairly simple, smooth affairs that are easy to paint. These, however, had a lot of tight corners and angles that I had to work the paint into. To be fair, this is not the worst-case I&#8217;ve dealt with; some years back I built a <a href="http://www.achtungpanzer.com/panzerkampfwagen-35t.htm">Panzerkampfwagen 35(t)</a>, which sports a numbing total of 24 wheels per side. At least those wheels were easier to paint than this morning&#8217;s were.</p>
<p>But it got me thinking about repetitive activity, and how it crops up in my coding. Like most dutiful Perl programmers, I use the &#8220;strict&#8221; and &#8220;warnings&#8221; pragmas almost religiously. I even set up templates in editors when and where I can, to ensure that these are always present in my modules. (Well, the use of &#8220;warnings&#8221; is a little more recent, so I still have some older code on CPAN that lacks the pragmata.)</p>
<p>Some would look at my repetitive use of these, and point out the recent addition to CPAN, <a href="http://search.cpan.org/dist/common-sense/"><code>common::sense</code></a>. In many ways, this is a useful tool. But it suffers from some drawbacks:</p>
<ul>
<li> It isn&#8217;t part of the core, so it would be an additional dependency.</li>
<li>It includes features that are specific to 5.10, so if you&#8217;re trying to maintain compatibility for older Perls, it isn&#8217;t an option.</li>
<li>Most of all, it hides too much of what is being done.</li>
</ul>
<p>That last point is the most salient to me (that, and the fact that I have modules being used by large-ish projects that are still using 5.6.1). People sometimes talk about &#8220;self-documenting&#8221; code, code that is very clear in its purpose just from reading it. Truly, a name like &#8220;common::sense&#8221; is pretty clear. What isn&#8217;t as clear is what the author defines as &#8220;common sense&#8221;, and whether that matches your definition of such. The pragma-module <em>does</em> do its thing fast and with less memory usage than loading the individual parts does. But the user has to ask themselves if their code is clearer and more self-documenting with or without it.</p>
<p>As programmers, we loathe repeating ourselves. We program our editors with cut-and-paste and macro-definition capabilities, just to save a few keystrokes here and there. But we also often find ourselves committing bug-fixes to our repositories with a commit-message that is some variation of &#8220;cut/paste error&#8230; oops!&#8221;</p>
<p>In reasonable, small doses, repeating yourself can be an acceptable thing. Some people in my hobby clean their airbrushes by just running paint thinner through until it comes out clear. But I disassemble and carefully clean mine after every use, even if I plan on immediately loading another color and using it again. A friend in my <a href="http://www.ipmsdenverrobwolf.org/">hobby club back in Denver</a> once said that he does that for the simple reason that the 5 minutes or so that it takes lets him rest his mind and refocus his thoughts on what his next steps are going to be.</p>
<p>When I start a new module or application, putting in the repetitive parts (even if it means only loading a template and making small adjustments) helps me narrow my focus from the project as a whole, down to this one file in particular that I&#8217;m about to work on. So, maybe repeating yourself isn&#8217;t always a bad thing.</p>
<p>(<strong>Edit:</strong> This entry is not meant as a critique of common::sense, but rather an argument that repeating oneself is not always a bad thing.)</p>
<p><sup>[1]</sup> Before anyone asks: no, I can&#8217;t do any custom work for your car or motorcycle. I lack the skill at this point, and my airbrushes are designed for working with model paints. The lacquers one uses for automotive work would be hard on the internal workings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dereferenced.com/2009/09/03/muscle-memory-part-1-strain-repetitiveness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

