<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Important Shock</title>
	<atom:link href="http://importantshock.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://importantshock.wordpress.com</link>
	<description>Because life's too short to use Perl.</description>
	<pubDate>Fri, 21 Mar 2008 19:04:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Duplicity and the Duplo Generation</title>
		<link>http://importantshock.wordpress.com/2008/03/21/duplicity-and-the-duplo-generation/</link>
		<comments>http://importantshock.wordpress.com/2008/03/21/duplicity-and-the-duplo-generation/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 16:57:27 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[rails rant coding response]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/?p=72</guid>
		<description><![CDATA[Matt Aimonetti, author of the Rails on the Run blog, recently posted a controversial article in which he asserted this belief that new Rails developers are being sabotaged by the multitude of pre-written and reliable components available to them:
The problem is that a generation of Rubyists has grown up being used to getting everything pre [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Matt Aimonetti, author of the <a href="http://railsontherun.com/">Rails on the Run</a> blog, recently posted a <a href="http://railsontherun.com/2008/3/17/rails-the-duplo-generation">controversial article</a> in which he asserted this belief that new Rails developers are being sabotaged by the multitude of pre-written and reliable components available to them:</p>
<blockquote><p>The problem is that a generation of Rubyists has grown up being used to getting everything pre written for them. They haven&#8217;t yet passed the &#8220;Duplo stage&#8221; and basically write applications putting a few blocks together, only writing 10 to 20% and barely understand 5%. </p></blockquote>
<p>Unfortunately, Matt is wrong - and not only that, but he&#8217;s being elitist.</p>
<p><a href="http://importantshock.files.wordpress.com/2008/03/fractal-wrongness.jpg" title="Fractal Wrongness"><img src="http://importantshock.files.wordpress.com/2008/03/fractal-wrongness.thumbnail.jpg" alt="Fractal Wrongness" /></a>
<p> OK, so maybe he&#8217;s not <i>that</i> wrong. But he&#8217;s definitely not correct. This line of thinking is harmful to the Rails community at large, and much more so than any clueless newbie could be. Though this argument, Matt is separating the community into two sides: on one hand, those like DHH, Jamis Buck, and Michael Koziarski, who know Rails inside and out (and not just how to build Rails applications, but the inner workings of Rails), build Rails components, and have a fundamental grasp on the advantages and disadvantages posed by the Web, and on the other the Typical Newbie, who mashes pre-assembled parts into a hideous, insecure conglomerate of which he has only the most superficial understanding.</p>
<p> This is not true. There are many people - I count myself among them - that use components not because we&#8217;re too lazy or stupid to understand how they work, but because we&#8217;re focused on creating things that nobody else has yet. <b>Reinventing the wheel is immensely frustrating, boring, and a waste of time; Rails components allow us to avoid reinvention and focus on what matters, and to condemn this mindset simply because not all developers have the time or energy to understand every tool they&#8217;re using is absurdly foolish.</b></p>
<p><img src="http://importantshock.files.wordpress.com/2008/03/common-sense.jpg" alt="My Common Sense" />
<p>Fundamentally, Matt is also hurting himself with this statement, as in condemning the low end of Rails development he&#8217;s furthering the stereotype that Rails developers are either cretins or douchebags. Jeff Atwood put it a little <a href="http://www.codinghorror.com/blog/archives/001065.html">too bluntly</a> when he stated (somewhat in jest) when he stated the following:</p>
<blockquote><p>when you&#8217;re using Rails and OS X, you&#8217;re using the platform of <i>choice</i> for douchebags. </p></blockquote>
<p>But frankly, attacking newbies who are attracted to Rails by the promise of never having to write Yet Another Damn Authentication System is going to make you seem like a douchebag. And sure, there is a problem with newbies who <a href="http://trash.chregu.tv/instructions.txt">refuse to understand</a> that programming is not merely a matter of snapping components together. But that isn&#8217;t a problem specific to Rails; it&#8217;s everywhere, in server-side, desktop, and enterprise software, in Python, C++, and Ruby, on OS X, Windows and Linux. To blame an entire community for allowing this to happen is ludicrous and ultimately harmful.</p>
<p><a href="http://importantshock.files.wordpress.com/2008/03/portal.jpg" title="Don’t think."><img src="http://importantshock.files.wordpress.com/2008/03/portal.thumbnail.jpg" alt="Don’t think." /></a> <span class="Apple-style-span" style="font-style:italic;">
<p>Addendum: Matt published an extension of his ideas in <a href="http://railsontherun.com/2008/3/21/how-duplo-and-i-offended-people">this</a> post, in which he clarifies certain aspects of his ideas. <span class="Apple-style-span" style="font-style:normal;"><a href="http://railsontherun.com/2008/3/21/how-duplo-and-i-offended-people"><span style="font-style:italic;" class="Apple-style-span">Go! Read it!</span> </a></span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/72/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/72/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=72&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2008/03/21/duplicity-and-the-duplo-generation/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>

		<media:content url="http://importantshock.files.wordpress.com/2008/03/fractal-wrongness.thumbnail.jpg" medium="image">
			<media:title type="html">Fractal Wrongness</media:title>
		</media:content>

		<media:content url="http://importantshock.files.wordpress.com/2008/03/common-sense.jpg" medium="image">
			<media:title type="html">My Common Sense</media:title>
		</media:content>

		<media:content url="http://importantshock.files.wordpress.com/2008/03/portal.thumbnail.jpg" medium="image">
			<media:title type="html">Don’t think.</media:title>
		</media:content>
	</item>
		<item>
		<title>Death to the Singleton</title>
		<link>http://importantshock.wordpress.com/2008/01/17/death-to-the-singleton/</link>
		<comments>http://importantshock.wordpress.com/2008/01/17/death-to-the-singleton/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 16:27:08 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[functional]]></category>

		<category><![CDATA[magic]]></category>

		<category><![CDATA[nifty]]></category>

		<category><![CDATA[nu]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2008/01/17/death-to-the-singleton/</guid>
		<description><![CDATA[Even those like myself who haven&#8217;t had the occasion to work through Design Patterns should no doubt be familiar with the Singleton Pattern. Though it&#8217;s one of the most used software patterns, especially in API&#8217;s like the JDK and Cocoa, it&#8217;s also attracted its fair share of flak for a myriad array of reasons, chief [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Even those like myself who haven&#8217;t had the occasion to work through <a href="http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612">Design Patterns</a> should no doubt be familiar with the <a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singleton Pattern</a>. Though it&#8217;s one of the most used software patterns, especially in API&#8217;s like the JDK and Cocoa, it&#8217;s also attracted its fair share of flak for a myriad array of reasons, chief among them being that they&#8217;re simply a global variable with a nice name.</p>
<p>Now, it&#8217;s none of my business how you implement your classes, and I&#8217;m a member of the school of thought that global variables (especially in scripting languages) are often necessary. What really frosts me about singleton classes is their verbosity. Take, for example, this snippet of Nu code:</p>
<pre><code>(if (((NSFileManager defaultManager) fileExistsAtPath: somePath))
    ((NSFileManager defaultManager) copyItemAtPath:otherPath toPath:somePath error:nil)
    (else
        ((NSFileManager defaultManager) createDirectoryAtPath: somePath)))`
</code></pre>
<p>This is, needless to say, ugly and repetitive. One could create a temporary variable to hold the <code>NSFileManager</code>, but that would not be a <em>remedy</em> for the verbosity associated with singleton classes like this - it&#8217;s merely a stopgap measure, and adds more code that you have to read. What I&#8217;d really like to do is this:</p>
<pre><code>(if ((NSFileManager fileExistsAtPath: somePath))
    (NSFileManager copyItemAtPath:otherPath toPath:somePath error:nil)
    (else
        (NSFileManager createDirectoryAtPath: somePath)))
</code></pre>
<p>that is, have every instance method on the default <code>NSFileManager</code> become a class method. Were I totally brain-dead, I would declare an extension to NSFileManager and create a class method for every instance method that I wanted to represent. Luckily, I&#8217;m not - <strong>there is a better way</strong>, and it involves the oh-so-magical <code>handleUnknownMessage: withContext:</code> message that every Nu object has.</p>
<p>(Incidentally, this trick requires the most recent revision of Nu from the <a href="http://code.neontology.com/gitweb.cgi?p=Nu.git;a=summary">git repository</a>. Previously the <code>handleUnknownMessage: withContext:</code> message only worked with instances of classes, not class objects themselves - but one line of Objective-C fixed that!)</p>
<p>By declaring <code>handleUnknownMessage: withContext:</code> as a class method on NSFileManager, we can tell the NSFileManager class to forward any messages it can to the shared instance of NSFileManager. Here&#8217;s the code that allows one to do that:</p>
<pre><code>(class NSFileManager
    (+ (id) handleUnknownMessage:(id)cdr withContext:(id)ctx
        ((NSFileManager defaultManager) sendMessage: cdr withContext: ctx)))
</code></pre>
<p>Beautiful. Now every unknown message sent to NSFileManager will be forwarded to <code>(NSFileManager sharedInstance)</code>; this can be implemented with any other singleton class that you please. It&#8217;s dynamic behaviors like this that make Nu such a pleasure to work with (and Java so painful - I once wrote an equivalent of Ruby&#8217;s method_missing in Java. It was not pretty).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/70/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/70/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=70&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2008/01/17/death-to-the-singleton/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>Announcing Nuki 0.1 (VoodooPad, watch out!)</title>
		<link>http://importantshock.wordpress.com/2008/01/06/announcing-nuki-01-voodoopad-watch-out/</link>
		<comments>http://importantshock.wordpress.com/2008/01/06/announcing-nuki-01-voodoopad-watch-out/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 20:21:45 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2008/01/06/announcing-nuki-01-voodoopad-watch-out/</guid>
		<description><![CDATA[Dear interwebs,
Today I finished the first release of a simple, database-backed and web-accessible Wiki software written entirely in Nu and making use of the NuHTTP and NuMarkdown libraries. I call it Nuki (pronounced &#8216;nookie&#8217;), and I wrote it to teach myself how to integrate Core Data and NuHTTP in a simple application.You can check it out [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Dear interwebs,</p>
<p>Today I finished the first release of a simple, database-backed and web-accessible Wiki software written entirely in Nu and making use of the NuHTTP and NuMarkdown libraries. I call it Nuki (pronounced &#8216;nookie&#8217;), and I wrote it to teach myself how to integrate Core Data and NuHTTP in a simple application.You can check it out from Subversion <a href="http://tools.assembla.com/svn/importantshock">here</a>. Read on to see what I learned whilst writing this application. </p>
<p> <span id="more-69"></span>
<p>At first I encountered some difficulty getting the Core Data store and NuHTTP server up and running - but then I had a brainwave: why not copy Tim&#8217;s application skeleton from Nudge? I did so, and all was good. </p>
<p>My Core Data model is very simple - no relationships at all, just a single model class - so there was very little interesting to talk about there. By placing the (attr-accessors) macro inside the NSManagedObject subclass, though, I got all the Core Data accessor methods for free - delicious! And to those who say I&#8217;m tainting the MVC paradigm by including code inside the model on how to render HTML links for a given page, I say that you&#8217;re probably right.</p>
<p> Having a proper macro system is a breath of fresh air. I realized just now that the degree to which I like a language is a function of its extensibility, its standard library and its power for syntactic abstraction - Nu, as far as I know, is the only one that satisfies all three of those criteria.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/69/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/69/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=69&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2008/01/06/announcing-nuki-01-voodoopad-watch-out/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>NSDate Weirdness (and Nu!)</title>
		<link>http://importantshock.wordpress.com/2007/12/27/nsdate-weirdness-and-nu/</link>
		<comments>http://importantshock.wordpress.com/2007/12/27/nsdate-weirdness-and-nu/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 21:47:37 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[cocoa]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[nu]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/12/27/nsdate-weirdness-and-nu/</guid>
		<description><![CDATA[Now that Nu is released to the public in all its glory, I&#8217;ve been doing a lot of coding exercises in it. As is my wont, I wrote a program that prints out the current Discordian date, and in the midst of looking at the NSDate and NSCalendarDate documentation, I found this fascinating class method [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Now that Nu is released to the public in all its glory, I&#8217;ve been doing a lot of coding exercises in it. As is my wont, I wrote a program that prints out the current <a href="http://en.wikipedia.org/wiki/Discordianism">Discordian</a> <a href="http://en.wikipedia.org/wiki/Discordian_calendar">date</a>, and in the midst of looking at the NSDate and NSCalendarDate documentation, I found <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/clm/NSDate/dateWithNaturalLanguageString:">this</a> fascinating class method on NSDate:</p>
<p><i>+ dateWithNaturalLanguageString:(NSString *)string</i><i>:</i></p>
<p><i>Creates and returns an NSDate object set to the date and time specified by a given string.</i></p>
<p><i>Parameters<br />
string<br />
A string that contains a colloquial specification of a date, such as “last Tuesday at dinner,” “3pm December 31, 2001,” “12/31/01,” or “31/12/01.”</i></p>
<p><i>Return Value<br />
A new NSDate object set to the current date and time specified by string.</i></p>
<p><i>Discussion<br />
This method supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged.</i></p>
<p>This piqued my interest in a big way; it reminded me of the way Lotus Agenda could recognize date input such as &#8220;next Thursday&#8221; and &#8220;eight days from now&#8221;, as detailed in the fantastic book <a href="http://www.dreamingincode.com/">Dreaming in Code</a>. I couldn&#8217;t just leave it alone, so I whipped up a little Nu script for you. Run it and it will present unto you a prompt, at which point I invite you to enter such phrases as:</p>
<ul>
<li>next Tuesday</li>
<li>September 22, 1988</li>
<li>3 hours from now</li>
</ul>
<p>You will see that those phrases - and a multitude of others - are parsed correctly as NSDates, leaving you free to actually work on other things rather than futz around with NSScanners. Give it a try! And look at Nu as well!</p>
<p><code><br />
(global readline (NuBridgedFunction functionWithName: &#8220;readline&#8221; signature: &#8220;**&#8221;))<br />
(puts &#8220;Press Ctrl-C to quit.&#8221;)<br />
(while 1<br />
(set input (readline &#8220;&gt;&gt;&gt; &#8220;))<br />
(set date (NSDate dateWithNaturalLanguageString: input))<br />
(if date<br />
(puts (date description))<br />
(else<br />
(puts &#8220;Your input of &#8216;#{input}&#8217; could not be parsed. Try again!&#8221;))))<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=66&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/12/27/nsdate-weirdness-and-nu/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>15 Programming Exercises</title>
		<link>http://importantshock.wordpress.com/2007/11/11/15-programming-exercises/</link>
		<comments>http://importantshock.wordpress.com/2007/11/11/15-programming-exercises/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 20:44:52 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/11/11/15-programming-exercises/</guid>
		<description><![CDATA[Being what could be charitably described as a programming language junkie, over the past few years I&#8217;ve amassed a number of programming exercises aimed towards establishing fluency with a new language; some of these are barely beyond Hello World or FizzBuzz, while some can get quite tricky. Mackenzie Morgan expressed interest in improving her Python-fu; after listing [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Being what could be charitably described as a programming language junkie, over the past few years I&#8217;ve amassed a number of programming exercises aimed towards establishing fluency with a new language; some of these are barely beyond Hello World or FizzBuzz, while some can get quite tricky. <a href="http://ubuntulinuxtipstricks.blogspot.com/">Mackenzie Morgan</a> expressed interest in improving her Python-fu; after listing half-a-dozen of these ideas, I said &#8220;Hey, maybe this would make a good blog post.&#8221; As such, I present to you a list of programming challenges. Many of these have been culled from various sources on the Internet, and I have endeavoured to provide credit where due.
<ol>
<li>In general, each language treats collections differently - some (Nu and Smalltalk) start indexing from 1, whereas most start indexing from 0; Ruby returns nil when one tries to access an element outside of an array index, whereas most others throw some sort of an exception; each language has its own set of ideals that it deems best. Your challenge is to take your favorite language and turn this paradigm on its head - if you use a relaxed, permissive language such as Ruby, write a NeuroticArray class that panics at the slightest opportunity; if you use a stricter language such as Java or Haskell, write a RelaxedArray structure that throws as few errors as possible. Bonus points will be awarded if the public interface to your new collection is nearly identical to that of the original type.</li>
<li>Write a text munger, as detailed in <a href="http://www.rubyquiz.com/quiz76.html">this Ruby Quiz link</a>. The most obvious solution to this problem is to remove the head and tail characters of each word, shuffle the remaining letters, and replace the head and tail characters; as such, this teaches character manipulation, sequence shuffling, and string concatenation.</li>
<li>Implement a collection-backed regular expression matcher, as detailed in <a href="http://www.rubyquiz.com/quiz103.html">this Ruby Quiz.</a> This teaches about object-orientation (strictly speaking, OOP is not necessary for this exercise), regular expressions, and increases awareness of the limitations of languages (Ruby&#8217;s built-in limit on regular expression length inspired this quiz).</li>
<li>Write a simple script that obfuscates English text by adding any possible accent or umlaut to each letter in a sentence. This teaches the basics of regular expressions and associative arrays.</li>
<li>Write a high-level input library, as detailed in <a href="http://www.rubyquiz.com/quiz29.html">this Ruby quiz</a>. Not only does it teach how to write a good API, but it also forces you to consider the various needs of the people who use your API&#8217;s. Can you satisfy everybody, or will you be forever mediocre?</li>
<li>Write a tool to turn <a href="http://www.hackerkey.com/hacker.html">Hacker Keys </a>into English-readable strings. This is an excellent situation in which to learn about the power (and limitations) of regular expressions, and also shows programmers about the dangers of constantly-changing specifications. Bonus points will be awarded if your solution reads in the hacker key specification from configuration files; even more will be awarded if you write a tool that parses user input into a hacker key dump.</li>
<li>Write a parser for <a href="http://www.cliff.biffle.org/esoterica/hq9plus.html">HQ9+</a> or <a href="http://www.dangermouse.net/esoteric/hq9plusplus.html">HQ9++</a>. These exceedingly simple esoteric languages are very useful for learning the basics of regular expression usage, and implementing an REPL is always challenging and interesting.</li>
<li>Build your own Scheme interpreter. Scheme&#8217;s syntax is extremely minimal, as such, with a good parsing toolkit - please, if you value your sanity, do not try to write a parser using nothing but regular expressions - writing a Scheme interpreter is far, far easier than you&#8217;d think. The fantastic Haskell tutorial <a href="http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours">Write Yourself a Scheme in 48 Hours</a> is an excellent introduction to a language that is, at times, terrifying. (In a conversation with my mom about the ambitious scope of this particular exercise as applied to Haskell, I said &#8220;Imagine, Mom, if immediately after learning how to say &#8216;Hello&#8217; in Japanese, the second assignment was to write a Russian-Japanese dictionary.&#8221;)</li>
<li>Write an ID3v1 tag parser, as detailed in this <a href="http://www.rubyquiz.com/quiz136.html">Ruby Quiz</a>. The ID3v1 format is extremely simple, and a parser can be written easily and understandably in even a very low-level language. This will teach about file input and output, and also present the difficulties associated with programs that deal robustly with malformed input.</li>
<li>Write a graphical frontend to a system tool such as fortune. In lightweight scripting languages this task will be much easier than with heavy-duty languages such as Objective-C or Java; however, no matter what langauge you choose this will teach you about construction of a simple GUI and how to interface with the operating system. Bonus points will be awarded if you write a cross-platform tool that invokes the correct tool for a particular task no matter its operating systme - e.g. a tool that invokes the tracert tool on Windows and the traceroute command on *nix.</li>
<li>Most programming languages have support for more than one GUI toolkit; write a program that compares the widget support for as many different toolkits as possible. Not only will this illustrate the sheer magnitude of the difference between a good and a bad API, but programming a GUI correctly provides a very visceral satisfaction. The difficulties of building a project that links into multiple heavy-duty libraries may play a part in this project, depending on the language used. You could also contrast GUI builders with writing the widget-placement code manually in this project.</li>
<li>Finish the Ruby Quiz (yes, I <b>do </b>realize that half of these ideas are links to the Ruby Quiz, now will you shut up?) <a href="http://www.rubyquiz.com/quiz67.html">metakoans.rb </a>exercise. If you can&#8217;t finish it - I sure couldn&#8217;t, on my first try at least - look at the solutions that other people submitted and try to understand them. If you&#8217;re feeling brave, implement the quiz and the solution in your language of choice. If you&#8217;re feeling like a goddamn hero, solve the <a href="http://onestepback.org/articles/callcc/throw_catch/continuation_koans_rb.html">continuation koans.</a></li>
<li>While programming in any language, one will build up an often-used set of useful functions and modifications; clean up, comment, and publish these extensions. You never know who might find them useful!</li>
<li>Take a simple program you&#8217;ve written - for example, one that prints out the lyrics to the 12 Days of Christmas - and remove all familiar concepts from it. If you&#8217;re working in C, don&#8217;t use a for loop. If you&#8217;re using an imperative language, recurse rather than iterate. If you&#8217;re using a language with mutable state, program in a purely functional style.</li>
<li>Solve all the <a href="http://projecteuler.net/">Project Euler</a> problems that you can - and make sure that you pick the right algorithm for the job. There is a world of difference between what you learn when you write a brute-force solution that takes the whole night to run and a complicated but effective solution that takes 10 seconds to run.</li>
</ol>
<p>Have any more ideas? Did I leave out your pet exercise? Leave a comment.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/68/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/68/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=68&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/11/11/15-programming-exercises/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>Programming Limericks</title>
		<link>http://importantshock.wordpress.com/2007/11/04/programming-limericks/</link>
		<comments>http://importantshock.wordpress.com/2007/11/04/programming-limericks/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 23:38:51 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/11/04/programming-limericks/</guid>
		<description><![CDATA[GOTO Considered Harmful
 GOTO makes your code like spaghetti Please don&#8217;t throw it around like confetti A conditional clause Has far fewer flaws So just structure your program, already.
 Good Agile, Bad Agile
 It&#8217;s hip to use Agile scrums To prepare for change (when it comes) But, frankly, it seems To be harmful to teams [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span class="Apple-style-span" style="font-weight:bold;">GOTO Considered Harmful</span></p>
<p> GOTO makes your code like spaghetti<br /> Please don&#8217;t throw it around like confetti<br /> A conditional clause<br /> Has far fewer flaws<br /> So just structure your program, already.</p>
<p> <span class="Apple-style-span" style="font-weight:bold;">Good Agile, Bad Agile</span></p>
<p> It&#8217;s hip to use Agile scrums<br /> To prepare for change (when it comes)<br /> But, frankly, it seems<br /> To be harmful to teams<br /> Excepting my Googler chums.</p>
<p>  <span class="Apple-style-span" style="font-weight:bold;">What&#8217;s Nu? </span></p>
<p> We fused Cocoa&#8217;s power with Scheme<br /> To produce a language supreme<br /> Of glorious beauty<br /> That kicks Ruby&#8217;s booty<br /> And makes Python look powered by steam. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=60&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/11/04/programming-limericks/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>Compensating for the Suckage of OS X Terminals</title>
		<link>http://importantshock.wordpress.com/2007/09/12/compensating-for-the-suckage-of-os-x-terminals/</link>
		<comments>http://importantshock.wordpress.com/2007/09/12/compensating-for-the-suckage-of-os-x-terminals/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 21:31:18 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/09/12/compensating-for-the-suckage-of-os-x-terminals/</guid>
		<description><![CDATA[Every terminal in OS X that I&#8217;ve tried (Terminal.app, iTerm, Terminator) refuses to send a myriad array of valid keystroke combos over SSH. This wouldn&#8217;t be a problem except for the fact that I use Emacs, the Uber-Editor.One of these unsupported keystrokes is Control-Meta+any key (for those not fluent in Emacs, Meta is Alt); considering [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Every terminal in OS X that I&#8217;ve tried (Terminal.app, iTerm, Terminator) refuses to send a myriad array of valid keystroke combos over SSH. This wouldn&#8217;t be a problem except for the fact that I use Emacs, the Uber-Editor.One of these unsupported keystrokes is Control-Meta+any key (for those not fluent in Emacs, Meta is Alt); considering that this is one of the key commands in Emacs, the only alternative - pressing Escape to activate the Meta key, then entering the desired key command - is very inefficient and tends to interrupt the flow of typing. <br /> Until I can figure out the proper incantation to get Emacs to recognize a key as pressing Control-Meta, this shortcut will help with the inefficiency: <br /> <code>(global-set-key "\C-c\C-v" 'ESC-prefix)</code> <br /> If anyone on the Lazyweb has any suggestions on how to fix this problem, please leave a comment. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/64/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/64/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=64&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/09/12/compensating-for-the-suckage-of-os-x-terminals/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Haskell Curry? Yes, I dated his daughter.&#8221;</title>
		<link>http://importantshock.wordpress.com/2007/08/21/haskell-curry-yes-i-dated-his-daughter/</link>
		<comments>http://importantshock.wordpress.com/2007/08/21/haskell-curry-yes-i-dated-his-daughter/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 16:44:14 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/08/21/haskell-curry-yes-i-dated-his-daughter/</guid>
		<description><![CDATA[Last week I had the opportunity to talk with Alonzo Church, Jr. (he prefers to be called &#8220;Al&#8221;), son of the Alonzo Church (you know, the one who only invented the freaking lambda calculus). We had a lovely conversation; we talked about Alan Turing, Fortran, COBOL, the future of computer science, and all sorts of [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last week I had the opportunity to talk with Alonzo Church, Jr. (he prefers to be called &#8220;Al&#8221;), son of <em>the</em> Alonzo Church (you know, the one who only <strong><em>invented the freaking lambda calculus</em></strong>). We had a lovely conversation; we talked about Alan Turing, Fortran, COBOL, the future of computer science, and all sorts of other interesting topics. The highlight of our conversation, though, was this:</p>
<p>Me: &#8220;So, I&#8217;m learning a new-ish programming language named Haskell right now. It&#8217;s very strange.&#8221;</p>
<p>Al: &#8220;Did you say Pascal?&#8221;</p>
<p>Me: &#8220;No, Haskell. It&#8217;s named after a logicial named Haskell Curry &#8211;&#8221;</p>
<p>Al: &#8220;Oh, Professor Curry! Yes, I knew him! My father worked with him!&#8221;</p>
<p>Me: &#8220;No way! That&#8217;s awesome!&#8221;</p>
<p>Al: &#8220;Yes! In fact, I dated his daughter!&#8221;</p>
<p>Me: &#8220;You DOG!&#8221;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/62/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/62/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=62&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/08/21/haskell-curry-yes-i-dated-his-daughter/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>How Tim Burks and Nu Stole the Show at C4[1]</title>
		<link>http://importantshock.wordpress.com/2007/08/12/how-tim-burks-and-nu-stole-the-show-at-c41/</link>
		<comments>http://importantshock.wordpress.com/2007/08/12/how-tim-burks-and-nu-stole-the-show-at-c41/#comments</comments>
		<pubDate>Sun, 12 Aug 2007 15:09:57 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[apple]]></category>

		<category><![CDATA[c]]></category>

		<category><![CDATA[cocoa]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[fp]]></category>

		<category><![CDATA[functional]]></category>

		<category><![CDATA[gui]]></category>

		<category><![CDATA[nifty]]></category>

		<category><![CDATA[nu]]></category>

		<category><![CDATA[objc]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/08/12/how-tim-burks-and-nu-stole-the-show-at-c41/</guid>
		<description><![CDATA[Edit: Fixed some factual inaccuracies about the language itself.
Tim Burks, noted contributor to RubyCocoa and creator of RubyObjC, gave a talk at C4[1] about his experiences with creating a Ruby &#60;-&#62; ObjectiveC bridge, and the problems he overcame in doing so. It was an interesting presentation, and we were all suitably appreciative when he showed [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Edit: Fixed some factual inaccuracies about the language itself.</em></p>
<p><a href="http://blog.neontology.com/">Tim Burks</a>, noted contributor to <a href="http://rubycocoa.sourceforge.net/">RubyCocoa</a> and creator of <a href="http://www.rubyobjc.com/">RubyObjC</a>, gave a talk at <a href="http://c4.rentzsch.com/">C4[1]</a> about his experiences with creating a Ruby &lt;-&gt; ObjectiveC bridge, and the problems he overcame in doing so. It was an interesting presentation, and we were all suitably appreciative when he showed his custom visual chip-design software written in Ruby with a Cocoa interface.</p>
<p>And then he dropped a bombshell.</p>
<p>For the past year, Tim&#8217;s been working on a new dialect of Lisp - written in Objective-C - called <a href="http://blog.neontology.com/posts/2007/08/11/whats-nu">Nu</a>. Here are its features (more precisely, here are the ones that I remember; I was so awestruck that many went over my head):</p>
<ul>
<li>Interpreted, running on top of Objective-C.</li>
<li>Scheme-y syntax. Everything is an s-expression (data is code, code is data). Variable assignment was done without let-clauses (which are a pain in the ass) - all one has to do was <code>(set varname value).</code></li>
<li>Variable sigils to indicate variable scope.</li>
<li>True object-orientation - everything is an object.</li>
<li>True closures with the do-statement - which, incidentally, is how Ruby should have done it.</li>
<li><span style="font-weight:bold;" class="Apple-style-span">Macros. HOLY CRAP, MACROS!</span> When Tim showed us an example of using <code>define-macro</code> for syntactical abstraction, Wolf Rentzsch and I started spontaneously applauding. His example even contained an example of absolutely beautiful exception handling that should be familiar to anyone with any ObjC or Ruby experience.</li>
<li>Symbol generation (__) to make macros hygenic and prevent variable name conflicts.</li>
<li>Nu data objects are Cocoa classes - the strings are NSStrings, the arrays NSArrays, etc.</li>
<li>Ability to create new Obj-C classes from inside Nu.</li>
<li>Interfaces with Cocoa libraries - you can access Core Data stores from within Nu in a much easier fashion than pure ObjC, thanks to Tim&#8217;s very clever idea of using a $session global to store the NSManagedObjectModel, NSManagedObjectContext, and NSPersistentStoreCoordinator.</li>
<li>Ruby-style string interpolation with #{}.</li>
<li>Regular expressions.</li>
<li>Positively drool-inducing metaprogramming, including a simulation of Ruby&#8217;s <code>method_missing</code> functionality.</li>
<li>A web-based templating system similar to ERb in 80 lines of Nu code - compare that with the 422 lines of code in erb.rb.</li>
</ul>
<p>Tim showed us a MarsEdit-like blog editor written entirely in Nu, using Core Data as its backend - and then showed us the built-in Nu web server inside that program, complete with beautiful CSS/HTML/Ajax.</p>
<p>As <a href="http://www.fscript.org/">F-Script</a> is to Smalltalk, so Nu is to Lisp. Tim said that he hopes someday to open-source Nu; if he does, he will introduce what is quite possibly the most exciting development in the Lisp-related community in a long time. I don&#8217;t think I speak for just myself when I say I cannot <em>wait</em> to get my hands on it.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/61/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/61/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=61&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/08/12/how-tim-burks-and-nu-stole-the-show-at-c41/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
		<item>
		<title>Inform 7: Natural-Language Programming Lives</title>
		<link>http://importantshock.wordpress.com/2007/06/18/inform-7-natural-language-programming-lives/</link>
		<comments>http://importantshock.wordpress.com/2007/06/18/inform-7-natural-language-programming-lives/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 23:51:53 +0000</pubDate>
		<dc:creator>Patrick Thomson</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://importantshock.wordpress.com/2007/06/18/inform-7-natural-language-programming-lives/</guid>
		<description><![CDATA[When most programmers think of natural-language programming, they usually think of Applescript - an ambitious yet doomed-to-failure language with English-like syntax that Apple developed in order to automate OS scripting tasks. Frankly, Applescript in its current incarnation is pretty dismal - any reasonably complex script is positively overflowing with ends and tells, reminiscent of Ruby&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When most programmers think of natural-language programming, they usually think of <a href="http://en.wikipedia.org/wiki/Applescript">Applescript</a> - an ambitious yet doomed-to-failure language with <a href="http://en.wikipedia.org/wiki/Applescript#The_natural_language_metaphor">English-like syntax</a> that Apple developed in order to automate OS scripting tasks. Frankly, Applescript in its current incarnation is pretty dismal - any reasonably complex script is positively overflowing with <code>end</code>s and <code>tell</code>s, reminiscent of Ruby&#8217;s slower, dumber cousin. (Incidentally, 99% of the pain of Applescript can be removed with <a href="http://rubyosa.rubyforge.org/">Ruby</a> or <a href="http://appscript.sourceforge.net/">Python</a> bridges.)</p>
<p>These painful memories, combined with <a href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html">other influential condemnations</a>, will probably lead many programmers to shun <a href="http://www.inform-fiction.org/I7/Inform%207.html">Inform 7</a> and its mission to be &#8220;built by writing natural English-language sentences.&#8221; However, if you will wait a moment, I will show you the masterful elegance with which Inform 7 mixes modern programming paradigms and the English language.</p>
<p>For those of you unfamiliar with Inform, it&#8217;s a system for writing text adventures - well-known examples include Adventure, Zork, and the famously difficult adaptation of The Hitchhiker&#8217;s Guide to the Galaxy. Inform was created in 1993; in its first six versions, games were written in a procedural programming language with a syntax looking like a cross between Perl and Applescript. Now, however, games are written entirely in English and then translated with the I7 compiler.</p>
<p>The following is not meant to be a full-fledged I7 tutorial; the official site does that far better than I ever could. This is simply a demonstration of how I7 manages to express complex programming concepts entirely in English.</p>
<p><span id="more-56"></span></p>
<p>Let&#8217;s look at how we instantiate objects:</p>
<p><code>The hall is a room.</code></p>
<p>There, that&#8217;s it. Same thing as <code>hall = Room.new()</code> or what have you. Its name &#8220;The hall&#8221; will be displayed correctly when the player enters, leaves or observes it.</p>
<p>What about making new types of objects?</p>
<p><code>A bathroom is a kind of room.</code></p>
<p>Ooh! Subclassing! Inheritance! And it does it concisely and readably, and without using any terms such as &#8220;public&#8221;, &#8220;class&#8221;, or &#8220;extends&#8221;!</p>
<p><code>Rooms can be clean, dirty, or filthy.<br />
Bathrooms are usually dirty.</code></p>
<p>Dynamic programming! We can edit the properties of built-in objects, a lá Smalltalk and Ruby!</p>
<p><code>The oil drum is a thing. The oil drum is enterable.</code></p>
<p>&#8220;Enterable&#8221; in this case is like a Ruby mixin - it allows the player to get in and out of the oil drum and provides it with all the attributes that entails.</p>
<p><code>Color is a kind of value. The colors are blue, red and green.<br />
Instead of touching the button: change the color of the button to red.</code></p>
<p>Note the definition of new enumerable types, subclassing methods (in this case, &#8216;touching&#8217;) on existing objects, and changing attribute values.</p>
<p><em>These are complicated concepts</em> and the fact that the Inform 7 designers have made them expressible in concise English is, frankly, astounding.</p>
<p>Go check it out; write the Dramatic Lovecraftian Adventure you&#8217;ve had brewing up in your mind for the past few years. It&#8217;ll be fun.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/importantshock.wordpress.com/56/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/importantshock.wordpress.com/56/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/importantshock.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/importantshock.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/importantshock.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/importantshock.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/importantshock.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/importantshock.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/importantshock.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/importantshock.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/importantshock.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/importantshock.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=importantshock.wordpress.com&blog=511060&post=56&subd=importantshock&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://importantshock.wordpress.com/2007/06/18/inform-7-natural-language-programming-lives/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/importantshock-128.jpg" medium="image">
			<media:title type="html">importantshock</media:title>
		</media:content>
	</item>
	</channel>
</rss>