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

<channel>
	<title>Infrequently Noted &#187; programming</title>
	<atom:link href="http://infrequently.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://infrequently.org</link>
	<description></description>
	<lastBuildDate>Fri, 18 Nov 2011 16:25:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Real Constructors &amp; WebIDL Last Call</title>
		<link>http://infrequently.org/2011/10/real-constructors-webidl-last-call/</link>
		<comments>http://infrequently.org/2011/10/real-constructors-webidl-last-call/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 14:10:03 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1693</guid>
		<description><![CDATA[For those who haven&#8217;t been following the progress of WebIDL &#8212; and really, how could you not? An IDL? For the web? I&#8217;d like to subscribe to your newsletter&#8230; &#8212; the standard is now in last call, which is W3C for &#8220;alllllllllllmost done&#8221;. Which it is not. Before I get to why, let me first [...]]]></description>
			<content:encoded><![CDATA[<p>For those who haven&#8217;t been following the progress of WebIDL &#8212; and really, how could you not? An IDL? For the web? I&#8217;d like to subscribe to your newsletter&#8230; &#8212; the standard is now in <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">last call</a>, which is W3C for &#8220;<em>alllllllllllmost</em> done&#8221;.</p>
<p>Which it is not.</p>
<p>Before I get to why, let me first say some nice, well-earned things about WebIDL: first, it has helped us out of the ad-hoc IDL sludge that used to be how APIs for JavaScript have been exposed in the past. It has shaved off many sharp edges and is giving spec authors a single dialect in which to write their API descriptions. From a browser perspective, this is a <em>Very</em> Good Thing (TM). Next, the draft in question contains some wonderful changes from the status quo, particularly the <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/#interface-prototype-object">addition of a sane prototype to all WebIDL-specified objects</a>.</p>
<p>That all sounds good, so what&#8217;s missing?</p>
<p>In a word, constructors.</p>
<p>Well, a lot more than that, but I&#8217;d settle for constructors. Functionally speaking, it boils down to the fact that WebIDL makes spec authors do extra work to make something like this sane:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">new</span> HTMLDivElement<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Why doesn&#8217;t this work today? Funny story&#8230;see, HTML defines <a href="http://www.w3.org/TR/html5/grouping-content.html#htmldivelement">HTMLDivElement</a> as a regular WebIDL interface. WebIDL doesn&#8217;t really have the notion of concrete classes, just interfaces with and without constructors. Since the HTML spec is just doing what most specs will do &#8212; adding the smallest IDL you can get away with &#8212; the JS usability of this API is left in limbo; neither clearly HTML5&#8242;s responsibility nor WebIDL&#8217;s.</p>
<p>So what should a contentious version of HTML5 do? One answer is to specify a constructor, turning the IDL from this:</p>

<div class="wp_syntax"><div class="code"><pre class="idl" style="font-family:monospace;"><span style="color: #990078; font-weight: bold">interface</span> HTMLDivElement <span style="color: #66cc66;">:</span> HTMLElement <span style="color: #808080;">&#123;</span><span style="color: #808080;">&#125;</span><span style="color: #66cc66;">;</span></pre></div></div>

<p>to this:</p>

<div class="wp_syntax"><div class="code"><pre class="idl" style="font-family:monospace;"><span style="color: #808080;">&#91;</span>Constructor<span style="color: #808080;">&#93;</span>
<span style="color: #990078; font-weight: bold">interface</span> HTMLDivElement <span style="color: #66cc66;">:</span> HTMLElement <span style="color: #808080;">&#123;</span><span style="color: #808080;">&#125;</span><span style="color: #66cc66;">;</span></pre></div></div>

<p>Repeat ad-infinitum for each and every interface that <em>should</em> be constructable in every single spec that browser vendors ever implement. Don&#8217;t miss any! And please make sure that all your spec editors are on-board with good JS APIs as a goal! As it stands today, WebIDL doesn&#8217;t even force most spec authors to consider the question &#8220;do I need a constructor here?&#8221; &#8212; spoiler: <em>yes</em> &#8212; let alone the obvious follow-ups like &#8220;what arguments should one take?&#8221;.</p>
<p>The obvious better answer here is to flip the default on interfaces, causing them to generate constructors by default unless turned off with <code>[NoConstructor]</code> attributes or specified as <code>partial</code> interfaces (i.e., mixins or traits).</p>
<p>Cameron McCormack who is heading up the WebIDL effort <a href="http://twitter.com/#!/heycam/status/118784862164484096">tweeted in response to my exasperation</a> that:</p>
<blockquote><p>I think a &#8220;W3C Web API design guidelines&#8221; document would be a perfect place for such a recommendation.</p></blockquote>
<p>For serious? Such a document might be useful (and I&#8217;m working on something that might pass as a first draft), but what&#8217;s the argument against flipping the default here? This isn&#8217;t a dissent on the facts of the situation: most WebIDL &#8220;interfaces&#8221; that are exposed to JS are things that could be easily <code>new</code>&#8216;d up to useful ends. Most specs flub this in spectacular style. Most spec authors seem entirely ignorant of the problem and the design language of WebIDL continues to lead down a primrose copy-and-paste path that has little overlap with sanity. So why punt the decision? And why did it take and act of coordination with TC39 to get the prototype thing fixed?</p>
<h3>And Why Are We Having This Discussion Anyway?</h3>
<p>WebIDL, for all of its virtues, is deeply confused.</p>
<p>If you&#8217;re reading any of the stuff in the HTML5 spec that&#8217;s describing its API this way, it&#8217;s hard to see how it would have any sane relationship to JavaScript. Sure, you could argue that there might be other languages that matter, other languages for which you&#8217;d need to be able to generate some API, but none of them rise to anything like the importance of JavaScript. It <em>is</em> the programming language of the web, so if WebIDL has any animating force at all, it&#8217;s JS. Then there&#8217;s the &#8220;accident of history&#8221; aspect. Early DOM was specified as a form of IDL in part because there was some expectation that other languages would need to consume it and IDL was how C++ hackers (who still make up the entire set of people working on browser engines) are/were comfortable in describing their FFIs thanks to the legacy of COM/CORBA. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/#java-binding">Hilarious examples of multi-language-ism still persist in the WebIDL spec</a> for no apparent reason whatsoever, warping the entire design around the altar of an ideal that is either quixotic or vestigial depending on which argument you give more weight. </p>
<p><a href="http://lists.w3.org/Archives/Public/public-script-coord/2011JulSep/thread.html#msg114">Since the debate was re-kindled thanks to a debate at a TC39 meeting in July</a>, I&#8217;ve been on the receiving end of more than one webdev&#8217;s rant about DOM&#8217;s JS incoherence, generally taking the form:</p>
<blockquote><p>Why the *#!*?^@$ isn&#8217;t DOM just #@!*@ing specified in JavaScript?</p></blockquote>
<p>To be honest, I have no answer aside from pointing to the IDL history, the fact that browser hackers don&#8217;t tend to write JS so don&#8217;t feel the pain, and noting that WebIDL <em>is</em> better in some important ways. Certainly these interfaces <em>could</em> be specified in a subset of JS with annotations for where native behavior is required. But their larger lament has merit too: seamlessness with JS is the bar WebIDL should be judged by. I.e. does it help spec authors do the right thing by JS devs? Or does it lead them down paths that make their generated APIs stick out like sore thumbs, full of anti-social/alien behavior such that you can&#8217;t think of them as &#8220;regular&#8221; JS?</p>
<p>Yes, constructors are only one minor step toward reaching this aspiration, but the fact that WebIDL has gotten to last-call without a reasonable solution to them speak volumes. If WebIDL <em>isn&#8217;t</em> animated by the need of JS developers, it would be good if that could be loudly called out somewhere so that the community can have the spirited debate that this point demands. If it is, can we please get on discussing how best to ensure that most &#8220;interfaces&#8221; generate constructors and stop punting?</p>
<p>Either way, WebIDL isn&#8217;t done yet.</p>
<p><b>Update:</b> It occurred to me, as part of the discussion in the comments, that the provision against <code>new</code> with a class or type of any type is completely non-sensical in JS, as is the lack of <code>call()</code> and <code>apply()</code> methods on them. Idiomatic subclassing requires that the mixin-style be available, which uses <code>ClassName.call(this)</code>. This is what you&#8217;d do with things that are &#8220;virtual&#8221; or &#8220;partial&#8221; interfaces if you&#8217;re describing them in actual JS. And there&#8217;s no real problem with folks <code>new</code>-ing them up. Doesn&#8217;t happen, doesn&#8217;t matter. Strong restrictions against it are, to quote Andrew DuPont, anti-social. Long story short: <b><em>there is absolutely no reason whatsoever to disable construction on any WebIDL interface. It&#8217;s deeply non-sensical from the JavaScript perspective.</em></b></p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2011/10/real-constructors-webidl-last-call/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Half Lives</title>
		<link>http://infrequently.org/2011/03/half-lives/</link>
		<comments>http://infrequently.org/2011/03/half-lives/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 16:04:02 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1616</guid>
		<description><![CDATA[I&#8217;m headed to Austin soon for spring break SxSWi, and this year I&#8217;m lucky and grateful to be representing Chrome on the always-packed browser panel (more usable Lanyrd talk page here). The context for this year&#8217;s panel is interesting to me &#8212; a couple of years into a renewed era of browser competition, users have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m headed to Austin soon for <del>spring break</del> SxSWi, and this year I&#8217;m lucky and grateful to be <a href="http://schedule.sxsw.com/events/event_IAP7286">representing Chrome on the always-packed browser panel</a> (more usable <a href="http://lanyrd.com/">Lanyrd</a> talk page <a href="http://lanyrd.com/2011/sxsw/scrxm/">here</a>). The context for this year&#8217;s panel is interesting to me &#8212; a couple of years into a renewed era of browser competition, users have more choice but developers are still struggling with the same landscape, even as HTML5 starts to materialize as the platform of choice for <em>most</em> apps &#8212; even the ones wrapped up in native wrappers to jump the various app-store-form distribution hurdles.</p>
<p>It&#8217;s good to see <a href="http://ie6countdown.com/">MSFT belatedly trying to put IE6 out to pasture</a>, but what about IE 7? Or 8? Lets take stock of where we really are and where we&#8217;re likely to be in the next couple of years. First, remember that there&#8217;s no IE 9 for Windows XP &#8212; an OS that&#8217;s currently the most popular in the world &#8212; and no matter what happens with IE 6, IE 8 is the end of the upgrade road for XP. Unless you think half of the world&#8217;s computers will be replaced/upgraded in the next couple of years, it seems likely that IE 8 will be with us for the foreseeable future.</p>
<p>And what about the folks who <em>do</em> get IE 9? Well, so far, there&#8217;s nothing to make me believe that the uptake rate will be anything better than the IE 8 transition; a process which has taken 2 years to give ~30% of the market the latest version. If anything, we should expect that rate to be retarded somewhat by the XP hurdle.</p>
<p>MSFT&#8217;s browser replacement rates bear understanding because they&#8217;re the most popular and suffer from the longest half-lives. That is to say, the time it takes for an old version of IE to decay in the wild is much, much higher than for other browsers. Some part of this is surely due to sheer market share, but not all of it. The XP hurdle, for instance, is a form of structural drag on uptake rates &#8212; a flaw that browsers that aren&#8217;t tightly tied to OSes don&#8217;t suffer from. For web developers, I dare say that half-life of popular browsers matters much, much more than the current or trending market share since it&#8217;s predictive of our potential for browser improvement in the near future. It&#8217;s one thing to get the new shiny, but how long will it take you to install it? If the shiny is old and dingy by the time it&#8217;s in place, what good is that? It&#8217;s this lens that makes browser market share stats interesting to me; i.e., what percentage of the web&#8217;s users will get the new features soonest? &#8216;Cause those are the folks we can start building super compelling content for.</p>
<p>The average half-life of the majority of browsers in the wild also gates the rate of progress in standards. When the process is working well, bugs in browsers or pre-standards implementations of features aren&#8217;t a permanent features of the landscape. Instead, they&#8217;re the understandable and inevitable result of a process that prioritizes implementation experience and iteration over raw compliance with an academic spec that may or may not actually get it right on the first go &#8217;round. But that iterative, feedback-rich process only works when browsers iterate quickly and web developers can target the future without thinking so hard about the past, else progress simply turns into something to resent and distrust. That&#8217;s good for no one, and a shorter half-life is the key to making progress more than just a spec-tease.</p>
<p>I&#8217;m personally hopeful that when IE 9 is finally RTM&#8217;d, that it includes some provisions for shortening its life expectancy in the ways that Chrome and Firefox have through aggressive auto-updating. Getting IE 9 out to the world will be a good thing, but only if it happens quickly and if IE 10 can follow it even faster.</p>
<p>There&#8217;s obviously a lot more to talk about at the browser panel &#8212; <a href="http://chrome.blogspot.com/2011/03/speedier-simpler-and-safer-chromes.html">Chrome 10 just launched with Crankshaft</a>, for instance &#8212; but the fact that nearly every Chrome user will have those improvements <em>this week</em> and that if you&#8217;re building a Chrome Web Store app, you&#8217;ll get to target those improvements nearly instantly seems like the biggest, most interesting change from where we were just a couple of years ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2011/03/half-lives/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>&#8220;But IE 9 Is Just Around The Corner&#8230;&#8221;</title>
		<link>http://infrequently.org/2010/09/but-ie-9-is-just-around-the-corner/</link>
		<comments>http://infrequently.org/2010/09/but-ie-9-is-just-around-the-corner/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 18:03:46 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[chrome]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[chromeframe]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1462</guid>
		<description><![CDATA[The single most frustrating thing for me as a web developer is the incredible disconnect between day-to-day development and the shiny, shiny stuff showing up in HTML5 and modern browsers. It&#8217;s made all the more frustrating by bold pronouncements from any (every?) vendor about how much more awesome the web will be thanks to the [...]]]></description>
			<content:encoded><![CDATA[<p>The single most frustrating thing for me as a web developer is the incredible disconnect between day-to-day development and the shiny, shiny stuff showing up in HTML5 and modern browsers. It&#8217;s made all the more frustrating by bold pronouncements from any (every?) vendor about how much more awesome the web will be thanks to the shiny stuff their upcoming release. The reality for web developers is that those features <em>won&#8217;t matter on a relevant time-scale</em>. Not your next project. Not your next 5 projects. No, the lag today between new features and when you can use them might as well be measured in geologic time.</p>
<p>How bad is it? The next time you read some tech journalist write about how some new browser version is just around the corner and how it&#8217;ll make everything better, remember that:</p>
<ul>
<li><a href="http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=10">50+% of Windows users are on XP</a> a <a href="http://en.wikipedia.org/wiki/Windows_7">year after Windows 7 shipped</a> and <a href="http://en.wikipedia.org/wiki/Windows_Vista">3.5 years since Vista shipped</a></li>
<li>Windows XP will be supported until <em>2014</em>, giving organizations on XP extra breathing room to limp along on IE 6-8</li>
<li><a href="http://www.msnbc.msn.com/id/39235363/ns/technology_and_science-tech_and_gadgets/">There will be no IE 9 for Windows XP</a></li>
<li>After something like 4 years of MSFT urging customers in the strongest possible language to get off of IE 6, it still has <a href="http://marketshare.hitslink.com/browser-market-share.aspx?qprid=3">16%</a> of the market, and it&#8217;s not falling nearly fast enough. At the current 0.75%/month dropoff, we&#8217;re looking at 20+ more months of IE 6. At this rate, kids born today will be walking and maybe even talking by the time we can write IE 6 into the history books.</li>
</ul>
<p>The goal here isn&#8217;t to drive you to drink, but to call out the dichotomy between when <em>users get features</em> and when <em>developers can address features</em>. For users, things tend to get better as soon as you pick up a new browser. Developers have to wait until <em>every user</em> makes that sort of choice. Said differently, users can benefit from the bleeding edge but developers are beholden to the late adopters.</p>
<p>We should cut tech journalists and users a <em>little</em> slack, though; in a world without adoption friction, the launch of a new feature would translate directly into the sort of &#8220;now you can build sites and apps with awesome thing X&#8221;. The instinct to believe that&#8217;s how it should be is spot on. But that&#8217;s observably not how the world works. Don&#8217;t believe the hype. New browsers alone haven&#8217;t fixed the problem so far, so what makes us think they will in future? No vendor wants to talk about their last version, but for web developers stuck in the trenches, that <em>all</em> there is to talk about. That&#8217;s where the pain is, after all, and counting on browser upgrades to fix the problem quickly isn&#8217;t working well enough. Chrome&#8217;s aggressive auto-update feature is changing the way things will work in future, but for now we&#8217;re still stuck in the slow-upgrade dynamic.</p>
<p>We need a <a href="http://code.google.com/chrome/chromeframe/">Plan B</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2010/09/but-ie-9-is-just-around-the-corner/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Whoa.</title>
		<link>http://infrequently.org/2009/01/whoa/</link>
		<comments>http://infrequently.org/2009/01/whoa/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 23:38:00 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[palm]]></category>
		<category><![CDATA[pre]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=867</guid>
		<description><![CDATA[Via Dion, Palm&#8217;s new Mojo framework for the Pre is based on Dojo! As far as I know, it was a total surprise to the Dojo community (myself included). I can&#8217;t wait to get started writing apps for this thing and see what device APIs Palm has surfaced.]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/archives/palm-mojo-uses-dojo-view-the-source">Via Dion</a>, Palm&#8217;s new <a href="http://developer.palm.com/">Mojo</a> framework for the <a href="http://www.palm.com/us/products/phones/pre/index.html">Pre</a> is based on Dojo!</p>
<p>As far as I know, it was a total surprise to the Dojo community (myself included). I can&#8217;t wait to get started writing apps for this thing and see what device APIs Palm has surfaced.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2009/01/whoa/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>OSCON 2009 Call For Papers Is Open!</title>
		<link>http://infrequently.org/2009/01/oscon-2009-call-for-papers-is-open/</link>
		<comments>http://infrequently.org/2009/01/oscon-2009-call-for-papers-is-open/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 21:35:20 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[opensource]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[oscon]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=865</guid>
		<description><![CDATA[I&#8217;m a bit tardy on this, but the OSCON 2009 Call For Papers is now open. In the past couple of years the shift from desktop-centric to a more web-centric OSCON has continued to make the conference useful and engaging, and great work on topics like JavaScript/Ajax performance, Dojo, Comet, and many of the emerging [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a bit tardy on this, but the OSCON 2009 Call For Papers <a href="http://en.oreilly.com/oscon2009/public/cfp/57">is now open</a>.</p>
<p>In the past couple of years the shift from desktop-centric to a more web-centric OSCON has continued to make the conference useful and engaging, and great work on topics like JavaScript/Ajax performance, Dojo, Comet, and many of the emerging back-end bits of infrastructure that make it all go have made my yearly trip to Portland worthwhile.</p>
<p>Great talks have gotten lost from the JavaScript/web track in years past because they&#8217;ve missed the submission deadline, so if you&#8217;re hacking on something fascinating, now&#8217;s the time to get that proposal in.  Make sure you flag it with the right track when you submit (javascript, ajax, web, or whatever they&#8217;re calling it this year), and don&#8217;t hesitate to ping me if you&#8217;re unsure about whether or not your talk got slotted correctly for the review process.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2009/01/oscon-2009-call-for-papers-is-open/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Census 2: More Than Just A Pretty Graph</title>
		<link>http://infrequently.org/2008/12/census-2-more-than-just-a-pretty-graph/</link>
		<comments>http://infrequently.org/2008/12/census-2-more-than-just-a-pretty-graph/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 15:59:07 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[dhtml]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[benchmarks]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=849</guid>
		<description><![CDATA[Numbers without context are lies waiting to be repeated.]]></description>
			<content:encoded><![CDATA[<p>Benchmarks are hard, particularly for complex systems. As a result, the most hotly contested benchmarks tend not to be representative of what makes systems faster for real users. Does another 10% on <a href="http://www.tpc.org/default.asp">TPC</a> really matter to most web developers? And should we really pay any attention to how <em>any</em> JS VM does on <a href="http://shootout.alioth.debian.org/">synthetic language benchmarks</a>?</p>
<p>Maybe.</p>
<p>These things matter only in regards to how well they represent end-user workloads and how trustworthy their findings are. The first is much harder than the second, and end-to-end benchmarking is pretty much the only way to get there. As a result, sites like <a href="http://www.tomshardware.com/">Tom&#8217;s Hardware</a> focus on application-level benchmarks while still publishing &#8220;low level&#8221; numbers. Venerable test suites like <a href="http://en.wikipedia.org/wiki/SPECint">SPECint</a> have even moved toward running &#8220;full stack&#8221; style benchmarks which may emphasize a particular workload but are broad enough to capture the wider system effects which matter in the real world.</p>
<p>Marketing departments also like small, easily digestible, whole numbers. Saying something like &#8220;200% Faster!&#8221; sure sounds a lot better than &#8220;on a particular test which is part of a larger suite of tests, our system ran in X time vs. Y time for the competitor&#8221;. Both may be true, but the second statement gives you some context. Preferably even that statement would occur above an actual table of numbers or graphs. Numbers without context are lies waiting to be repeated.</p>
<p>With all of this said, <a href="http://www.jamesward.com/blog/">James Ward&#8217;s</a> <a href="http://jamesward.com/census">Census</a> benchmark makes a valiant stab at a full-stack test of data loading and rendering performance for RIA technologies. Last month <a href="http://dojotoolkit.org/2008/11/05/flash-flex-versus-open-web-ajax">Jared</a> dug further into the numbers and found the methodology wanting, but given some IP issues couldn&#8217;t patch the sources himself. Since I wasn&#8217;t encumbered in the same way I thought I might as well try my hand at it, but after hours of attempting to get the <a href="http://sourceforge.net/projects/flexapps">sources to build</a>, I finally gave up and decided to re-write the tests. The result is <a href="http://textterm.com/census.html">Census 2</a>.</p>
<p><a href="http://textterm.com/census.html"><img src="http://alex.dojotoolkit.org/wp-content/uploads/2008/12/census2_main_small.png" style="border: 0px;"/></a></p>
<p>There are several goals of this re-write:</p>
<ul>
<li><b>Fairness.</b> Tests need to be run multiple times for them to be representative in any way. Likewise, systems not being directly tested need to be factored out as much as possible. C2 does this by reducing the number of dependencies and running tests (at least) 5 times and discarding outliers before reporting an average. I&#8217;ve also worked to make sure that the tests put the best foot forward for all of the tested technologies.</li>
<li><b>Hackability.</b> Benchmarks like Census serve first as a way for decision makers to understand options but second as a way for developers to know how they&#8217;re doing. Making it trivial to add tests helps both audiences.</li>
<li><b>Portability.</b> The test suite should run nearly everywhere with a minimum of setup and fuss. This ensures that the largest numbers of people can benefit from the fairness and hackability of the tests.</li>
</ul>
<p>The results so far have been instructive. On smaller data sets HTML wins hands-down for time-to-render, even despite its disadvantage in over-the-wire size. For massive data sets, pagination saves even the most feature-packed of RIA Grids, allowing the Dojo Grid to best even XSLT and a more compact JSON syntax. Of similar interest is the delta between page cycle times on modern browsers vs their predecessors. Flex can have a relatively even performance curve over host browsers, but the difference between browsers today is simply stunning.</p>
<p>Given the lack of an out-of-the-box paginating data store for Flex, RIAs built on that stack seem beholden to either Adobe&#8217;s <a href="http://www.adobe.com/products/livecycle/dataservices/">LCDS licensing</a> or are left to build ad-hoc pagination into apps by hand to get reasonable performance for data-rich business applications. James Ward has already exchanged some mail with me on this topic and it&#8217;s my hope that we can show how to do pagination in Flex without needing LCDS in the near future. </p>
<p>The tests aren&#8217;t complete. There&#8217;s still work to do to get some of the SOAP and AMF tests working again. If you have ideas about how to get this done w/o introducing a gigantic harball of a Java toolchain, I&#8217;m all ears. Also on the TODO list is an <a href="http://code.google.com/appengine/">AppEngine app</a> for recording and analyzing test runs so that we can say something interesting about performance on various browsers. </p>
<p>Census 2 is very much <a href="http://code.google.com/p/census2/">an open source project</a> and so if you&#8217;d like to get your library or technology tested, please don&#8217;t hesitate to send me mail or, better yet, attach patches to the <a href="http://code.google.com/p/census2/issues/list">Bug Tracker</a>.</p>
<p><b>Update:</b> I failed to mention earlier that one of the largest changes in C2 vs. Census is that we report <em>full page cycle times</em>. Instead of reporting just the &#8220;internal&#8221; timings of an RIA which has been fully boostrapped, the full page times report the full time from page loading to when the output is responsive to user action. This keeps JavaScript frameworks (or even Flex) from omitting from the reports the price that users pay to download their (often sizable) infrastructure. There&#8217;s more work to do in reporting overall sizes and times (&#8220;bandwidth&#8221; numbers don&#8217;t report gzipped sizes, e.g.), but if you want the skinny on real performance, scroll down to the red bars. That&#8217;s where the action is.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/12/census-2-more-than-just-a-pretty-graph/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Notes To A Future Self: Getting Productive On WinXP</title>
		<link>http://infrequently.org/2008/12/notes-to-a-future-self-on-de-sucking-xp/</link>
		<comments>http://infrequently.org/2008/12/notes-to-a-future-self-on-de-sucking-xp/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 21:15:20 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=844</guid>
		<description><![CDATA[Windows XP is truly a horrid desktop OS, particularly if you&#8217;re a programmer. The default install contains roughly nothing useful, and even getting a development environment going requires grabbing the likes of cygwin, Visual Studio, and a zillion patches from Microsoft. The truly dispiriting thing, though, is how badly cmd.exe still sucks. I fully admit [...]]]></description>
			<content:encoded><![CDATA[<p>Windows XP is truly a horrid desktop OS, particularly if you&#8217;re a programmer. The default install contains roughly nothing useful, and even getting a development environment going requires grabbing the likes of cygwin, Visual Studio, and a zillion patches from Microsoft.</p>
<p>The truly dispiriting thing, though, is how badly cmd.exe still sucks. I fully admit that my personal programming proclivities are not normal, but to be reasonably productive I need a Unix-like shell, a terminal that works (can be resized, has reasonable VT100 emulation, etc.), and the ability to fix the &#8220;Caps Lock&#8221; key to do the right thing &ndash; namely, have it fire the &#8220;Ctrl&#8221; key instead. This is all relatively straightforward to do on Linux and OS X. Here&#8217;s how I got it done with Windows:</p>
<h4>Do the MSFT Patch Dance</h4>
<p>Make coffee?</p>
<h4>Install Cygwin</h4>
<p>We&#8217;ve all <a href="http://www.cygwin.com/">done it a thousand times</a>. This&#8217;ll make 1001. It&#8217;s kind of comforting that the Cygwin home page hasn&#8217;t changed perceptibly in nearly a decade.</p>
<h4>Get SharpKeys</h4>
<p>Instead of fugly registry hacks, <a href="http://www.randyrants.com/2006/07/sharpkeys_211.html">SharpKeys</a> allows you to map the dreaded and useless &#8220;Caps Lock&#8221; key to something actually useful. If your key-mapping preferences swing some other way, SharpKeys can likely handle that too. Not sure why it&#8217;s not built into Windows, frankly.</p>
<h4>Set Up Puttycyg</h4>
<p>Having cygwin is nice, but having a terrible shell with Cygwin? Not so nice. Enter <a href="http://code.google.com/p/puttycyg/">Puttycyg</a>, a small hack on the venerable <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">Putty</a> SSH client for windows that provides an option to launch a local Cygwin session in lieu of connecting to another system. </p>
<p>Once I extracted it and ensured the Puttycyg directory was in my windows PATH, I created a desktop shortcut to the <code>putty.exe</code> included in the distribution and configured the shortcut (right-click) to read:</p>
<pre>
"C:\Documents and Settings\slightlyoff\Desktop\puttycyg\putty.exe" -cygterm -
</pre>
<p>And then set the &#8220;Shortcut key:&#8221; to be:</p>
<pre>
Ctrl + Alt + T
</pre>
<p>Now, whenever I want a fully functional shell from my desktop, I just hit that key combination and it All Works (TM).</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/12/notes-to-a-future-self-on-de-sucking-xp/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>delegate(), delegate(), delegate()</title>
		<link>http://infrequently.org/2008/10/delegate-delegate-delegate/</link>
		<comments>http://infrequently.org/2008/10/delegate-delegate-delegate/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 23:50:01 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[dhtml]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[boodman]]></category>
		<category><![CDATA[crockford]]></category>
		<category><![CDATA[delegate]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=786</guid>
		<description><![CDATA[My MBP batteries keep dying after about a year (each). I usually have 2 that I tote around with me, and each tends to be good for 1.5-2hrs of actual work. This means that I tend not to be able to work through a cross-country flight, and particularly not if I need a VM for [...]]]></description>
			<content:encoded><![CDATA[<p>My MBP batteries keep dying after about a year (each). I usually have 2 that I tote around with me, and each tends to be good for 1.5-2hrs of actual work. This means that I tend not to be able to work through a cross-country flight, and particularly not if I need a VM for anything (which is most of the time). I think that if Apple <em>does</em> <a href="http://www.macrumors.com/2008/10/09/apple-invites-media-to-notebook-event-october-14th/">rev the MBP&#8217;s on the 14th</a>, the things I&#8217;d pay for boil down to &#8220;more memory and much longer battery life&#8221;. The 5+ hour flight to <a href="http://ajaxexperience.techtarget.com/html/index.html">TAE</a> then provided a short window to do work in before I retreated to watching episodes of <a href="http://www.colbertnation.com/">The Colbert Report</a> on my phone. Knowing that i wouldn&#8217;t be able to work the whole time, I brought a copy of <a href="http://www.iam.unibe.ch/~scg/Archive/Papers/Duca06bTOPLASTraits.pdf">a great paper on Traits</a>. The paper got me thinking a lot about <code><a href="http://api.dojotoolkit.org/jsdoc/dojo/1.2/dojo.declare">dojo.declare()</a></code> and <code><a href="http://api.dojotoolkit.org/jsdoc/dojo/1.2/dojo.delegate">dojo.delegate()</a></code>.</p>
<p>Today, Dojo&#8217;s <code>delegate()</code> function is a straightforward implementation of the <a href="http://blog.youngpup.net/">Boodman</a>/<a href="http://www.crockford.com/">Crockford</a> delegation pattern which Doug calls &#8220;beget&#8221; and which ES 3.1 will refer to as <code>Object.create</code>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">dojo.<span style="color: #660066;">delegate</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// boodman/crockford delegation w/ cornford optimization</span>
    <span style="color: #003366; font-weight: bold;">function</span> TMP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        TMP.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> obj<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> tmp <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TMP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            dojo._mixin<span style="color: #009900;">&#40;</span>tmp<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> tmp<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Object</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This function returns a new object which looks to the old object for things it does not itself have. Imagine an object <code>foo</code> which contains pithy truisms:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  science<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;rocks!&quot;</span><span style="color: #339933;">,</span>
  learning<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;is how you know you're alive&quot;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We now want to promigulate our opinions, so we can delegate the responsibility of forming them:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> bar <span style="color: #339933;">=</span> dojo.<span style="color: #660066;">delegate</span><span style="color: #009900;">&#40;</span>foo<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
  testify<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;science &quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">science</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;and learning&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">learning</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, our <code>bar</code> object can change its mind independently of <code>foo</code>, but until it does, it&#8217;ll behave as though <code>foo</code>&#8216;s views are its own:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">bar.<span style="color: #660066;">testify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// outputs: &quot;science rocks and learning is how you know you're alive&quot;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// bar refines its opinion</span>
bar.<span style="color: #660066;">science</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;is a process&quot;</span><span style="color: #339933;">;</span> 
bar.<span style="color: #660066;">learning</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;requires humility&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">science</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;rocks!&quot;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// still true</span>
&nbsp;
bar.<span style="color: #660066;">testify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// outputs: &quot;science is a process and learning requires humility&quot;</span></pre></div></div>

<p>But what about when the chain gets deeper? The fact that <code>bar</code> can&#8217;t &#8220;see&#8221; <code>foo</code>&#8216;s values via <code>this</code> isn&#8217;t much of a problem when the hierarchy isn&#8217;t very long, but if you&#8217;re specializing a behavior or complex interaction, making it possible to get at the parent&#8217;s values for properties and methods becomes more pressing.</p>
<p>Neil has previously <a href="http://www.sitepen.com/blog/2008/03/16/are-you-sure-you-should-be-subclassing-that/">written about lightweight subclassing</a>, but for as good as it its, it doesn&#8217;t get us all the way there either. In regular OO-style languages, the inheritance system gives you an out via a &#8220;super&#8221; keyword or convention. This type of property shadowing-with-exceptions is a huge boon to composition in class-based languages, but it&#8217;s not the whole story. Indeed, the Traits paper was all about the shortcomings of this special-purpose mechanism. What we want for both long delegation chains and long inheritance hierarchies is a more general system; in essence a way to say &#8220;I want to control how things are shadowed and which ones an item points at in each level of the hierarchy&#8221;.</p>
<p>What if we could make <code>delegate()</code> savvy of this type of indirection? Here&#8217;s my quick prototype:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">delegate <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> tobj <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> TMP <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        TMP.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> obj<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> tmp <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TMP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> remaps <span style="color: #339933;">=</span> props<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>remaps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">delete</span> props<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #000066; font-weight: bold;">in</span> remaps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>tobj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> undefined <span style="color: #339933;">||</span> tobj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #006600; font-style: italic;">// support hiding via null assignment</span>
                            tmp<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #006600; font-style: italic;">// alias the local version away</span>
                            tmp<span style="color: #009900;">&#91;</span>remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> obj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            dojo.<span style="color: #660066;">mixin</span><span style="color: #009900;">&#40;</span>tmp<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> tmp<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Object</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This new version of <code>delegate()</code> accepts a specially named &#8220;->&#8221; property in the list of items to add to the destination object. Items in this list can either &#8220;shadow null&#8221; (hide entirely) the parent&#8217;s property or can provide a new name for it, assuming of course that the new object will also have a property of that name. Here&#8217;s a quick example of &#8220;->&#8221; at work with our previous example. This time, <code>foo</code> also has a &#8220;testify&#8221; method that we&#8217;d like <code>bar</code> to be able to control without having to copy the implementation:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    science<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;rocks!&quot;</span><span style="color: #339933;">,</span>
    learning<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;is how you know you're alive&quot;</span><span style="color: #339933;">,</span>
    testify<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;science &quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">science</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;and learning&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">learning</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> bar <span style="color: #339933;">=</span> delegate<span style="color: #009900;">&#40;</span>foo<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">&quot;testify&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;grampsSays&quot;</span> <span style="color: #006600; font-style: italic;">// maps foo's &quot;testify&quot; to bar's &quot;grampsSays&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    testify<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">science</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">learning</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">grampsSays</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// call the re-named &quot;testify&quot;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
            console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;this object is strikingly ignorant&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
bar.<span style="color: #660066;">testify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// outputs: &quot;science rocks and learning is how you know you're alive&quot;</span>
bar.<span style="color: #660066;">science</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
bar.<span style="color: #660066;">testify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// outputs: &quot;this object is strikingly ignorant&quot;</span></pre></div></div>

<h4>That New Object Smell</h4>
<p>The last missing piece of the hierarchy pie here is that there&#8217;s no initializer for the objects which come from a delegation. A simple addition of some property detection code to look for an initializer can easily handle that:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">delegate <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> tobj <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> TMP <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// boodman/crockford delegation w/ cornford optimization. </span>
&nbsp;
        TMP.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> obj<span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> tmp <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TMP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> remaps <span style="color: #339933;">=</span> props<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>remaps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">delete</span> props<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #006600; font-style: italic;">// like dojo.mixin(), except w/o key/key mapping</span>
                <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #000066; font-weight: bold;">in</span> remaps<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #006600; font-style: italic;">// &quot;safe&quot; copy properties</span>
                    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>tobj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> undefined <span style="color: #339933;">||</span> tobj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #006600; font-style: italic;">// support hiding via null assignment</span>
                            tmp<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #006600; font-style: italic;">// alias the local version away</span>
                            tmp<span style="color: #009900;">&#91;</span>remaps<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> obj<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            dojo.<span style="color: #660066;">mixin</span><span style="color: #009900;">&#40;</span>tmp<span style="color: #339933;">,</span> props<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// support for &quot;constructor&quot; functions. The name &quot;init&quot; is arbitrary.</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> tmp<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;init&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;function&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            tmp.<span style="color: #660066;">init</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">return</span> tmp<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Object</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And there we have it. A style of delegation that easily supports both Trait-like name aliasing (and null shadowing) as well as internal initializers. Since our upgraded <code>delegate</code> can handle nulling out a parent&#8217;s value for a property, we also have a straightforward way to prevent parent initializers from being called (or being called/chained &#8211; at our discretion &#8211; by a new name):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    science<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;rocks!&quot;</span><span style="color: #339933;">,</span>
    learning<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;is how you know you're alive&quot;</span><span style="color: #339933;">,</span>
    testify<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;science &quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">science</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;and learning&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">learning</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> bar <span style="color: #339933;">=</span> delegate<span style="color: #009900;">&#40;</span>foo<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">testify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// outputs: &quot;science rocks and learning is how you know you're alive&quot;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> baz <span style="color: #339933;">=</span> delegate<span style="color: #009900;">&#40;</span>bar<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// map away the parent's constructor</span>
    <span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">&quot;init&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;superInit&quot;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #006600; font-style: italic;">// provide our own constructor</span>
    init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        console.<span style="color: #660066;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;howdy!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">superInit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// call the super-object ctor</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// outputs: &quot;howdy&quot;, &quot;science rocks and learning is how you know you're alive&quot;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> thud <span style="color: #339933;">=</span> delegate<span style="color: #009900;">&#40;</span>baz<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;-&gt;&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;init&quot;</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// hide the parent ctor</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// outputs: nothing</span></pre></div></div>

<p>This form of <code>delegate</code> is likely to appear in Dojo 1.3 along with similar improvements to <code>dojo.declare()</code> to help alleviate the composition problems associated with using complex sets of mixins.</p>
<p><b>Update</b>: corrected the null-out branch and updated the text with Doug&#8217;s note that beget/delegate will be called Object.create() in 3.1.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/10/delegate-delegate-delegate/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>&#8220;Action Oriented Programming&#8221;</title>
		<link>http://infrequently.org/2008/10/action-oriented-programming/</link>
		<comments>http://infrequently.org/2008/10/action-oriented-programming/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 16:40:13 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[closures]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=783</guid>
		<description><![CDATA[It&#8217;s good to be back in SF after a pretty hectic week in Boston for Dojo Developer Days and The Ajax Experience. There&#8217;s a lot to say about them, which hopefully I&#8217;ll get to in a longer post. Our first DDD event under Pete&#8216;s excellent leadership was a success and Dojo and SitePen very well [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s good to be back in SF after a pretty hectic week in Boston for Dojo Developer Days and The Ajax Experience. There&#8217;s a lot to say about them, which hopefully I&#8217;ll get to in a longer post. Our first DDD event under <a href="http://higginsforpresident.net/">Pete</a>&#8216;s excellent leadership was a success and Dojo and SitePen very well represented at the conference.</p>
<p>While in Boston, <a href="http://blog.xdraw.org/">Gavin</a> and <a href="http://www.eyelevelpasadena.com/">Jill</a>  joined a gaggle of Dojo hackers at a dinner ostensibly to mourn my birthday (thanks to Dylan and Pete for organizing!) and in the course of conversation Jill asked something along the lines of:</p>
<blockquote><p>
So why do people get so excited about closures?
</p></blockquote>
<p>Which prompted a several of us to flail and flop gasping the salt flats of analogy like fish out of polite-conversation water. After about 10 minutes of this, Jill succinctly summed it all up in the form of a question:</p>
<blockquote><p>
Oh, so it&#8217;s like &#8220;action-oriented programming&#8221;?
</p></blockquote>
<p>This is perhaps the most insightful and succinct description I have ever heard of what JavaScript is all about.</p>
<p><b>Update:</b> <a href="http://tharpo.com">Jennifer</a> just played <a href="http://blogs.wnyc.org/radiolab/2008/07/29/tell-me-a-story/">this for me</a> and it gets right to the heart of this post: the important part of doing what we do with computers, and more importantly, with the web, is to give the power of Computer Science to real people&#8230;and it starts with insights like Jill&#8217;s that build a shared way of thinking and talking about the world. It makes me sad that many programmers miss that, but when non-programmers can share in the beauty and power of code, it does a lot to make it all seem worthwhile.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/10/action-oriented-programming/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Harmony Fallout</title>
		<link>http://infrequently.org/2008/08/harmony-fallout/</link>
		<comments>http://infrequently.org/2008/08/harmony-fallout/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 08:33:17 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=731</guid>
		<description><![CDATA[Lets end the silly meme that "Adobe lost" or that "Microsoft won". The game has hardly begun and it won't be settled in a standards body anyway. ]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lot of weirdness going on around the Harmony announcement. <a href="http://whydoeseverythingsuck.com/2008/08/ru-roh-adobe-screwed-by-ecmascript.html">This post in particular</a> tries to dig into some of the wrangling that caused the ES4/3.1 split and what the Oslo resolution &#8220;means&#8221;, but I&#8217;m afraid that much of the analysis is being done without the benefit of an inside view of the WG process.</p>
<p>At the risk of talking too much out of school, I want to set the record straight in some ways. First, let me set some facts out:</p>
<ul>
<li>ES4, <a href="http://www.ecmascript.org/es4/spec/overview.pdf">as outlined last fall</a>, was <b>not</b> ActionScript 3. <em>Major</em> changes to the semantics of Adobe&#8217;s initial contribution ensured that any truly compliant ES4 implementation from Adobe would have required many concessions, including the inclusion of a client-side compiler. ES4 without <code>eval()</code> (ala AS3) would never have cut it as a &#8220;real&#8221; ES4.</li>
<li>Adobe had not donated &#8220;ActionScript 3&#8243; to Mozilla nor Open Sourced ActionScript 3. Adobe had donated a high-performance byte-code VM which a separate front-end compiler targeted. It is absolutely possible that the Tamarin VM can and will run <em>whatever</em> syntax for the next version of JavaScript is ratified. The design of the VM is, of course, predicated upon the language semantics but lets not confuse the front-end compiler and the language that it consumes with the VM and byte-code format which it executes. The front-end compiler was not donated to Mozilla (although something similar exists in the OSS&#8217;d Flex SDK) nor does it ship inside of the Flash player today. Adobe can continue to evolve their developer languages and byte-code VMs independently so long as they never ship an <code>eval()</code> feature. Even if they do, there are other (harder to swallow) options available, but no road is cut off to Adobe which was not already long-since abandoned in other ways by the ES4 process.</li>
<li>Like Adobe, Microsoft has jumped ahead in the evolution of JavaScript via the seemingly forgotten JScript.NET. Like Adobe, Microsoft has had to come back from that position to meet the web where it really is. Microsoft now ships 3 &ndash; yes, that&#8217;s right, <em>three</em> &ndash; JavaScript-ish languages which are capable of running in a browser:
<ul>
<li>JScript (via Windows Scripting Host)</li>
<li>JScript.NET</li>
<li>JScript for the DLR (via Silverlight)</li>
</ul>
<p>Make no mistake about it, these are all separate implementations which likely share little if any code. The DLR variant is even new in the last several years. Creating a new JavaScript compiler and runtime is not an overly onerous task for MSFT and clearly not one that will take a long time should the occasion arise. What&#8217;s confusing and can likely be tied to strategic wrangling is the puzzling lack of progress in the WSH version of JScript (the one everyone uses day-to-day). Any strategic discussion of JScript as a platform needs to start from this perspective.</li>
<li>Much in ES4 was new. The gradual typing system (which I&#8217;m a big supporter of) was something of a large-scale experiment coupled with as much rigor as I&#8217;ve ever seen in a standards body in proving things out in an RI. The Class system (which I wasn&#8217;t a big supporter of) needed to marry class-based inheritance to prototypal inheritance in ways which were new. ES4 contained many good features and syntactic forms which were borrowed from other places, but as Brendan Eich has said, it was a process of synthesis plus invention. In my opinion, much of the failure of ES4 as an initiative can be traced to significant failings of ActionScript 3 <em>as a language</em>. AS3 is a Java-like language with a Java-like execution model. JavaScript is a dynamic language with a dynamic execution model. The gulf in expectations between those camps turns up in every corner of the language design. For instance: what does it mean to load new code? Are classes forever &#8220;closed&#8221; or can they be re-opened? Do you <em>really</em> need the <code>static</code> and <code>final</code> keywords? Solving these issues in the context of the old is easy. In the context of the new, it&#8217;s hard. ES4 suffered because it had to do it in a new world which no one was yet writing code for.</li>
</ul>
<p>So, lets pop up and talk about strategy for a minute. Fundamentally, very little has changed in terms of available strategic options for any of the players:</p>
<ul>
<li>MSFT can still hold the web hostage to their ailing WSH VM by continuing to ignore its performance, regardless of bug fixes and syntactic updates. Doesn&#8217;t matter if it&#8217;s amputation or debilitating arthritis, crippled is crippled. For what it&#8217;s worth, my interactions with the MSFT reps on TC39 give me no reason to believe that they won&#8217;t be improving their VM.</li>
<li>Adobe can still chose to implement a language which implements an ECMA spec. They can do this any time they damn-well please. It may not align so cleanly with their current technology roadmap, but it&#8217;s absolutely feasible and when Mozilla ships a &#8220;regular JavaScript&#8221; front-end to the Tamarin back-end, it&#8217;ll be even easier. Note that this plan can be done in parallel with AS3 evolution since Tamarin (as a VM) need not be aware of any language semantics on its own.</li>
<li>Browser vendors can still wring large speedups out of ES3 and 3.1</li>
</ul>
<p>What died here wasn&#8217;t Adobe&#8217;s attempts to &#8220;own&#8221; a spec. If there were such hopes in play, they had been quietly put down one rational, backwards compatible decision after another in the year preceding the Oslo meeting. What died was an assumption that the web can evolve without implementations being out in front of the spec. AS3 was one implementation of a JavaScript-like language that might have been a contender for crown of &#8220;the next one&#8221;, but so was JScript.NET. That neither of them &#8220;won&#8221; simply because they had been built in good faith is as true a sign as I can find that the process is working. <a href="http://blogs.adobe.com/open/2008/08/blog_entry_dated_81408_715_pm.html">Adobe gets it</a>. Lets end the silly meme that &#8220;Adobe lost&#8221; or that &#8220;Microsoft won&#8221;. The game has hardly begun and it won&#8217;t be settled in a standards body anyway. What matters &ndash; and what we all need to keep our eyes keenly trained on &ndash; is what the big implementations do in the way of compatibility, performance, and feature set once ES3.1 arrives.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/08/harmony-fallout/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A Lovely Box For Your Toolkit</title>
		<link>http://infrequently.org/2008/07/a-lovely-box-for-your-toolkit/</link>
		<comments>http://infrequently.org/2008/07/a-lovely-box-for-your-toolkit/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 18:15:13 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sitepen]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=686</guid>
		<description><![CDATA[I&#8217;m incredibly excited about the SitePen Dojo Toolbox AIR app that just launched. I&#8217;ve been using early versions for a couple of weeks now, and in that time it has earned a privileged place on my desktop. Being able to make local builds without delving to the command line is something that I&#8217;ve wanted to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sitepen.com/labs/toolbox/"><img src="http://www.sitepen.com/blog/wp-content/uploads/2008/07/launcherexpanded.png" style="width: 70px; padding-right: 15px; border: none;" align="left" /></a></p>
<p>I&#8217;m incredibly excited about the <a href="http://www.sitepen.com/blog/2008/07/08/dojo-toolbox-first-look/">SitePen Dojo Toolbox</a> <a href="http://www.adobe.com/products/air/">AIR</a> app that just launched. I&#8217;ve been using early versions for a couple of weeks now, and in that time it has earned a privileged place on my desktop. Being able to make local builds without delving to the command line is something that I&#8217;ve wanted to be able to show new Dojo users for <em>years</em> and this tool finally makes it easy. There&#8217;s more work to do around configuring the profiles themselves, but the new tool demystifies many of the build configuration options significantly. Having a searchable API viewer available is also a godsend. Huge props to the team that put it together!</p>
<p><b>Edit:</b> I forgot to note one of my favorite parts of the project, namely that because the Dojo build system is written in JavaScript (thanks to <a href="http://tagneto.blogspot.com/">James Burke</a>&#8216;s awesome work), the build system in the Toolbox doesn&#8217;t require Java. Instead, SitePen was able to port the few Rhino dependencies in the build tool to work with the native JavaScript engine in AIR. It&#8217;s a minor thing, but it speaks to the excellent engineering behind Dojo&#8217;s tooling and the power of having actual web-native technologies inside a desktop app.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/07/a-lovely-box-for-your-toolkit/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zend + Dojo: More Than The Sum Of The Parts</title>
		<link>http://infrequently.org/2008/05/zend-dojo-more-than-the-sum-of-the-parts/</link>
		<comments>http://infrequently.org/2008/05/zend-dojo-more-than-the-sum-of-the-parts/#comments</comments>
		<pubDate>Thu, 22 May 2008 21:56:55 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[integrations]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=671</guid>
		<description><![CDATA[In the past several months, more and more integrations of Dojo with server frameworks have been shipping, and we couldn&#8217;t be happier about the Zend + Dojo integration that was announced yesterday. Fundamentally the Dojo and Zend teams really &#8220;get&#8221; each other. Both are deep packages that give you an opinion about how best to [...]]]></description>
			<content:encoded><![CDATA[<p>In the past several months, <a href="http://code.google.com/p/d-rails/">more</a> and <a href="http://ajaxian.com/archives/spring-webflow-20-javascript-module-released">more</a> integrations of Dojo with server frameworks have been shipping, and we couldn&#8217;t be happier about the <a href="http://andigutmans.blogspot.com/2008/05/dojo-and-zend-framework-partnership.html">Zend + Dojo integration that was</a> <a href="http://ajaxian.com/archives/dojo-and-zend-framework-integratation-released">announced yesterday</a>.</p>
<p>Fundamentally the Dojo and Zend teams really &#8220;get&#8221; each other. Both are deep packages that give you an opinion about how best to do something but also all of the tools you&#8217;ll need to make it work at scale. The &#8220;use at will&#8221; term that the Zend folks use made immediate sense to us. Like Dojo, Zend doesn&#8217;t saddle you with more than you&#8217;re <em>really going to need</em> up-front, but at the same time, when you need something awesome which is well tested and integrated, it&#8217;s right there. No digging around on google to find a &#8220;plug in&#8221; that will get you where you want to go&#8230;both Zend and Dojo give you a full stack of great components to work with out of the box.</p>
<p>There have been some questions on IRC today about why Dojo and not something else, and we know that the Zend folks are committed to continuing to allow Zend to work with other frameworks as well and we fully support them in that. There <em>seem</em> to be lots of choices of Ajax frameworks which Zend could have integrated, but when you look at the requirements of serious products which need to ship tested solutions to really hard problems, the field whittles down very fast. In response to the needs of our users, both Zend and Dojo take seriously our responsibilities to provide integrated, high-quality, unambiguously licensed products that will let user scale both up <em>and</em> down. Key to this is understanding the full spectrum of use-cases, informed by past experience, and striking a balance between enterprise-ready features and close-to-the-metal primitives. The Zend Framework has a larger view of the server-side than Dojo can, and as a result there are new opportunities to optimize and improve the user experience for all classes of users through this integration. This isn&#8217;t just about including some scripts on a page, this integration is about improving user and developer experiences, and both Dojo and Zend bring a lot to the table which can compliment the other. Dojo&#8217;s strengths in progressive enhancement, packaging, localization, and accessibility all have obvious allegories in the ZF world where a complete integration can more value <em>based on what developers are already doing</em>. All of those features of Dojo will work better when the server-side knows how to &#8220;hint&#8221; things for the client and work with, not against, the client to deliver better experiences.</p>
<p>I&#8217;m perhaps most excited about the data-driven opportunities in the Zend/Dojo integration. Dojo&#8217;s data infrastructure is second-to-none, and the design of the <code>dojo.data</code> and <code>dojo.rpc</code> layers provide Zend Framework integration the ability to take advantage of systems like the incredible Dojo Grid and the client-side charting package. There&#8217;s more to look forward to, and figuring it out together with the folks at Zend is a great opportunity for the Dojo community.</p>
<p>Pete Higgins and I will be participating in <a href="http://www.zend.com/en/company/news/event/webinar-zend-framework-project-partners-with-the-dojo-ajax-toolkit">next Tuesday&#8217;s</a> discussion with a broader chunk of the Zend Framework world, but until then (and long after) we&#8217;ll be hanging out in the <code>#dojo</code> and <code>#zftalk</code> channels on <code>irc.freenode.net</code>. We&#8217;re looking forward to working more with the ZF community to build great experiences, and are hugely excited about the direction things are already taking!</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/05/zend-dojo-more-than-the-sum-of-the-parts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>App Engine: Most Of The Stuff I Want, None Of The Stuff I Don&#8217;t</title>
		<link>http://infrequently.org/2008/04/app-engine-most-of-the-stuff-i-want-none-of-the-stuff-i-dont/</link>
		<comments>http://infrequently.org/2008/04/app-engine-most-of-the-stuff-i-want-none-of-the-stuff-i-dont/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 22:51:34 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=665</guid>
		<description><![CDATA[I&#8217;m not sure who or how, but I got an invite to yesterday&#8217;s Camp Fire One event at Google where they announced their new App Engine platform. The event itself was small-ish, with lots of interesting people invited (both from Google and not). I had no idea ahead of time what the announcement would be, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure who or how, but I got an invite to yesterday&#8217;s Camp Fire One event at Google where they announced their new <a href="http://code.google.com/appengine/">App Engine</a> platform. The event itself was small-ish, with lots of interesting people invited (both from Google and not). I had no idea ahead of time what the announcement would be, and frankly I forgot all about the event until the day of. I&#8217;m glad I remembered (note to future self: next time, pack gloves and a hat).</p>
<p>As they started talking about the platform and what&#8217;s part of it (and what&#8217;s not), I couldn&#8217;t escape escape the feeling that they&#8217;d gotten it right. It is <em>absolutely</em> the case that for most apps, scaling requires some amount of re-architecting. Systems like Rails are built with such a dependence (intentional or not) on the features of relational data stores that they quickly hit bottlenecks because <em>frameworks aren&#8217;t keeping developers out of the gutter</em>. This is nearly the same lesson that the security community collectively came to when it started to beat the average developer about the head regarding the awesome power of defaults. What systems do and don&#8217;t do for you &#8220;cheaply&#8221; defines their character, and in many systems those choices aren&#8217;t made consciously, or if they are, they don&#8217;t have the benefit of a different perspective which might de-emphasize certain traits. Call it libertarian paternalism, choice architecture, or pure condescension, but whatever it is, systems and platforms today are in the explicit business of making some things easier than others.</p>
<p>As the presenters showed how to make an app quickly, I knew I was looking at something I hadn&#8217;t seen the likes of since Jot. We all know that Big Table is a column-oriented data-store, but since most people are still stuck on the likes of MySQL, it&#8217;s hard to appreciate how liberating it is not having to think about how adding properties to models will affect a schema. The way App Engine is constructed lets the data store layer provide something called <a href="http://code.google.com/appengine/docs/datastore/entitiesandmodels.html">expando models</a>. These models give us the kind of flexibility that I&#8217;ve only ever enjoyed before inside of Jot. Want a property? Just add it. No migration, no schema version&#8230;just data finding a happy home, and as your app&#8217;s skeleton &#8220;solidifies&#8221; and you figure out which properties really do need to be faster, you can migrate that data into fixed properties with indexes and types and all that jazz. It&#8217;s like a gradual type system, only for data stores. It&#8217;s agility nirvana for application development.</p>
<p>Speaking of application development nirvana, they also had the good sense to start with a great language (Python) and a great webapp framework (Django) as the basis for the new system. For all the Rubyists and Java heads out there who are surely crying bloody murder, I suggest that they just try it. Seriously. Django&#8217;s template system is freaking sweet, and Python (despite it&#8217;s lambda-related warts) is close enough to being executable pseudo-code as to still hold the second place in my toolbox of languages.</p>
<p>There&#8217;s a lot which I&#8217;m sure others will (and have) covered about how App Engine is going to change the game for startups and players like Amazon, but I think that if someone else had launched this system it would still survive on its merits alone. The only wrinkle in the whole thing will be seeing what&#8217;s done about pricing over the long haul. It really shouldn&#8217;t be hard for Google to beat S3 on price, and I&#8217;m sure there will still be a market for EC2 for non-traditional tasks, but fundamentally I think App Engine has all the makings of something really, truly <em>better</em> than the current (assumed) stack.</p>
<p>After more than a year of mourning the effective loss of Jot as a platform, writing apps on the server just got interesting for me again, and that may be the highest praise I can offer and framework or platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/04/app-engine-most-of-the-stuff-i-want-none-of-the-stuff-i-dont/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How IE Mangles The Design Of JavaScript Libraries</title>
		<link>http://infrequently.org/2008/01/how-ie-mangles-the-design-of-javascript-libraries/</link>
		<comments>http://infrequently.org/2008/01/how-ie-mangles-the-design-of-javascript-libraries/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 12:21:18 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=644</guid>
		<description><![CDATA[A lot of hyperbole gets thrown around about how painful IE 6 and 7 make the world of JS development, and so I thought I&#8217;d do a bit of cataloging to help those using Dojo understand why it&#8217;s built the way it is and indeed, why all JS widget libraries suffer similar design warts. I [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of hyperbole gets thrown around about how <a href="http://alex.dojotoolkit.org/?p=620">painful IE 6 and 7 make the world of JS development</a>, and so I thought I&#8217;d do a bit of cataloging to help those using Dojo understand why it&#8217;s built the way it is and indeed, why all JS widget libraries suffer similar design warts. I know the good folks up in Redmond are <a href="http://blogs.msdn.com/ie/archive/2007/12/19/internet-explorer-8-and-acid2-a-milestone.aspx">working hard at delivering something better</a>, but the fact of the matter remains that until they outline when we&#8217;re going to get it (and the version after) and how it&#8217;s going to be distributed, IE 8 only serves to make the current situation look as shabby as it really is. Here are but 5 examples of how IE makes your toolkit of choice less elegant than it probably should be.</p>
<ol>
<li>
<h4>Array&#8217;s Can&#8217;t Be Usefully Subclassed (<a href="http://alex.dojotoolkit.org/08/jscript/array_weirdness.html">test case</a>)</h4>
<p>At first blush, this seems wrong. You can use the Array base-class as the prototypal delegate for any user-defined class you wish. Methods are correctly delegated to and hash-style indexes work fine. Almost everything works right&#8230;except when you try to use the built-in array manipulation methods like <code>push</code>, <code>pop</code>, and <code>shift</code>. They dutifully change the internal contents of the subclass instance&#8217;s indexed attributes, but they don&#8217;t manipulate the length property. This means that while you can use <code>for(var x in list){ ...</code> style iteration, you can&#8217;t do anything *aside from key iteration* to know how many items are in the array. Obviously, one could try to wrap the intrinsic functions and detect how they manipulate the length property, but then you&#8217;ve ruined their <code>[DontEnum]</code> status and now they end up in the iterable surface area of instances. Ugg.</p>
<p>Arrays without a working <code>length</code> property are nearly useless, and JScript mangles the design of toolkits as a result.</p>
<p>So how do we get <code>dojo.NodeList</code> to be a &#8220;real&#8221; array with extra methods then?</p>
<p>As you might expect, it&#8217;s a giant hack. When you use the &#8220;new&#8221; keyword with the <code>dojo.NodeList</code> function, you expect that the system will create a new instance and do it&#8217;s normal &#8220;stamp with a constructor&#8221; business. Instead, we resort to creating (and populating) a regular Array instance and <a href="http://trac.dojotoolkit.org/browser/dojo/trunk/_base/NodeList.js">&#8220;NodeList-ifying&#8221; it by copying named attributes from the class prototype into the instance as member properties</a>. The &#8220;constructor&#8221; function then explicitly return a new object, bypassing the &#8220;new&#8221; keyword&#8217;s create/stamp machinery, at which point the return of the <code>new</code> operator becomes our explicit return and not the object which it would have otherwise implicitly returned.</p>
<p>In Dojo 0.9 we had used an even more <a href="http://trac.dojotoolkit.org/browser/tags/release-0.9.0/dojo/_base/NodeList.js">aggressively hackish workaround for IE</a> which involved creating a sub-document and mapping <em>its</em> interpreter&#8217;s intrinsic Array class into the parent document at a different name. Both are slow for different reasons but we eventually switched to the create-and-mix-in style because some popup blockers were interfering with the old method.</p>
<p>Lest you think that Dojo is a dirty, dirty toolkit for doing this kind of thing, consider the janktastic &#8220;it&#8217;s not really an array&#8221; thing that JQuery resorts to instead. By giving up all &#8220;[]&#8221; index operations, JQuery manually maintains it&#8217;s internal length property by re-implementing all of <code>push</code>, <code>pop</code>, etc. functions. This has the benefit of allowing prototypal delegation to work of pre-existing instances when new features are added to the base prototype, but at the expense of no longer being able to think about a dense list of things as an array. Dojo&#8217;s approach is painful, but so are all the alternatives today.</p>
<p>I think it&#8217;s safe to say that both toolkits would subclass Array directly to save code, were it a reasonable thing to do.</p>
</li>
<li>
<h4>Where Art Thou Getters/Setters?</h4>
<p>As JavaScript toolkits get pushed out of their current workhorse tasks of plastering over JavaScript and DOM implementation gaffes by positive browser progress and Moore&#8217;s Law, they increasingly take on application construction tasks (e.g., <a href="http://download.dojotoolkit.org/release-1.0.2/dojo-release-1.0.2/dojox/data/demos/demo_MultiStores.html"><code>dojo.data</code></a>). As the toolkits have approached these tasks, we&#8217;ve collectively started to hit some very serious usability limitations due, in large part, to JScript&#8217;s lack of progress.</p>
<p>Toolkits like Dojo have widget systems because HTML just hasn&#8217;t kept up. That means that these toolkits have a responsibility to keep as many of the positive aspects of the &#8220;native&#8221; web as they can. From <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/themes-and-design">CSS customization</a> to <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/a11y">accessibility</a> all the way through <a href="http://www.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/understanding-parser">implementing declarative creation</a> and DOM-ish JavaScript APIs, the better a job a toolkit can do in making the abstraction feel more solid, the better the toolkit is. Widgets are essentially a way to &#8220;subclass HTML elements&#8221;.</p>
<p>In many places, DOM allows you to affect the behavior of the visible document using &#8220;setter&#8221;-style syntax. For example:</p>
<pre><code>
document.getElementById("foo").style.border = "5px dotted black";
</code></pre>
</p>
<p>Custom widget classes <a href="http://developer.mozilla.org/en/docs/defineGetter">can have the same behavior</a> <em>on every browser except IE</em>.
</p>
<p>This means, of course, that JavaScript toolkits can&#8217;t really implement the behavior, backing JavaScript programmers up against a wall when they design their tools. Instead of providing the natural property-oriented behavior, it forces class authors to write <code>getSomeProperty/setSomeProperty</code> method pairs on their classes should they want to do anything when values are gotten or set. The resulting code feels a lot more like Java than JavaScript, which is usually a sign that something is horribly wrong in a browser.</p>
<p>As bad as this problem is for visual widgets, it&#8217;s worse for data binding systems. API&#8217;s like <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/data-retrieval-dojo-data-0"><code>dojo.data</code></a> would be designed in fundamentally different ways if getters and setters were available everywhere. Instead of the rigamarole of making users fetch an item reference and then fetch attribute values using the opaque item handle and the property name, we&#8217;d just set up getters and setters on the properties themselves and defer the implementation of fetching those values down to the data store. Further, assigning a linkage between a <code>dojo.data</code> query or store and a widget which represents it could be as simple as assigning a property to the widget object.</p>
<p>So are workarounds to this possible? I think they are, and I&#8217;m testing some of them out for use in Dojo 1.1 right now. I&#8217;ll post more about them should they pan out. Every avenue which looks potentially workable right now involves <a href="http://alex.dojotoolkit.org/08/jscript/lettable.html">gigantic hacks</a> which also deeply constrain API designs. Fundamentally, this problem can&#8217;t be solved without good language-level support.</p>
<p>It&#8217;s perhaps folly to assume that this will be addressed in IE 8, but given the enormous back-pressure of nearly every JavaScript toolkit author demanding this feature and the embarrassment of every other browser beating them to the punch, I have some hope that we could see getters and setters for JScript in the near future. It won&#8217;t matter much, though, unless the JScript team ships their new engine to <em>all</em> IE versions when they release IE 8. Not bloody likely.</p>
</li>
<li>
<h4>Performance</h4>
<p>Kudos are in order to the JScript team for <a href="http://erik.eae.net/archives/2007/12/14/20.07.27/">fixing</a> their <a href="http://blogs.msdn.com/ericlippert/archive/2003/09/17/53038.aspx">long-b0rken</a> GC heuristic and pushing it out to everyone&#8230;but it&#8217;s the tip of the iceberg.</p>
<p>Performance is one of those areas where differences in implementations can tightly circumscribe what&#8217;s possible despite exacting spec conformance. On this front, JScript&#8217;s <a href="http://www.codinghorror.com/blog/archives/001023.html">raw VM-level execution time</a> leaves a lot to be desired, but the true travesties really show up when you hit the DOM for computed style information or try to do anything reasonably complicated that involves string operations.</p>
<p>Most non-trivial blocks of JS code today rely on <code>innerHTML</code> to bootstrap some new chunk of DOM in response to user action due in large part to the cross-browser speed and size advantages of <code>innerHTML</code> vs. raw DOM methods for equivalent DOM structures. This reality pushes IE&#8217;s string performance woes to the fore as more and more client-side systems push far enough to hit the new &#8220;wall&#8221;.</p>
<p>Similarly, getting computed box model calculations out of IE is not for the faint of optimization foo. When we profiled Dojo&#8217;s widgets to plan our attack for 0.9 and 1.0, we noted very quickly that getting box-model data out of the browser for any element is hugely costly on every browser, but on IE the cost was not just big&#8230; it was <em>enormous</em>. Our best guess right now is that the properties on the currentStyle property are re-calculated when they&#8217;re requested from script and not cached in the bound object when layout happens. The resulting performance penalty requires that developers nearly never manage layout in code, severely constraining the layouts which are attempted by toolkits like Dojo.
</p>
<p>Across the board, from DOM performance to raw JScript execution speed, IE is a dog, and the odds are good that whatever toolkit you&#8217;re using spends a lot of time working around that reality.
</p>
</li>
<li>
<h4>Doctype Switching</h4>
<p>Doctype switching to toggle box-model behavior is perhaps the single most limiting implementation error in IE. <a href="http://www.mozilla.com/en-US/firefox/">Saner</a> browsers allow you to use a CSS property to affect the layout model in use in a particular section of a document. This makes tons of sense in a templated world where most of the markup your system generates starts and ends in the &#8220;news hole&#8221;. Today, that covers nearly everyone. A quick line count in any HTML document shows that doctypes are a <em>scarce resource</em> whose scarcity is made problematic when it&#8217;s semantics are overloading. I&#8217;ve been on product teams where the idea of changing the doctype would require months to recover from. That kind of cost related to what should be simply a markup dialect change (not a formatting policy change) implies strongly that the doctype is a terribly brittle way to control several independent concerns.
</p>
<p>Instead of giving devs fine-grained layout system control, IE makes it all-or-nothing. The global flag approach backs toolkit developers into doing script-based layout calculations or &#8220;just throw it in another div&#8221; solutions where we&#8217;d really rather not. Both are slow and both may be required since it&#8217;s completely impractical to dictate to users which doctype they&#8217;ll be using. While any app may be able to be disciplined enough to not care, toolkit developers must work everywhere. Hilarity ensues.
</p>
<p>I fear this is going to get even worse with IE8 as the IE team looks to implement some of HTML 5 and hopefully many of CSS 2.1&#8242;s clarifications. The sooner they abandon the global switch, the better&#8230;but I&#8217;ll wager it&#8217;s pain they just don&#8217;t feel. Building a browser is a very different pursuit from building portable apps to run inside it.</p>
</li>
<li>
<h4>HTC&#8217;s Can&#8217;t Be Inlined (Even With Hacks)</h4>
<p>Modern browsers have built-in widget systems. On IE, it&#8217;s <a href="http://msdn2.microsoft.com/en-us/library/ms531428(VS.85).aspx">HTCs + Viewlink</a> and on Firefox it&#8217;s <a href="http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference">XBL</a>. Even a cursory reading through the docks for both is enough to illuminate the gigantic overlap. Alas, no one is yelling at them to standardize and the result is a terrible mess in which both sub-optimal formats limp along with nearly zero Open Web usage.
</p>
<p>So why do I single out IE for whipping here when XBL is just as lame and similarly b0rken with regards to single-file embedding? Well, on Mozilla, you have a lot more &#8220;outs&#8221;. I strongly suspect that you can use &#8220;<a href="http://en.wikipedia.org/wiki/Data:_URI">data:</a>&#8221; urls to generate and evaluate component definitions for FF, which would enable compiling down from a single (more sane) format in the running page environment. IE prevents any such useful code-loading approaches, meaning you have to generate files on disk in their b0rken-ass format in order to be able to use them. Given <a href="http://dojotoolkit.org">how far we&#8217;ve gotten</a> with non-builtin widget systems, it&#8217;s pretty clear that toolkit authors aren&#8217;t going to contort themselves into requiring a build step that splats files all over disk just so that we can give IE and Mozilla different views of the same component description. Instead, we all limp along on our own class hierarchies without any of the benefits of element subclassing, getter/setter handling, and inline (scoped) method description that these browser-provided systems would allow. It&#8217;s kind of pitiful, really.
</p>
<p>IE8 may include strong &#8220;data:&#8221; URL support given that it&#8217;s needed to <a href="http://blogs.msdn.com/ie/archive/2007/12/19/internet-explorer-8-and-acid2-a-milestone.aspx">pass Acid2</a>, but I&#8217;m not holding my breath. I strongly suspect that HTC&#8217;s are a dark, unloved corner of the Trident codebase that none of the current engineering team are really fired up about fixing (which they could have done by just allowing Data Islands to contain HTC definitions&#8230;but I digress). The takeaway here is that we probably <em>shouldn&#8217;t even need JS toolkits to build widget systems</em>, but it&#8217;s too late now. We&#8217;re an abstraction short and a decade late and now the Flex frankenstein is beating HTML at it&#8217;s own game.
</p>
</li>
</ol>
<p>In a vacuum of feature data or builds to work with, it&#8217;s prudent to assume that IE 8&#8242;s DOM and JavaScript implementations will continue to warp attempts at building useful, idiomatic JavaScript libraries to ease the problems that HTML + CSS aren&#8217;t effectively solving. So next time you wonder why your toolkit of choice is built the way it is or why it&#8217;s even necessary, just remember that in many cases they are protecting you from a decade or more of bad decision making.</p>
<p>From that perspective, they&#8217;re worth <a href="http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE">every penny</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2008/01/how-ie-mangles-the-design-of-javascript-libraries/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Sweet Gig</title>
		<link>http://infrequently.org/2007/08/sweet-gig/</link>
		<comments>http://infrequently.org/2007/08/sweet-gig/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 11:49:46 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sitepen]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=616</guid>
		<description><![CDATA[SitePen is hiring. To be honest, SitePen is usually hiring, so why the blog post? Because I&#8217;m hiring for a SitePen R&#38;D Associate. This isn&#8217;t your average programming job. Not only will all the work from this new position be released as Open Source software,it&#8217;s a self-directed research job. Combined with SitePen&#8217;s completely-virtual structure, you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sitepen.com">SitePen</a> is <a href="http://sitepen.com/jobs.php">hiring</a>.</p>
<p>To be honest, SitePen is <em>usually</em> hiring, so why the blog post? Because <em>I&#8217;m</em> hiring for a SitePen R&amp;D Associate. This isn&#8217;t your average programming job. Not only will all the work from this new position be released as Open Source software,it&#8217;s a self-directed research job. Combined with SitePen&#8217;s completely-virtual structure, you can work on what you feel is important and live wherever you want.</p>
<p>Read on for the full description:</p>
<p><span id="more-616"></span></p>
<blockquote>
<h3>Position</h3>
<p>R&amp;D Associate (title negotiable)</p>
<h3>Description</h3>
<p>
			SitePen is a fast-growing services company with deep roots in Open Source web software and an ongoing commitment to give back to the Open Web. The problems we solve for clients sit at the intersection of Computer Science and Interaction Design while cutting across a wide variety of problem domains. As an R&amp;D Associate at SitePen you&#8217;ll be responsible for investigating and developing solutions to the thorniest problems in real-world web application development and since everything you do will be Open Source, your impact will be both meaningful and lasting.
		</p>
<p>
			Some topics currently of interest to SitePen include:
		</p>
<ul>
<li>web framework scalability</li>
<li>parametric CSS</li>
<li>ES3/ES4 implementations across VMs</li>
<li>publish/subscribe messaging and scalability</li>
<li>web-based interaction design/analysis tools</li>
<li>Open Data portability and metadata normalization</li>
<li>browser-based data visualization</li>
</ul>
<p>
			But those are just the problems that keep us awake at night. What we&#8217;re <em>really</em> interested in is hearing about how you&#8217;d like to make a difference in the evolution of the web. At SitePen, you&#8217;ll have the freedom to pursue your interests and a mandate to work with broader communities to make your ideas reality.
		</p>
<h3>Required Qualifications</h3>
<ul>
<li>contributor to at least one Open Source project (active committers preferred)</li>
<li>fluent in one functional or scripting language (C experience a plus)</li>
<li>must be able to author technical papers</li>
<li>must be comfortable presenting and defending work to groups of various sizes</li>
<li>permanant legal right to work in the United States</li>
</ul>
<h3>How To Apply</h3>
<p>
			Send a plain-text email to &#8220;alex@sitepen.com&#8221; with the subject line &#8220;R&amp;D Associate Application&#8221;. In the body of the email, please explain why you think you&#8217;d be good for the job, what research interests you would like to pursue, and if you have one, a link to your website/blog. Please include links to your Open Source involvement and note major contributions (planning, design, features implemented, research contributed, UI/UX/IxD, etc.).  Also, either include a link to an online resume or attach one in plain-text or PDF format.
		</p>
<p>
			There is no deadline for application, but the earlier you apply the better your odds.
		</p>
<h3>Benefits</h3>
<ul>
<li>Senior Engineer grade pay</li>
<li>Comprehensive health insurance</li>
<li>All work product Open Source</li>
</ul>
<h3>Additional Information</h3>
<ul>
<li>
				<b>Location:</b> anywhere you damn well please. SitePen is an entirely virtual organization.
			</li>
<li>
				<b>Travel:</b>10-25% travel, depending on personal choices regarding conferences and symposiums. Presenting papers and speaking on your work is encouraged.
			</li>
<li>
				<b>Job Type:</b> Full Time
			</li>
<li>
				<b>Reports To:</b> Director of R&amp;D (Alex Russell)
			</li>
</ul>
</blockquote>
<p>Uniquely for an R&amp;D job, there are no minimum education requirements. We only care how effectively you can advance the state of the art on the Open Web. If that sounds like a calling you can get behind, I&#8217;d love to hear from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2007/08/sweet-gig/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

