<?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/"
	>

<channel>
	<title>Pet Theory</title>
	<atom:link href="http://pet-theory.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://pet-theory.com/blog</link>
	<description>Interface and Code</description>
	<pubDate>Thu, 20 Aug 2009 22:10:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Questions about the mimbo explosion at Flashbelt</title>
		<link>http://pet-theory.com/blog/2009/06/12/questions-about-the-mimbo-explosion-at-flashbelt/</link>
		<comments>http://pet-theory.com/blog/2009/06/12/questions-about-the-mimbo-explosion-at-flashbelt/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 19:35:19 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pet-theory.com/blog/?p=318</guid>
		<description><![CDATA[A man at a Flashbelt session included some racy content in his preso. Different accounts can be found here (more offensive), and here (less offensive). Most of the people in the room were men, and many laughed. Some of the women there&#8211;as well as the conference organizer&#8211;were first to complain that the content was unprofessional [...]]]></description>
			<content:encoded><![CDATA[<p>A man at a Flashbelt session included some racy content in his preso. Different accounts can be found <a href="http://blogs.citypages.com/blotter/2009/06/minneapolis_fla.php">here</a> (more offensive), and <a href="http://www.gskinner.com/blog/archives/2009/06/hossgate09_find.html">here</a> (less offensive). Most of the people in the room were men, and many laughed. Some of the women there&#8211;as well as the conference organizer&#8211;were first to complain that the content was unprofessional and objectified women.</p>
<p>So the Flash community has a <a href="http://www.geekgirlsguide.com/blog/2009/06/11/98/prude_or_professional_by_courtney_remes">controversy</a> on its hands, just as the <a href="http://www.reddit.com/r/programming/comments/8fsnz/rails_is_still_a_ghetto/">Rails community</a> did a month or two ago. Was it wrong? I dunno. Here are some related questions that might help you decide:</p>
<p><em>If the room held only men, would a presentation like this be wrong?</em> That is, is the harm here how men’s worst impulses are being reinforced?</p>
<p><em>If the room held mostly women, would it be wrong?</em> Did the upset women’s discomfort stem mainly from the fact that they feel professionally precarious? If they didn’t feel precarious, would they still be upset?<br />
<span id="more-318"></span><br />
<em>If the controversial content was geared to please adult women rather than mimbos, would it be wrong?</em> Is sexual content itself objectionable, because women in general have lower tolerance for crudity than men in general…or does the harm come from the nature of the content (which, presumably, objectifies or demeans women).</p>
<p><em>If the animations showed gay men frolicking, would it be wrong?</em> See last questions.</p>
<p><em>If the preso showed off excellent work in the porn industry, would it be wrong?</em> Should there be a “professional” interest in these productions or should they be taboo? Likewise, if someone was doing interactives for an anti-affirmative action group? Or a group that advocated athiesm and blasphemed Christ? What would be “professionally” acceptable content at a conference?</p>
<p><em>If conference organizers liked something in a playground but ruled it out for a session, would that be wrong?</em> In a creative industry, people often make their reputations and get picked for talks on the basis on their creativity. It’s not all banner ads and bank wizards. So what range of personal expression should be acceptable? Are some expressions one thing in a playground, another at a conference?</p>
<p><em>If a manager decided against hiring someone because of something in their playground, would it be wrong?</em> Following up on last questions: Or should “professional” standards be applied thoroughly to creative professionals, and the mimbo presenter be canned?</p>
<p>[Edited Sunday 6.14.09: Clarifications added to italicized questions. Description of preso vaguer because of conflicting reports.]</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2009/06/12/questions-about-the-mimbo-explosion-at-flashbelt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex Design After Gumbo</title>
		<link>http://pet-theory.com/blog/2009/04/24/design-after-gumbo/</link>
		<comments>http://pet-theory.com/blog/2009/04/24/design-after-gumbo/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 01:14:22 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Flex]]></category>

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

		<guid isPermaLink="false">http://pet-theory.com/blog/?p=238</guid>
		<description><![CDATA[Flex 4 a.k.a. Gumbo will treat the major pain point in Flex development&#8211;the workflow between designers and developers&#8211;by allowing Flexers to easily make complete, detailed component skins as well as non-standard interactions and effects. 
And what about Flex design? Will it be impacted? It&#8217;ll be a year or more before we know, but this post [...]]]></description>
			<content:encoded><![CDATA[<p>Flex 4 a.k.a. Gumbo will treat the major pain point in Flex development&#8211;the workflow between designers and developers&#8211;by allowing Flexers to easily make complete, detailed component skins as well as non-standard interactions and effects. </p>
<p>And what about Flex design? Will it be impacted? It&#8217;ll be a year or more before we know, but this post makes two predictions:</p>
<p>1. Flex designer will fulfill the old unfulfilled dream of Flash designers that UI will become more game-like. Flex will also supplant a lot of Flash development while still avoiding Flashiness. </p>
<p>2. More important, Flex designers after Gumbo will focus on incorporating the best of hypertext, the dominant and transformative mode of the web that Flash and Flex designers tend to discount.<span id="more-238"></span> </p>
<p>Here&#8217;s a slideshow to help explain these predictions. It provides general context for thinking about GUI. Afterwards, I&#8217;ll extend the argument with Flex-specific details.</p>
<div style="width:425px;text-align:left" id="__ss_1334217"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/pettheory/gui-after-the-web-1334217?type=presentation" title="Gui After The Web">Gui After The Web</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=guiaftertheweb-090423144313-phpapp02&#038;stripped_title=gui-after-the-web-1334217" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=guiaftertheweb-090423144313-phpapp02&#038;stripped_title=gui-after-the-web-1334217" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/pettheory">pettheory</a>.</div>
</div>
<h3>Flex v. Flash.</h3>
<p>Flash is great for games and banners. For complete sites, it mostly has nothing to do except animate transitions. Everyone&#8217;s visited the archetypal aggravation: a movie site with slow, pretentious transitions that lead you to&#8230;.wait a few seconds&#8230;some text and pics.  Flash designers have duly moderated their broadcast impulses for the sake of usability, but in their hands, the impasse between WATCHING and LINKING has proved&#8211;after nearly a decade&#8211;equally sterile in corporate sites and student portfolios. </p>
<p>Design-wise, Flex is a step forward because it gives Flash some content&#8211;data&#8211;to work with, and shifts it into a domain where its powers can be applied productively. Transitions actually make sense when users are in consist DOING/STAYING mode and managing space becomes an issue. Selectively drawing on the physical world to construct an application starts to make sense, too. Working on stuff, users might want to push it aside, gather it together, stretch it out, or stick it to the metaphorical wall.   </p>
<h3>Gumbo (Flex 4) v. Flash</h3>
<p>Gumbo cleanly separates out the underlying data and the visuals in Flex. With the visuals now a thing apart, they can be skinned, customized and propelled by their own logic. This is a many-splendored turn for the better, which I explore <a href="http://pet-theory.com/blog/2009/04/23/gumbo-component-architecture-4-dummies/">here</a> from a programmer&#8217;s perspective. </p>
<p>The emphasis in promoting Gumbo has naturally fallen on how the separation of data and visuals allows for greater visual expressiveness  This is only half the equation, however, and ultimately less than half. More important, now that the component data has been freed from any particular component visuals, it becomes easier to conceptualize various kinds of data for a Flex project: ranges as timelines, trees as branching inquiries or dynamic pages, lists as narratives, etc. </p>
<p>Visual expressiveness in this context doesn&#8217;t mean demo-wow-itude as much as flexibility for visualizing an enormous range of content. </p>
<p>Flexibility could be wrung from pre-Gumbo Flex at the cost of baked-from-scratch components. But it was not easy, and easiness has a way of freeing the imagination. </p>
<p>With Gumbo, more projects will become imaginable. Many of those projects would have been slated for Flash development previously. (I&#8217;ll be surprised if there are more than a rump of pure, non-game AS3 developers in two years.) So given that Flex designers will soon have Flashier capabilities, and will be working on Flashier projects, will their designs become Flashier? </p>
<p>Excepting the inevitable spinning-globe demos, I doubt it. Compared to Flash, Flex is well grounded in data and user control. Instead I expect some really interesting, really helpful ways do and explore stuff. </p>
<h3>Flex v. Ajax</h3>
<p>Right now Flex and Ajax occupy slightly different niches in the web-application area. Flex for the moment looks more like desktop software, while Ajax applications look more like web pages. Both center on DOING, while Ajax is pulled strongly towards the LINKING and Flex is pulled less strongly towards WATCHING. </p>
<p>Providing differentiated front-end tools is a impeccably rational strategy for Flex and Adobe, and it makes sense since they have an advantage in the BROADCAST and the APPLICATION areas. Ultra-reasonable Flex evangelists regularly go as far as recommending Ajax for &#8220;content&#8221;-oriented sites.</p>
<p>But here&#8217;s the thing. Hypertext is good. It seems mundane only because it has assimilated into users&#8217; DNA so quickly and completely. But the page+link+page structure is addictive to users, because it offers associating power with quick, undoable and clear interactions.  If an Ajax developer finesses a page refresh now and them, that hardly detracts from hypertext. </p>
<p>And Ajax design is consistently good. When Ajax first went mainstream I remember taking solace in the fact that the design was often awkward, &#8220;interactive design is more difficult than it looks, no?&#8221; But its skip-intro period lasted a chilling micro-second. Incredibly well-designed Ajax apps demonstrating a well-grounded balance of STAYING and GOING now seem ubiquitous.</p>
<p>And lastly, the traditional web-development community has the numbers, the talent and the vision thing. How long will it be before Flash&#8217;s particular media capabilities are picked off, one by one?</p>
<p>I don&#8217;t know how supportable the current differentiation is over the long term. Flash and Flex have improved by leaps and bounds, but so have HTML, Javascript, and CSS. In fact, they are encroaching steadily on Flex and Flex territory&#8230;so why not push back into HTML territory?</p>
<p>My guess is that LINKING will exert increasing gravitational pull on both DOING and WATCHING in the coming years. Hypertext is the up-and-comer and its course is still running. Users will want to jump around apps with inline links, and undo or redo actions with a history button. Media will become a kind of hypermedia: bookmark-able, link-able and comment-able. Journalists and educators will offer less linear and more jumpable content. </p>
<p>Flex is well positioned to produce this new, more expansive kind of content, if Flex designers are willing to learn from hypertext.  Flex is already a decent tool for creating relatively CLOSED and deliberately constructed experiences that integrate data, media and interaction. Gumbo will make it better than decent, and designers dedicated to a more relatively more OPEN user experiences could really make Flex sing.</p>
<p>And now? Well, currently, if you create linked text, the text has to be selectable, so when the user clicks the link, they often select the text instead!</p>
<p>Flash 10 (which Gumbo relies on) promises to fix text: razor-sharp fonts, multi-column text fields, inline images, open glyph APIs. Finally, text will be a full-fledged part of the platform. This is great for multimedia capability&#8211;text is naturally the dominant, mediating media in multimedia&#8211;but even greater as a solid step towards integrating hypertext-like functionality. </p>
<p>These new text capabilities might in the long run turn out to be more decisive than the new skinning model.  Next steps might include selection-dependant background loading and enhanced history, both of which would allow for more direct user control. </p>
<p><em>I live in Portland, Oregon, and I&#8217;m looking for work. <a href="http://www.pet-theory.com">More</a> about me.<em</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2009/04/24/design-after-gumbo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gumbo Component Architecture 4 Dummies</title>
		<link>http://pet-theory.com/blog/2009/04/23/gumbo-component-architecture-4-dummies/</link>
		<comments>http://pet-theory.com/blog/2009/04/23/gumbo-component-architecture-4-dummies/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 21:33:05 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Flex]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/?p=229</guid>
		<description><![CDATA[Flash releases tend to operate on the each-kid-gets-a-turn principle: one for the developers, one for the designers. After reading this article on Gumbo component article, however, I think Christmas might be come early at Adobe. Because if designers will luv Gumbo's new skinning model, developers will luv luv luv the new component architecture. 
Adobe has [...]]]></description>
			<content:encoded><![CDATA[<p>Flash releases tend to operate on the each-kid-gets-a-turn principle: one for the developers, one for the designers. After reading <a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Component+Architecture">this article</a> on Gumbo component article, however, I think Christmas might be come early at Adobe. Because if designers will luv Gumbo's new skinning model, developers will luv luv luv the new component architecture.<span id="more-229"></span> </p>
<p>Adobe has laid down three principles for the redesign:</p>
<p>1. Design Friendly: clean separation of visuals and logic<br />
2. Composition: easy to group and relate building blocks of functionality<br />
3. Extensibility: easy to extend</p>
<p>Alert developers will notice a definite redundancy to this list. Composition is the indispensable bullet point. Composition requires that functionality has been encapsulated. And if it is encapsulated, it is cleanly separated, so Design Friendly is just a direct corollary of Composition. Likewise, if it is encapsulated, it has Extensibility simply because well-encapsulated functionality is easier to locate and subclass or compose.</p>
<p>Alert developers might also ask why encapsulation is coming to Flex components only now, in the fourth iteration of Flex? It's not as if MVC is a fresh styling. But hey, every Flex contributor is smarter than me, and the whole team has been operating under constraints I don't understand--or particularly care about--so let bygones be bygones. </p>
<h3>What Stays the Same</h3>
<p>Since Flex is just components, changing the component architecture is huge. That said, the moving parts look and work exactly the same.  The managers for focus, pop ups and dragging, the preloader frame, the build process that bubbles up from the least to the greatest components, the event cycle--all are the same.  </p>
<p>The handles by which the framework updates components by the batch (commitProperties, measure, updateDisplay) are also the same. What changes is how the component classes implement these updates.  Before Gumbo, they took on the entire responsibility. With Gumbo, they hand off this responsibility to various internal objects. </p>
<h3>One Complete Skin</h3>
<p>Before Gumbo, skinning was handled piecemeal, mostly in CSS: </p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showCodeTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">Button</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;upSkin: Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"assets/buttonUp.png"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The fact that a component could take a partial skin and relate it to another partial skin dramatizes the problem Gumbo will attempt to solve: because the logic of the view is jumbled up with the component's other logic, it becomes a chore to manipulate.</p>
<p>In Gumbo, the view emerges as a single object in own right, a tweakable, swappable instance composed by the component:</p>
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showCodeTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;List skinClass=<span style="color: #ff0000;">"myCustomSkinClass"</span>/&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>MXML Skins</h3>
<p>So what does this skinClass look like? It looks like MXML, of course. Declarative graphics a la Degrafa have been integrated into Flex:</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showCodeTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;Rect id=<span style="color: #ff0000;">"rect"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;fill&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;LinearGradient rotation=<span style="color: #ff0000;">"90"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"red"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"white"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/LinearGradient&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/fill&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/Rect&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>These graphics can be coded by hand in a skin class, but the typical work flow will entail exporting graphics data from a tool in Creative Suite (Flash, Illustrator or Fireworks all export data in the FXG format that Flex uses) and opening the data in Catalyst, where it can be associated with a particular component and prepped for Flex Builder.  This flow should ease the painful back-and-forth between developers and designers that plagues Flex development.</p>
<h3>Controlling the View with State</h3>
<p>So the view has been encapsulated...how then to control it?  With Gumbo, there is just one way: by setting the currentState property of the skin instance. So finding where a component is controlling its skin is as quick as searching for "currentState=". Actually, it's even quicker, since skinnable components implement a getUpdatedSkinState method that centralizes the logic for setting the skin's state. </p>
<p>Along with new responsibilities, states accrue new powers. Now states can be declared empty and defined variously with inline MXML: </p>
<div class="igBar"><span id="lactionscript-11"><a href="#" onclick="javascript:showCodeTxt('actionscript-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-11">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;fill&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;&lt;SolidColor <span style="color: #0066CC;">color</span>.<span style="color: #006600;">invalid</span>=<span style="color: #ff0000;">"red"</span> <span style="color: #0066CC;">color</span>.<span style="color: #006600;">valid</span>=<span style="color: #ff0000;">"green"</span> <span style="color: #0066CC;">color</span>.<span style="color: #0066CC;">up</span>=<span style="color: #ff0000;">"gray"</span>/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/fill&gt;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;fill.<span style="color: #006600;">invalid</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;LinearGradient&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"red"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"orange"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/LinearGradient&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/fill.<span style="color: #006600;">invalid</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;fill.<span style="color: #006600;">valid</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;LinearGradient&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"green"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">"white"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;/LinearGradient&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/fill.<span style="color: #006600;">valid</span>&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This syntax should save time and make MXML more readable when states offer numerous small variations. </p>
<h3>Layout</h3>
<p>Gumbo components delegate layout to a Layout object. A List subclass, for instance, becomes vertical when it composes a VerticalLayout:</p>
<div class="igBar"><span id="lactionscript-12"><a href="#" onclick="javascript:showCodeTxt('actionscript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-12">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;layout&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;VerticalLayout/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/layout&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A horizontal List would likewise compose a HorizontalLayout:</p>
<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showCodeTxt('actionscript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;layout&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;HorizontalLayout/&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/layout&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A tile List would, naturally, compose a TileLayout:</p>
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showCodeTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;layout&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&lt;TileLayout columnCount=<span style="color: #ff0000;">"3"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowCount=<span style="color: #ff0000;">"3"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; orientation=<span style="color: #ff0000;">"vertical"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;&lt;/layout&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>In Gumbo, there is no separate HorizontalList, VerticalList, and TileList per se, only a list that can be directed to contort itself a number of ways. Simple, no? If you want a slightly different layout, you know where to look and what to subclass.</p>
<p>Better yet, I'd commence googling, because the Flex community is bound to generate every Layout class under the sun: CarouselLayout, RandomLayout, etc. </p>
<h3>Power of Composition</h3>
<p>What's enticing about Gumbo is that your power multiples with each new compositing. Suppose you have 3 FlowerList subclasses. And 3 List-ready skins, each with a unique item renderer.  And 3 Layout classes. That's 3 variations of FlowerList, times 3 possible layouts, times 3 possible skins, for 3*3*3=27 variations. </p>
<p>Permutability is the well-known virtue of composition, and the overriding goal of "Gumbo," aptly named after the thrown-together soup. So it's worth remembering what a maddening pain point it now is.</p>
<p>Currently, if I have some flower-specific code in a subclass of VerticalList, then later find that a TileList for flowers is necessary, there's a problem. Flower-functionality has been tied to a particular view, the VerticalList. So how do I put that functionality in another view? Either I extract the functionality into a FlowerData class, then compose and wrap it in two separate subclasses of VerticalList and TileList...or I do the unmentionable...I won't say what, but in the middle of the night, with some very marginal, dead-end classes, I've done things...things I never, ever did as a Flash developer. </p>
<p>The pure among you might say that I should have started with composition and FlowerData in mind, instead of immediately, sloppily subclassing some MXML component. Yes, my friend, you are right. But keep in mind that composition is not costless. Encapsulated functionality needs to be regathered and coordinated. If it is exposed, many tedious wrapper functions need to written.  Is this always the best course?</p>
<p>If Gumbo fulfills its promise, this painful question will often become irrelevant, because Gumbo will make it trivial for Flex coders to practice composition. This is, after all, the great advantage of working with a framework, that it does the work of relating groups of classes for us. So while the framework does the hard work of mediating and wrapping and implementing the components' new internal organs, we will just accessorize.  That smells damn good to me...I'll take a large bowl of steaming Gumbo.  </p>
<h3>Deeper with Flex</h3>
<p>After reading the  <a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Component+Architecture">architecture article</a>, I'm excited about Flex in a way I haven't been since the honeymoon period, when there seemed to be a clever event planned for every contingency, and the productivity wallop of just a few lines kept surprising me. </p>
<p>Do you remember that? Then you will also remember how quickly the honeymoon dissipated, when trivial adjustments suddenly morphed into afternoon-sucking spelunkathons.</p>
<p>What if I wanted to add an extra space after every third item in a list component? Hmmm, maybe subclassing updateDisplayList or some renderer wouldn't cut it...and soon enough, I'm scanning this huge, multi-indented function in which data, layout and interaction are tangled like so many hairs in a hairball. Hmmmm...maybe that extra space is a "nice-to-have."</p>
<p>In principle, I was willing to dive deeper. An industrial-strength framework like Flex requires effort to master, no doubt.  But the code I explored didn't inspire me to plunge unless absolutely necessary, because the payoff typically amounted to one-off tricks and workarounds. </p>
<p>I hope Gumbo changes that. </p>
<p><em>I live in Portland, Oregon, and I'm looking for work. <a href="http://www.pet-theory.com">More</a> about me.<em</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2009/04/23/gumbo-component-architecture-4-dummies/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simpler RIA with REST</title>
		<link>http://pet-theory.com/blog/2009/04/15/simpler-ria-with-rest/</link>
		<comments>http://pet-theory.com/blog/2009/04/15/simpler-ria-with-rest/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 17:04:28 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Flex]]></category>

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

		<guid isPermaLink="false">http://pet-theory.com/blog/?p=197</guid>
		<description><![CDATA[This post will show you how to slim down the service layer in your Rich Internet Application after defining RESTful services. 
Posts on REST usually begin by claiming that REST architecture involves much, much more than reducing the syntax of web services to database-derived verbs: create, read, update, delete (CRUD). That's true, but for this [...]]]></description>
			<content:encoded><![CDATA[<p>This post will show you how to slim down the service layer in your Rich Internet Application after defining RESTful services. </p>
<p>Posts on REST usually begin by claiming that REST architecture involves much, much more than reducing the syntax of web services to database-derived verbs: create, read, update, delete (CRUD). That's true, but for this post, exactly that supremely useful reduction will be "REST."</p>
<p>This post won't explain how to make a REST call or if it's possible to wrangle http REST for Flex (<a href="http://www.fngtps.com/2007/06/flex-can-t-do-rest">no</a>, <a href="http://restfulx.github.com/">yes with Rails and Flex</a>, <a href="http://blogs.4point.com/taylor.bastien/2009/04/flex-and-rest-is-it-time-to-scrub-out-soap.html">kinda with Java and Flex</a>, <a href="http://stackoverflow.com/questions/153420/is-it-feasible-to-create-a-rest-client-with-flex">StackOverflow</a>). I'll be focusing on RIA structure rather than http.  Examples will be drawn from Flex, but my conclusions should apply to any stateful RIA whether Silverlight or Javascript-based, with any kind of services, whether http or rpc.<span id="more-197"></span></p>
<p>It might seem odd to think of a RESTful RIA. Whatever else it is, REST is a kind of service call. An RIA makes calls, but it shouldn't depend on what kind of calls it makes. Wouldn't that violate the separation of concerns whereby some particular logic is devoted to making calls, and other logic is devoted to other RIAish things like holding and displaying data?</p>
<p>Actually, it does.  And of course that can be bad.  If you code with the expectation of RESTful services, it will be difficult to repurpose that code when RESTful services are long available. Then again, there is no logical end to the encapsulation imperative. Losing some encapsulation might be alright if the payoff is high enough. </p>
<h3>REST CRUDely Summarized</h3>
<p>REST is rife with nouns organized by a very few, but strong and consistent verbs. </p>
<p>The nouns are "resources." This in itself is not surprising. Anyone calling services is expecting access to something like a resource, some information, table, etc. What is surprising and characteristic about RESTful services is how consistently they define services in terms of noun-like resources.</p>
<p>Quick example: Everyone reading this has written or consumed a login service that looks roughly like this: loginService.login(username, pwd). A RESTful login service would look quite different, emphasizing noun rather than verb: session, not logging in. In REST-speak, logging in means creating a session, and conversely, logging off means deleting a session. </p>
<p>Creating RESTful web services entails speaking in noun. That's natural enough for many services: accounts, members, etc. But it requires more imagination in those many cases that provoke a coder to reach for more elaborate syntax: accountService.findOverdrawnAccountsIn, memberService.restoreDefaultPreferences, user.getPresenceSharingOnlineFriends. </p>
<p>A REST service can define resources (OverdrawnAccounts, OnlineFriends) that do not necessarily map directly to one table, or any table, really.  The service coder is responsible for creating an API, and the API is just what the coder wants it to be. (As <a href="http://www.mattking.org/">this guy</a> said to me when I was troubled about REST).  The important thing is the nouns he offers up, not how they are assembled or constructed.</p>
<p>The mavens of prose style have always exalted verbs over nouns. The mavens of REST do exactly the opposite: they exalt the noun and excommunicate nearly all verbs. The essentials that remain are very simple verbs similar to database operations: Create/Read/Update/Destroy. Only slightly more verbose are the templated methods for controllers in Rails: index (for collections), show, edit, update, new, create, destroy. </p>
<p>A REST API is like a long shelf at a grocery store: flush with things neatly stacked...and with just a few magic verbs, you can manipulate them, replace them and delete them. </p>
<h3>Slimming Down the Service Layer</h3>
<p>REST architecture has many cosmic implications for the structure of the web and http. Frankly, being a Flash/Flex developer and more a front-ender, I don't understand them. But as soon as I learned about REST, I realized how unnecessarily verb-ridden Flex projects can be. </p>
<p>In a typical Flex project, every consumed service requires a corresponding delegate class which spells out its various powers: login, createAccount, deleteAccount, etc. And in Caingorm or PureMVC at least, several different command classes might invoke this delegate class.  </p>
<p>What I will now suggest should be screamingly obvious to anyone who has been coding Flex for more than a week: If your services are RESTful and your delegates use exactly the same verbs (index, create, show, update, destroy), they look identical. So why not create a single delegate class and parameterize it by resource? And then, why not use a single command class to invoke this delegate and do something boringly predictable with it, like stashing it in a ResourcesProxy or ModelLocator or some convenient storage? Wouldn't that reduce paperwork? </p>
<p>There's any number of ways to standardize. My still-evolving, project-specific implementation is this: </p>
<p><a href="http://pet-theory.com/blog/wp-content/uploads/2009/04/rest.png"><img src="http://pet-theory.com/blog/wp-content/uploads/2009/04/rest.png" alt="rest" title="rest" width="455" height="465" class="aligncenter size-full wp-image-211" /></a></p>
<p>I am in no way stuck on this. This project happens to be using the PureMVC framework and amf transport, and in any case, this diagram will soon be outdated. The point is, if services are RESTful, you can invoke them in one place with a few strings:</p>
<p>ResouceProxy.doOperation("member", "update", aMemberVO)</p>
<p>Likewise, when the service is returned, your local model can update in a completely stereotyped manner:</p>
<p>ApplicationData.doOperation("member", "delete", aMemberVO)<br />
ApplicationData.doOperation("member", "index", memberVOs)</p>
<p>The advantage of reducing all your delegates to one delegate, and all your delegate-invoking commands into one command is obvious--less classes, less coding, less mistakes. It also increases the readability of your project. When you open up your controllers folder, for instance, you'll know that every command class is applying its own particular torque rather than following a me-too, zombieish recipe: "Get delegate...get data...put...in...ModelLocator."</p>
<p>One consequence of centralizing the access and storage of resources is that delegate-invoking commands no longer handle responder errors and view changes.  Instead, in my set-up, ApplicationData broadcasts dynamically generated ResourceEvent types from a set of strings ("memberCreateSuccess", "memberDestroyTimeout", "memberDestroyErrors", "noteUpdateSuccess") along with associated data, and the application reacts to these events. </p>
<p>Integrating this kind of messaging into a PureMVC-based project is trivial. Mediators sign up to be notified about particular data events and are natural places to handle responses and direct the view. Most other Flex frameworks including Cairngorm are command-happy and lack formalized Mediators, but it is equally trivial to listen for a data event, then dispatch whatever magical event your favorite framework autowires to a target command. </p>
<p>This is one way to handle exceptional events (errors, view changes not automatically triggered by model changes).  There are no doubt other, better ways. Again, the point is that treating services and data uniformly makes it possible to automate the conventional and treat the exceptional. </p>
<h3>When to use RESTful RIA?</h3>
<p>Obviously, it's impossible in the majority of cases. RIA developers often don't have control over the services they consume. The services are legacy, or created by another team.  And most services are not RESTful. Also, mixing RESTful and non-RESTful service-handling wouldn't be worth the trouble since the payoff for RIA REST comes from centralizing functionality. </p>
<p>But what if one is in a position to create the services and the RIA together, would it be worth it?</p>
<p>Not if your project is small or simple. In that case, the most agile approach would be to let the development of the interfaces drive the development of services. However, as a project grows more complex, the virtues of a RESTful API become more apparent.</p>
<p>Evangelists of REST like the Rails community preach the virtues of a RESTful API: its nounish services make it more human-readable, provide a convenient portal for delivering various formats (noun.xml, noun.amf), and protectively encapsulate the API by shielding it from particular syntactical demands. </p>
<p>This last virtue is of most interest to a parochial RIA developer like myself. I found that thinking in noun while working solo, on both the server and the client sides, on a medium-complexity RIA project did add overhead, but, over the long run, it paid off. </p>
<p>I didn't waste time on syntax. I was able to generalize delegation and delegate commands so that adding any resource was a matter of one line. On the API side, thinking in noun kept the API fresh and elastic. Adding another resource was not trivial, but it did often build nicely on elaborations I made on the models to accommodate another resource.  I tended to add resources rather than undertake extensive refactoring. </p>
<p>All in all, by depending on RESTful services and their severely limited syntax, I kept relations between the server and the client both distant and amicably simple. I'm now curious to know how a RESTful project would work out in a team environment, whether it would make the interaction of back enders and front enders more productive.</p>
<h3>Beyond the VO</h3>
<p>A deep challenge in treating your resources RESTfully is dealing with nested data. Here is a simple case: When a user logs in, a session is created and returned to the RIA. And typically that session would return a UserVO nested inside the SessionVO.  Now suppose the user changes his password and updates it. What has to happen?</p>
<p>First, there needs to be a user resource defined. Second, the nested UserVO needs to go into this resource. Third, that UserVO needs to be throw at the sky and caught on the rebound. </p>
<p>So far I've handled this by defining the nested UserVO manually, then firing a Rails-style "after_filter" function in ApplicationData::doOperation that looks for "session," and "create" parameters.  When it finds the UserVO it puts it into its resource and points the user property of the Session there. </p>
<p>Over time I've filled this filter function--which is just a big switch statement--with small data alterations.  A more ambitious approach would be recursively search for nested VOs when hierachical data arrives, then dynamically create resources for them and point their parents' properties at them. Only extra-special alterations would occur in the filter. </p>
<p>As long as I'm finger painting, I wondering if a centralized, uniform treatment of data would make it easier to put some basic, practical questions to a VO that are now pretty frustrating:</p>
<p>Do you already exist here?<br />
Does that empty property of yours point to a VO that already exists here?<br />
Can you convert that id property into an actual nested VO?</p>
<p>It's easy to normalize a database, less easy to normalize an API, RESTful or not. Duplicate VOs crop up. So it'd be nice if ResourceProxy was queryable. It would be even nicer if one VO was automatically forced to overwrite another VO in the ResourceProxy. Also, basic Rails-type associations--in which some kind of VO proxy could access ResourceProxy to find locally or retrieve remotely its VO's empty properties--might be worth the trouble if the RIA consumed and updated a lot of nested data. </p>
<p><em>Holy Smokes, ALL of this (REST services automated, rudimentary ORM) and much more has ALREADY been done for Ruby-based projects: <a href="http://restfulx.github.com/"> RestfulX</a> by Peter Armstrong and Dima Beristau. And what a coincidence, the idea gestated in me after reading Armstrong's Flexible Rails! I think I need to speed up my metabolism...and dive into this framework, which promises to be the first integrated, full-stack framework that includes Flex.<em></p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2009/04/15/simpler-ria-with-rest/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Self-Explaining Interface</title>
		<link>http://pet-theory.com/blog/2009/04/09/a-self-explaining-interface/</link>
		<comments>http://pet-theory.com/blog/2009/04/09/a-self-explaining-interface/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 19:09:37 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Flash]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/?p=190</guid>
		<description><![CDATA[A self-evident interface is always Plan A...but a self-explaining interface is a decent Plan B. Here is one in action. (Follow the purple arrow...not optimized for start up yet.) 
"As simple as possible, but no simpler." For my current Flex project I reached this point pretty quickly.  Inspired by improv, it is a chat [...]]]></description>
			<content:encoded><![CDATA[<p>A self-evident interface is always Plan A...but a self-explaining interface is a decent Plan B. <a href="http://www.pet-theory.com/chat/">Here</a> is one in action. (Follow the purple arrow...not optimized for start up yet.) </p>
<p>"As simple as possible, but no simpler." For my current Flex project I reached this point pretty quickly.  Inspired by improv, it is a chat site that creatively orders group chat. There are roles (Host, Quizzer, Conservative, Blind Date, etc.) for a variety of scenarios, mostly drawn from pop culture. Chatterers vote for a scenario leader, who plays one role and picks others for the remaining roles. </p>
<p>For a game, it's not complicated. For an interface, it is. Some sort of help was required. <span id="more-190"></span>The obvious recourse was to a video link on the landing page. But while video help is a mega improvement on text help, it has the same mega drawback: it whisks the user away from the interface. </p>
<p>So how could help be directly integrated into the interface? Before going further, I laid down some requirements:</p>
<p>1. No going away.<br />
2. Turns on and off quickly.<br />
3. Scannable, bookmarkable.<br />
4. Demonstrates whole use cases.<br />
5. Updates automatically. </p>
<p>The implementation: </p>
<p>1. A slider as well as last/next buttons lie at the bottom of the site. Each page entails a new label and help contents.<br />
2. Here is the novel element: Clicking the buttons or dragging the slider causes the interface ITSELF to change: components are loaded with dummy data, controls are called out, navigations done. (And since the help is just steps thru the interface, when the interface is updated, the help is automatically "updated.")<br />
3. If the help controls lose focus, help disappears. Once they regain focus, the user finds herself at the same point in help. The slider can be used to scan help steps. </p>
<p><a href="http://pet-theory.com/blog/wp-content/uploads/2009/04/slider.gif"><img src="http://pet-theory.com/blog/wp-content/uploads/2009/04/slider.gif" alt="slider" title="slider" width="359" height="133" class="aligncenter size-full wp-image-225" /></a><br />
<a href="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpdata.gif"><img src="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpdata.gif" alt="helpdata" title="helpdata" width="365" height="200" class="aligncenter size-full wp-image-223" /></a></p>
<p><a href="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpnavigations.gif"><img src="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpnavigations.gif" alt="helpnavigations" title="helpnavigations" width="347" height="190" class="aligncenter size-full wp-image-224" /></a></p>
<p><a href="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpcode.gif"><img src="http://pet-theory.com/blog/wp-content/uploads/2009/04/helpcode.gif" alt="helpcode" title="helpcode" width="348" height="183" class="aligncenter size-full wp-image-222" /></a></p>
<p>Only user testing will tell whether this kind of self-explaining interface is better than video.  Either way, it's a good example of what a rich, stateful client like Flex can do. </p>
<p><a href="http://www.pet-theory.com/downloads/interfaceExplainer.zip">Here</a> is the package. Not commented. I'll clean it up if people are interested. It's basically commands structured in a composite hierarchy that is flattened and stepped thru. I thought about elaborating Flex states, or using the state interface that the history manager uses for deep linking, but neither was general enough. I wanted help sequences that could build hierarchically or linearly, and involve callouts or navigations or whatnot.  The result might be useful inside a testing framework. </p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2009/04/09/a-self-explaining-interface/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Stupidity-Preserving Interface</title>
		<link>http://pet-theory.com/blog/2008/10/09/a-stupidity-preserving-interface/</link>
		<comments>http://pet-theory.com/blog/2008/10/09/a-stupidity-preserving-interface/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 20:09:52 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[interface]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/2008/10/09/a-stupidity-preserving-interface/</guid>
		<description><![CDATA[Googling is one of those things that has so saturated my life that it now seems trivial. How did programmers operate before Google? Images flit before the mind...IRC, books, co-workers...but seriously, for someone who searches hourly, the mind boggles.
If you live with Google for a while, the controversy about the Web's inclusivity--how can we sift [...]]]></description>
			<content:encoded><![CDATA[<p>Googling is one of those things that has so saturated my life that it now seems trivial. How did programmers operate before Google? Images flit before the mind...IRC, books, co-workers...but seriously, for someone who searches hourly, the mind boggles.</p>
<p>If you live with Google for a while, the controversy about the Web's inclusivity--how can we sift the smart from the dumb?--is useless. When I was a stupid programmer, I found a lot of slightly-less-stupid blog posts, tutorial and articles that spoke to the stupid in me. When I become less stupid, other voices beckoned. The web grows with me. </p>
<p>Lately I've been wondering whether the web should preserve even more stupidity. When I really look at the hours I rack up programming, far too many of them are consumed with stupid mistakes, especially when starting fresh on a new kind of task, language or project. Google is still helpful then, but all too often I find myself grinding through some stupidity alone.</p>
<p>This is partly due to the fact that the set of smart, conceptual mistakes is a minor subset of all possible mistakes. "It's" v. "Its" is downright hi-concept... "accommodate" v. "acommodate", "accomodate", "accommadate" is nearly random in comparison. Not even the web can preserve all the permutations of sheer error.</p>
<p><span id="more-164"></span></p>
<p>But there are other factors that inhibit the free flow of stupidity onto the web. One is, of course, shame. Who wants to be that guy, who, in middle of a series of comments on an exciting blog post, whines "But I can't compile!!!!" I certainly don't...and the web is definitely a better place for this reticence.</p>
<p>Another factor is interest. Some mistakes are inherently interesting. Correcting them leads one deeper into the mystery. Others, not so much. We identify them, we move on.</p>
<p>There is a cost to this. How many times have I sat typing into a input box, then, forced by articulation to confront my stupidity, seen right through it? And how many times have I then minimized the browser and gotten right back to work? And because I kept this "duh!" to myself, how many others have to sit typing into their input boxes...</p>
<p>So be it, you might say. Google is the instructress of the self-taught, and she alternate sterness with indulgence, occasionally forcing us to gut it out. But isn't it better to spend those hours wrestling with onward-leading mistakes rather than infuriating trivia? </p>
<p>Clearly this is an interface problem. A stupidity-preserving interface would encourage people to post stupid problems and stupid solutions. Newbie forums are an excellent start. But less segregated solutions would entail giving forum or wiki members temporary anonymity, or allowing them to rank their own contributions or questions low priority or "stupid," or allowing discussions to branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2008/10/09/a-stupidity-preserving-interface/feed/</wfw:commentRss>
		</item>
		<item>
		<title>You already know what unit testing is.</title>
		<link>http://pet-theory.com/blog/2008/08/06/you-already-know-what-unit-testing-is/</link>
		<comments>http://pet-theory.com/blog/2008/08/06/you-already-know-what-unit-testing-is/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:25:04 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://pet-theory.com/blog/2008/08/06/you-already-know-what-unit-testing-is/</guid>
		<description><![CDATA[Today I learned how to use rspec, the Rails plugin. It was my first experience with unit testing, and it seemed eerily familiar.
You know when you write a class and then instantiate it and throw a couple of curveballs at it just to make sure it works? And then you write a related class, and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I learned how to use <a href="http://rspec.info/">rspec</a>, the Rails plugin. It was my first experience with unit testing, and it seemed eerily familiar.</p>
<p>You know when you write a class and then instantiate it and throw a couple of curveballs at it just to make sure it works? And then you write a related class, and throw both of them in the air for a few compiles? </p>
<p>That's it. That's what unit tests do. I had read a few tutorials on it, but their simple data class examples weren't vivid enough to help me make this connection to my own practice.</p>
<p>It's turning my stomach a little to realize how much time I've wasted. Informal unit testing is hugely inefficient. With informal unit testing, your little experiments are pretty much tossed into a big dark ditch. With formal unit testing, you can always run them again, which is priceless when you make a modification and need to make sure nothing has been broken. I get that now. Amen.</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2008/08/06/you-already-know-what-unit-testing-is/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Faster development with AS3?</title>
		<link>http://pet-theory.com/blog/2007/10/16/faster-development-with-as3/</link>
		<comments>http://pet-theory.com/blog/2007/10/16/faster-development-with-as3/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 17:04:14 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[code]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/2007/10/16/faster-development-with-as3/</guid>
		<description><![CDATA[I was talking with my boss tonite about a big project coming up. He was explaining that a client was thinking of building a new site in AS2. I was dismayed. After developing with AS3 for a while, I was doing some AS2 work and hating it.  After AS1, AS2 was a godsend, but [...]]]></description>
			<content:encoded><![CDATA[<p>I was talking with my boss tonite about a big project coming up. He was explaining that a client was thinking of building a new site in AS2. I was dismayed. After developing with AS3 for a while, I was doing some AS2 work and hating it.  After AS1, AS2 was a godsend, but after AS3, AS2 is a huge pain in the ass.</p>
<p>He patiently explained to me that my personal likings were not the only factors to consider.  There was a lot of AS2 code that could be re-used. AS3 developers were rare and expensive, and training takes time. Etc.</p>
<p>In truth, weighing all these factors is above my pay grade. He is probably right in this case.  But, of course, that's not what I said. Instead, I threw out that AS3 development is just faster. </p>
<p><span id="more-159"></span></p>
<p>Faster? Because of the event model? The display list? My boss didn't quite believe me. He knew about the performance gains, but AS3 looked quite similar to AS2 to his coder's eyes.</p>
<p>They do look similar, but because I've developed with both, I can say that whatever takes me 100 minutes in AS2 takes me 70 minutes in AS3. </p>
<p>Why? It mainly has to do with two very mundane factors: the compiler catching undefined variables (a.k.a. typos), and the player catching run-time errors. When I'm working in AS2, without these advantages, I have to compile every few lines.  Otherwise you find yourself with a program that does not work and absolutely no frakking idea where it went wrong. </p>
<p>Unfortunately, the staccato interruptions of compile-compile-compile is like babysitting a small child. It prevents me from thinking clearly about programming logic.  Developing with AS3, on the other hand, is like conversing with an adult. I can actually finish a continuous thought. I'll often sketch out a whole structure in code, and even modify it once or twice, before compiling. Then I'll spend a few minutes mechanically correcting the little mistakes--and bang, it works. Honestly, it still surprises me. </p>
<p>The structure of the language also helps me think clearly. To make AS2 sing, you have to keep a large number of hackish details at your finger tips: delegates, attachBitmap, MovieClip, etc. Mastering these hacks is not rocket science, but only when you move to AS3 do you realize how much of your mental RAM has been engorged by them. </p>
<p>AS3 is just simpler and more logical. Often I can skim a native package and guess what classes can be found within, or just instantiate an unfamiliar class and use auto-completion to locate the likeliest methods. I don't have to keep the details in mind because the details follow from one another.  As a result, I spend less time thinking about the language, and more time thinking about something much more interesting--solving problems.</p>
<p>It could be AS3 gives me an unsually large productivity boost because I'm not as detail-oriented as the average programmer, and an organized language compensates for my unorganized mind.  But what about you? I'd love to tell my boss that other programmers are developing faster with AS3. </p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2007/10/16/faster-development-with-as3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Designing Pet 9: Transition Animations 99% Useless</title>
		<link>http://pet-theory.com/blog/2007/10/04/designing-pet-9-transition-animations-99-useless/</link>
		<comments>http://pet-theory.com/blog/2007/10/04/designing-pet-9-transition-animations-99-useless/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 18:14:04 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Flash]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/2007/10/04/designing-pet-9-transition-animations-99-useless/</guid>
		<description><![CDATA[In my last post, I reviewed the code architecture of my playground site. In this post, I'll explain its design.
I fear that the site will have all the charm of exposed pipe for the average Flash designer.  My fear is based partly on my primitive graphic-design skills, but mostly on the unusual nature of [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, I reviewed the <a href="http://pet-theory.com/blog/2007/05/19/building-pet-8-structure-for-an-html-like-all-flash-site/">code architecture</a> of my <a href="http://pet-theory.com/">playground site</a>. In this post, I'll explain its design.</p>
<p>I fear that the site will have all the charm of exposed pipe for the average Flash designer.  My fear is based partly on my primitive graphic-design skills, but mostly on the unusual nature of the interface.</p>
<p>Here is the interface:</p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/site.jpg' title='site'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/site.jpg' alt='site' /></a></p>
<p><span id="more-130"></span></p>
<p>When the user rolls over a button on the home page, information about the potential destination appears in a centralized "hotbox," temporarily replacing the title.  A hotbox is like alert, except that it is statically integrated into the design and--like a status bar--is continually updated by user actions. A hotbox is especially useful when a user wants to quickly browse a bunch of options and make decisions with more information than a label or a sentence can impart:</p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/rollover.jpg' title='rollover'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/rollover.jpg' alt='rollover' /></a></p>
<p>When a user clicks, if the content is loaded, it immediately appears in the center; otherwise a progress bar intercedes between the click and the content:</p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/content.jpg' title='content'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/content.jpg' alt='content' /></a></p>
<p>Notice that controls special to the content appear above the default controls, a home button and a history slider. Either control allows the user to restore home quickly. </p>
<p>Not the most complicated site. But deliberately so. Let me point out several unusual simplifications:</p>
<p><b>The default transition animation is none.</b> Why animate a transition? Web browsing and desktop applications have accustomed users to content that blinks into existence, displacing existing content. There might be a few occasions where animations orient users, but how many add cognitive value on the average Flash or Flex site? 1 in 50?</p>
<p>Worse than unnecessary, animation transitions are slow and typically impede the interaction. Who wants to wait, even half a second, especially for content the happy-clicking user is just checking out? Also, it's repetitious. The same animation plays every time the user loads the same content, or--cue gritting of teeth--every time the user loads any content.  Hey, Flash designer, say something once, why say it again? </p>
<p>Often transition animations hide downloads. But this sleight of hand is weak.  It forces the designer into a foolish consistency (playing the animation again even when content is already loaded), or into a foolish inconsistency (the second play differs from the first). Better to be candid and show the progress bar or a content-specific preview.</p>
<p>The slickest Flash designers have already started abbreviating their transitions. Many employ now what I think of as "last, longest yard" animations: the animation is essential completed before it begins, like the fade-in that starts at 75% alpha and briskly reaches 100%. I wonder why these designers don't--like Cosmo Kramer trying out boxers, then going commando--take the next logical step and abolish the animation altogether. </p>
<p>Could it be that they fear that if they took all the transition animations out of their bag of tricks, it would be empty, and HTMLers could take their jobs? I think that Flash has become an entire, powerful platform, and there are tons of potential designs that don't require the tedium of transition animations or the tics of motion design.</p>
<p>You might think I'm talking about applications, not traditional rich-media sites. Actually, no. Even on a movie site, for instance, superflous, self-import transitions make me want poke the designer in the eye. There are a multitude of expressive ways to use Flash on such a site, and I'll bet designers would find them if they weren't busy shaking Adobe Inc.'s moneymaker. </p>
<p><b>History is absolutely necessary.</b> HTML has its virtues. One of the most outstanding is the history.  Because users know they can always hit the back button, they carelessly explore. Another winner is scrolling. The don't-look, can't-miss scroll bar nicely separate the action of the eye and the hand so the two can work together, the eye scanning while the hand drags. </p>
<p>I've combined these two HTML powers in one Flash widget: a history slider. Notice how the darker regions indicate the extent of the history:</p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/history.jpg' title='history.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/history.jpg' alt='history.jpg' /></a></p>
<p>Designers now enjoy a sliding history in the Flash IDE. Why not let users enjoy it, too? Since historical content has already been loaded (or at least browser-cached), it should be available for users to slide backwards and forwards.</p>
<p>Of course, for the slider to work, all the navigation transitions need to be immediate. Theoretically, a slider could scrub through tweened transition animations; practically, a long slider and cinematic reverse would be awkwardly literal. </p>
<p>Obviously this straight-to-content requirement is no deal-breaker for me. But you might wonder if I've put on a straightjacket when it comes to transition animations. I haven't.  In you peruse the playground site, you will see that I employ them when warranted.</p>
<p>To ensure that every navigation can be immediate, I created a two-track navigation system. In it, each navigation can take a slow track (if reacting to a click), or a fast track (if reacting to a slide).  In practice, since I favor immediate transitions by a wide margin, the slow track is identical to the fast or immediate track in the majority of cases. On occasion, a separate "slow" navigation (a fade-in, for example) is separately defined.</p>
<p>After making the history slider, I become so psyched about sliding that I constructed a slider-inspired widget, the "puller." The puller looks like a button, but acts like a slider. As the button is pulled (in any direction), content--whether texts, pictures, audio, or a combo--cycles through the hotbox: </p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull0.jpg' title='pull0.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull0.jpg' alt='pull0.jpg' /></a></p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull1.jpg' title='pull1.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull1.jpg' alt='pull1.jpg' /></a></p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull2.jpg' title='pull2.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull2.jpg' alt='pull2.jpg' /></a></p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull3.jpg' title='pull3.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/pull3.jpg' alt='pull3.jpg' /></a></p>
<p>The advantage of the puller is that it takes up less space than a slider. It's best for unlabeled or easily identified content. In my site, each experiment is accompanied by an information or "i" button that can be pulled. </p>
<p><b>Controls should be grouped together.</b> Whether Flash- or HTML-based, web sites differ from electronic gizmos because, instead of grouping controls, they disperse them.</p>
<p>The reason for this is obvious: a site has divided content, and the controls follow the content. Think of a typical site whose home page is divided into boxes, each with a link button at the bottom right of the box. Nothing could be more natural than examining the contents of the box, then clicking on its link. </p>
<p>Still, up against the principle of "controls follow content," I propose a countervailing principle. Just as developers have sought to divide form from content, I think designers should attempt to "divide controls from content." The obvious example is a navigation bar, which remains in its own static space while the content changes.</p>
<p>In my playground site, the default controls (home button, history slider) sit at the bottom center. As new content is selected, the controls for the content typically appear above these default controls. This arrangement has two advantages:</p>
<p>1) When users wants to exercise control, they know where to look.</p>
<p>2) Controls are often used together (pause/play, home/new selection, last/info/next). Grouping them together allows the user to move easily from one to the next, and to form temporary habits, even muscle memories, which speeds up the tempo of action/reaction. Jerking a cursor from one control to another far-off control breaks up this tempo.</p>
<p>Notice that I have taken other measures to increase user confidence in the controls:</p>
<p>1) The controls are big for quick, brainless access. (Users can also right-click for a context-sensitive control menu.)</p>
<p>2) The controls are stylistically uniform and contrast with the content.</p>
<p>3) The controls are conventional, so, for example, the home button is like the browser home button.</p>
<p>4) Form follows function, so irrelevant distinctions are dropped. So video controls (play, pause, scrub) look exactly the same as audio controls and slide show controls. </p>
<p>Here are some controls: </p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/control1.jpg' title='control1.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/control1.jpg' alt='control1.jpg' /></a></p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/control2.jpg' title='control2.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/control2.jpg' alt='control2.jpg' /></a></p>
<p><a href='http://pet-theory.com/blog/wp-content/uploads/2007/08/controls3.jpg' title='controls3.jpg'><img src='http://pet-theory.com/blog/wp-content/uploads/2007/08/controls3.jpg' alt='controls3.jpg' /></a></p>
<p>I realize that these screen captures convey a definite exposed-pipe look for the controls. That I don't mind: I prefer Flash as vector punk (The Sex Pistols) to Flash as wannabee After Effects (Pink Floyd). Besides, my overarching aim was to create a mean, lean content-delivery beast that can deliver a wide range kind of content (video, audio, red, green, sad, happy) and curl up in the background without slanting the content.</p>
<p>A better, more graceful designer with a more restricted range of content to deliver could make a prettier site out of the same interface. And that is my hope! I don't intend this interface as a quirky personal expression, but as a template for forward-looking designers. Instant transitions, included history, and separate, grouped controls are formal structures that can be modified, mixed and matched.  </p>
<p>For the next post in this series, I'll discuss the experiments on the playground, and speculate more generally about what Flash content can be.</p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2007/10/04/designing-pet-9-transition-animations-99-useless/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Joy of Programming</title>
		<link>http://pet-theory.com/blog/2007/10/03/the-joy-of-programming/</link>
		<comments>http://pet-theory.com/blog/2007/10/03/the-joy-of-programming/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 17:37:37 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[code]]></category>

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

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

		<guid isPermaLink="false">http://pet-theory.com/blog/2007/10/03/the-joy-of-programming/</guid>
		<description><![CDATA[I was 35 when I started to program. And immediately I loved it. It was as if a part of my brain that had been locked away could suddenly cavort in the broad daylight of ongoing life. 
Having developed other skills and burnt though other passions, I was self-conscious about the joys of programming; I [...]]]></description>
			<content:encoded><![CDATA[<p>I was 35 when I started to program. And immediately I loved it. It was as if a part of my brain that had been locked away could suddenly cavort in the broad daylight of ongoing life. </p>
<p>Having developed other skills and burnt though other passions, I was self-conscious about the joys of programming; I wanted to know what this new thing was, and why it thrilled me. </p>
<p>Some joys were not specific to programming per se but would attend the learning of any skill.  Obviously, it's cool to know how to do stuff.  I remember vividly the stultification of my three brothers (an accountant, a lawyer, an engineer) when they started their careers, and even more vividly how they slowly got pulled into the details and the drama of their craft. As <em>Moby Dick</em> proved with whole chapters on subjects like stripping of whale carcasses, almost anything can be made intriguing. In the future, maybe bird-watching, souffle and design patterns will each have a cable channel devoted to them.</p>
<p><span id="more-129"></span></p>
<p>Then there were the programming-specific joys:</p>
<p><b>Direct Power</b> Just about any activity can be described as a feedback loop: act, observe, act again. And just about any job, too. But, as you might be aware, in most jobs, the loop is broken, or just as often, necessarily indirect or complicated.  </p>
<p>The act of programming in contrast is a freaking video game. The result of your action is as immediate as a trace(), and the solution is in your power, Space Cadet Jones! I'm exaggerating, but between the M.B.A. with her estimates and the painter standing back to appraise his latest stroke, the programmer stands nearer the painter. </p>
<p><b>Program as Person</b>  I can track my evolution as a programmer by relative prominence of bug types: first the mangled syntax, then the logical slips, then the crossed wires, and so on.</p>
<p>At some point, the bugs become weirdly...<i>inflected</i>. They seem stupid and stubborn, yes, especially when the debugging has gone on too long, but also cute, ironic, tart. This happens when the program becomes so complex that you can't load all its mechanisms in your mind at once. At that point, the program begins to seem autonomous, like a separate, self-directed entity. </p>
<p>Human beings have demonstrated a capacity to "humanize," personifying trees, rubber dolls, cars, etc. So it shouldn't be be surprising when programmers relate to their thinking machines likewise. In fact, I was not surprised when I found myself being cross with a program, sometimes even feeling betrayed. I've kicked and cursed my Honda, after all. </p>
<p>What did surprise me was the flip side of this low-level personification. If I felt hostile sometimes, sometimes I also felt like the program was like an especially helpful comrade, or an interesting woman who entices and eludes me, or a child in need of nurturing. Maybe I should get out of the house more, but I count these feelings among the joys of programming.</p>
<p><b>Cosmic Delusion</b> There's a great scene in Johnson's <i>Rasselas</i> where Rasselas and his roving crew visit an astronomer. The astronomer lives alone in a tower, and he sheepishly confesses that he has come to believe his thoughts can move the stars.  </p>
<p>As I start dealing with non-language specific patterns and information architecture, I often remember the astronomer, because the more abstract my programming becomes, the more prone I become to random cosmic sensations like those I had as a LSD-addled youth watching cigarette smoke swirl: "It's <em>all</em> part of this vast...<i>system</i>."</p>
<p>These sensations are partly triggered by the abstraction. Once you construct a useful model, it's easy, like Plato, to think the model itself is a higher, better reality. </p>
<p>But there is also something in the nature of programming itself that gooses the mind's ambitions. First, it's an odd mixture of subjective and objective.  A programmer works alone at his desk writing characters in a text file, knowing full well there are myriad ways to write these characters, depending on his habits and mood...and at the same time, the result of this extremely subjective process is objective: it works, and works the same for anyone who runs the code. So it's understandable if a programmer having a very productive day mistakes his over-caffeinated intuitions with something grand or objective.</p>
<p>Second, programming demonstrates the astonishing power of reduction. The first rush of a neophyte programmer is realizing that programming languages largely depends on a small set of concepts: conditionals, datatypes, arrays, loops, etc. Once she masters these, the next language is just a few weekends and a "hello world!" away. The next rush is realizing what a broad spectrum of problems can be solved by combining these narrow concepts. It's as if you've just learned the 26 letters of the alphabet and realized that you could write an entire dictionary.  (The only comparable rush I've had is reading German philosophers, who permutate a small number of concepts with such subtlety that their systems seem to absorb any fact, no matter how particular.)</p>
<p>Scientist gave up the idea that the whole universe can be explained by a few basic laws in the nineteenth century...but when a programmer wrestles with a stretch of code, making it simpler and simpler until simplicity, beauty and utility converge, then, for a bit, the old-timey dream of a few special, cosmic keys revives. </p>
<p>I don't mean to imply here that programmers are more cosmically-inclined than the average person. The reverse is definitely the case. I'm just guessing at the whys and wherefores of the transient highs I've felt while coding. Nor I am criticizing those joys based on delusion. I accept that most pleasures are laced with delusion. When I look at my Rosario Dawson wallpaper, some small, silly part of me thinks I might get to sleep with her, just as when I was a student and swam far into the Pacific ocean with a fearless, seal-like Norwegian buddy of mine, some small, silly part of me exulted that death was cheatable. </p>
<p>Of course, I'm never going to sleep with Rosario Dawson, or cheat the Grimster. But I'm going to treasure that wallpaper and keep swimming, and I hope programming remains a blast. </p>
]]></content:encoded>
			<wfw:commentRss>http://pet-theory.com/blog/2007/10/03/the-joy-of-programming/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
