<?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; webdev</title>
	<atom:link href="http://infrequently.org/category/webdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://infrequently.org</link>
	<description>Alex Russell on browsers, standards, and the process of progress.</description>
	<lastBuildDate>Thu, 16 May 2013 00:07:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>The Case Against Synchronous Worker APIs</title>
		<link>http://infrequently.org/2013/05/the-case-against-synchronous-worker-apis-2/</link>
		<comments>http://infrequently.org/2013/05/the-case-against-synchronous-worker-apis-2/#comments</comments>
		<pubDate>Wed, 15 May 2013 13:28:13 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=2047</guid>
		<description><![CDATA[Several times in the past few months I&#8217;ve been presented with this question: is it good or useful to provide synchronous APIs to web workers? Having considered the question at some length, it seems to me the answer must now be &#8220;no&#8220;. Consider IndexedDB. It&#8217;s not implemented in any browser yet, but some hard-working sould [...]]]></description>
				<content:encoded><![CDATA[<p>Several times in the past few months I&#8217;ve been presented with this question: is it good or useful to provide synchronous APIs to <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html">web workers</a>?</p>
<p>Having considered the question at some length, it seems to me the answer must now be &#8220;<em>no</em>&#8220;.</p>
<p>Consider IndexedDB. It&#8217;s not implemented in any browser yet, but some hard-working sould did the arduous work to <a href="http://www.w3.org/TR/IndexedDB/#sync-database">specify a second synchronous version of its API</a> which is meant to be available only in Workers where it can&#8217;t lock up the UI thread. That spec work was probably done because it was thought that a synchronous API would be nicer to use than the async version. As a result, the API is now double the size, but only in some contexts. I came across this while attempting to <a href="https://github.com/slightlyoff/DOMFuture/tree/master/reworked_APIs/IndexedDB">rework the IDB API to use Futures</a> in order to improve usability in a backwards-compatible way.</p>
<p>So why not the sync version? At least 2 reasons:</p>
<ul>
<li>The async version doesn&#8217;t have to be thorny as the current IDB API is. The current IDB API has its issues: it uses events for one-time operations (not 0-through-N times operations). To do so it has to create non-obvious control flow contracts to give developers a place to set up listeners. Another legacy of using events is that delivered values are always wrapped in event objects and must be dug out with boilerplate. Some API conveniences can be added, and some things in the API are implicit that perhaps shouldn&#8217;t be (e.g. transactions). All of these things can be repaired in a backwards-compatible way that improves async IDB to the point of being nearly as nice to use as sync IDB. <a href="https://github.com/slightlyoff/DOMFuture/tree/master/reworked_APIs/IndexedDB">Futures</a> can help, as can some reworking of optional arguments.</li>
<li>There&#8217;s very little a worker will do that is really long running and <em>truly</em> synchronous. Even things that look like they&#8217;re a good fit at first blush break down quickly. Just think of the user experience: who wants their laptop fan spinning up, their lap getting warm, and their precious battery indicator slipping towards a powerless coma without being able to either find what is causing it or, better, some UI that communicates what work is being done on their behalf and a way to cancel it if necessary. Getting work off the main thread is what allows apps to do work for users without locking up those UI indicators, but to provide any ability to interrupt the task or broadcast progress, it must yield to the main event loop.</li>
</ul>
<p>It&#8217;s this second concern that I think it truly fatal to the cause of sync worker APIs: assuming they work and are popular, they will create a world in which it&#8217;s necessary to put limits on their overall running time&#8230;limits that will be circumvented by breaking up the work into smaller chunks and dealing with it asynchronously inside the worker. Likewise, anyone building a serious app that&#8217;s trying to do the right thing by the user will factor their worker&#8217;s tasks into small enough chunks that they can both service &#8220;stop&#8221; messages and distribute progress notifications to the UI. There might be scenarios where such messages aren&#8217;t necessary and where users aren&#8217;t coveting CPUs and batteries&#8230;where sending SIGHUP doesn&#8217;t matter. But the intersection of those scenarios and the client-side web seems mostly to be a happy accident: your code might not have encountered enough data to create the problems. Yet.</p>
<p>This is particularly clear in the IDB cases: upgrading, iterating over, and updating hundreds of thousands of items of data is the sort of thing that will take a while, and is likely in response to some application semantic the user cares about: synchronizing mail, migrating to a faster schema layout in the process of some upgrade, etc. A blind <code>for</code> loop is asking for trouble. All of this might work fine in a dev environment with a (small) staging set of data&#8230;but it&#8217;s recipe for disaster when power-users with tons of data encounter it. What then? If the APIs an app depends on are all synchronous, it&#8217;s a huge boulder to roll up a hill to provide notifications, chunk up work, and refactor around async-ish patterns that chunk work up. If the work was async in the first place, the burden is much lower. So even apps that aren&#8217;t Doing It Right (TM) are likely to reap some benefit down the line from thinking in terms of async first.</p>
<p>There are other arguments that you can field against these sorts of APIs, particularly ones that double-up API surface area, but it doesn&#8217;t seem to me that they&#8217;re necessary. The person attempting to justify synchronous worker APIs who provides a good argument for ergonomics and learnability still has all their work ahead of them: they must show that these APIs are not harmful to the user experience. After all, Workers were added to the platform as a way of improving UX (by moving work off the main thread). And I fear they cannot do so without violating core JS semantics.</p>
<p>So let&#8217;s pour one out for our sync API dreams: we&#8217;re gonna miss you, control flow integration. But not for too long. <a href="http://wiki.ecmascript.org/doku.php?id=harmony:proposals"><code>Generators</code>, <code>iterators</code>, and <code>yield</code> will see you avenged</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2013/05/the-case-against-synchronous-worker-apis-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why What You&#8217;re Reading About Blink Is Probably Wrong</title>
		<link>http://infrequently.org/2013/04/probably-wrong/</link>
		<comments>http://infrequently.org/2013/04/probably-wrong/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 21:00:17 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[opensource]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=2005</guid>
		<description><![CDATA[By now you&#8217;ve seen the news about Blink on HN or Techmeme or wherever. At this moment, every pundit and sage is attempting to write their angle into the annoucement and tell you &#8220;what it means&#8221;. The worst of these will try to link-bait some &#8220;hot&#8221; business or tech phrase into the title. True hacks [...]]]></description>
				<content:encoded><![CDATA[<p>By now you&#8217;ve seen the news about <a href="http://chromium.org/blink">Blink</a> on HN or Techmeme or wherever. At this moment, every pundit and sage is attempting to write their angle into the annoucement and tell you &#8220;what it means&#8221;. The worst of these will try to link-bait some &#8220;hot&#8221; business or tech phrase into the title. True hacks will weave a Google X and Glass reference into it, or pawn off some &#8220;GOOGLE WEB OF DART AND NACL AND EVIL&#8221; paranoia as prescience (sans evidence, of course). The more clueful of the ink-stained clan will constrain themselves to objective reality and instead pen screeds for/against diversity despite it being a <a href="http://ccs.mit.edu/papers/CCSWP135.html">well-studied topic</a> to <a href="http://scholar.google.com/scholar?cites=5594983873856483033&#038;as_sdt=2005&#038;sciodt=0,5&#038;hl=en">which they&#8217;re not adding much</a>.</p>
<p>May the deities we&#8217;ve invented forgive us for the tripe we&#8217;re about to sell each other as &#8220;news&#8221;.</p>
<p>What&#8217;s bound to be missing in most of this coverage is what&#8217;s plainly said, if not in so many words, in the <a href="http://blog.chromium.org/2013/04/blink-rendering-engine-for-chromium.html">official blog post</a>: <em>going faster matters</em>.</p>
<p>Not (just) code execution, but <em>cycle times</em>: how long does it take you to build a thing you can try out, poke at, improve, or demolish? We mere humans do better when we have directness of action. <a href="http://vimeo.com/36579366">This is what Bret Victor points us towards</a> &#8212; the inevitable constraints of our ape-derived brains. Directness of action <em>matters</em>, and when you&#8217;re swimming through build files for dozens of platforms you don&#8217;t work on, that&#8217;s a step away from directness. When you&#8217;re working to fix or prevent regressions you can&#8217;t test against, that&#8217;s a step away. When compiles and checkouts take too long, that&#8217;s a step away. When landing a patch in both WebKit and Chromium stretches into a multi-day dance of flags, stub implementations, and dep-rolls, that&#8217;s many steps away. And each step hurts by a more-than-constant factor.</p>
<p>This hit home for me when I got my first workstation refresh. I&#8217;d been working on Chrome on Windows for nearly a year in preparation for the Chrome Frame release, and all the while I&#8217;d been hesitant to ask for one of the shiny new boxes that the systems people were peddling like good-for-you-crack &#8212; who the hell was I to ask for new hardware? They just gave me this shiny many-core thing a year ago, after all. And I had a linux box besides. And a 30&#8243; monitor. What sort of unthankful bastard asks for more? Besides, as the junior member of the team, surely somebody else should get the allocation first. </p>
<p>Months later they gave me one anyway. Not ungrateful, I viewed the new system with trepidation: it&#8217;d take a while to set up and I was in the middle of a marathon weekend debugging session over a crazy-tastic re-entracy bug in a GCF interaction with <code>urlmon.dll</code> that was blocking the GCF launch. If there was a wrong time to change horses, surely this was it. At some point it dawned that 5-10 minute link times provided enough time to start staging/configuring at the shiny i7 box.</p>
<p>A couple of hours later the old box was still force-heating the eerily dark, silent, 80-degree floor of the SF office &#8212; it wasn&#8217;t until a couple of weeks later that I mastered the after-hours A/C &#8212; when my new, <em>even hotter</em> workstation had an OS, a checkout, compiler, and <a href="http://msdn.microsoft.com/en-gb/windows/hardware/gg463009.aspx">WinDBG + cargo-culted symserver config</a>. One build on the new box and I was <em>hooked</em>. </p>
<p>5-10 minute links went to 1-2&#8230;and less in many cases because I could now enable incremental linking! And HT really worked on the i7&#8242;s, cutting build times further. Hot damn! In what felt like no-time at all, my drudgery turned to sleuthing/debugging bliss (if there is such a thing). I could make code changes, compile them, and be working with the results in less time than it took to make coffee. Being able to make changes and then <em>feel</em> them near-instantly turned the tide, keeping me in the loop longer, letting me explore faster, and making me less afraid to change things for fear of the time it would take to roll back to a previous state. It wasn&#8217;t the webdev nirvana of ctrl-r, but it was <em>so</em> liberating that it nearly felt that way. What had been a week-long investigation was wrapped up in a day. The launch was un-blocked (at least by that bug) and the world seemed new. </p>
<p>The difference was directness.</p>
<p>The same story repeats itself over and over again throughout the history of Chrome: shared-library builds, ever-faster workstations, trybots and then faster trybots, <a href="https://code.google.com/p/gyp/">gyp</a> (instead of Scons), many different forms of distributed builds, make builds for gyp (courtesy of Evan Martin), <a href="http://clang.llvm.org/">clang</a>, and of course <a href="http://martine.github.com/ninja/">ninja</a> (also Evan&#8230;dude&#8217;s a <em>frickin hero</em>). Did I mention faster workstations? They&#8217;ve made all the same sort of liberating difference. Truly and honestly, in ways I cannot describe to someone who has not felt the difference between ctrl-r development and the traditional Visual Studio build of a massive project, these are the things that change your life for the better when you&#8217;re lashed to the mast of a massive C++ behemoth.</p>
<p>If there is wisdom in the Chrome team, it is that these projects are not only recognized as important, but the very best engineers volunteer to take them on. They seem thankless, but Chrome is an environment that rewards this sort of group-adaptive behavior: the highest good you can do as an engineer is to make your fellow engineers more productive.</p>
<p>And that&#8217;s what you&#8217;re missing from everything else you&#8217;re reading about this announcement today. To make a better platform faster, you must be able to iterate faster. Steps away from that are steps away from a better platform. Today&#8217;s WebKit defeats that imperative in ways large and small. It&#8217;s not anybody&#8217;s fault, but it <em>does</em> need to change. And changing it will allow us to iterate faster, working through the annealing process that takes a good idea from drawing board to API to refined feature. We&#8217;ve always enjoyed this freedom in the Chromey bits of Chrome, and unleashing Chrome&#8217;s Web Platform team will deliver the same sorts of benefits to the web platform that faster iteration and cycle times have enabled at the application level in Chrome.</p>
<p>Why couldn&#8217;t those cycle-time-improving changes happen inside WebKit? After all, much work has happened in the past 4 years (often by Googlers) to improve the directness of WebKit work: EWS bots, better code review flow, improved scripts and tools for managing checkins, the commit queue itself. The results have been impressive and have enabled huge growth and adoption by porters. WebKit now supports multiple multi-process architecture designs, something like a half-dozen network stack plug-ins, and similar diversity at every point where the engine calls back to outside systems for low-level implementation (GPU, network, storage, databases, fonts&#8230;you name it). The community is now committed to enabling porters, and due to WebKit&#8217;s low-ish level of abstraction each new port raises the tax paid by every other port. As <a href="https://plus.google.com/104985880647110483202/posts">James Robinson</a> has observed, this diversity creates an ongoing drag when the dependencies are intertwined with core APIs in such a way that they can bite you every time you go to make a change. The <a href="http://www.chromium.org/developers/content-module/content-api">Content API boundary</a> is Blink&#8217;s higher-level &#8220;embedding&#8221; layer and encapsulates all of those concerns, enabling much cleaner lines of sight through the codebase and the removal of abstractions that seek only to triangulate between opaque constraints of other ports. Blink gives developers much more assurance that when they change something, it&#8217;s only affecting the things they think it&#8217;s affecting. Moving without fear is the secret of all good programming. Putting your team in a position to move with more surety and less fear is hugely enabling.</p>
<p>Yes, there are losses. Separating ourselves from a community of hugely talented people who have worked with us for years to build a web engine is not easy. The decision was wrenching. We&#8217;ll miss their insight, intelligence, and experience. In all honesty, we may have paid too high a price for too long because of this desire to stay close to WebKit. But whatever the &#8220;right&#8221; timing may have been, the good that will come from this outweighs the ill in my mind.</p>
<p>Others will cover better than I can how this won&#8217;t affect your day-to-day experience of WebKit-derived browser testing, or how it won&#8217;t change the feature-set of Chrome over-night, or how the new feature governance process is more open and transparent. But the most important thing is that we&#8217;ll all be going faster, either directly via Blink-embedding browsers or via benchmarks and standards conformance shaming. You won&#8217;t feel it overnight, but it&#8217;s the sort of change in model that enables concrete changes in architecture and performance and <em>that</em> is something to cheer about &#8212; <a href="http://fronteers.nl/congres/2012/sessions/the-web-platform-and-the-process-of-progress-alex-russell">change is the predicate for positive change, after all</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2013/04/probably-wrong/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Reforming the W3C TAG</title>
		<link>http://infrequently.org/2012/12/reforming-the-w3c-tag/</link>
		<comments>http://infrequently.org/2012/12/reforming-the-w3c-tag/#comments</comments>
		<pubDate>Fri, 07 Dec 2012 12:24:34 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1958</guid>
		<description><![CDATA[And so it has come to pass that W3C Technical Architecture Group (TAG) elections are afoot. Nominations have ended and the candidates have been announced. There are four seats open and nine candidates running, so it&#8217;s worth understanding why anyone should vote for the reformers (myself, Yehuda Katz, Anne van Kesteren, Peter Linss, and Marcos [...]]]></description>
				<content:encoded><![CDATA[<p>And so it has come to pass that <a href="http://www.w3.org/2001/tag/">W3C Technical Architecture Group (TAG)</a> elections are afoot. Nominations have ended and the <a href="http://www.w3.org/2012/12/03-tag-nominations">candidates have been announced</a>. There are four seats open and nine candidates running, so it&#8217;s worth understanding why anyone should vote for the reformers (myself, <a href="https://plus.sandbox.google.com/106300407679257154689/posts">Yehuda Katz</a>, <a href="http://annevankesteren.nl/">Anne van Kesteren</a>, <a href="http://www.linkedin.com/pub/peter-linss/2/251/956">Peter Linss</a>, and <a href="http://www.linkedin.com/in/marcosc">Marcos Caceres</a>). For general background, see my <a href="http://infrequently.org/2012/11/election-season/">previous post</a>. Here I&#8217;ll include more specifics, so if that sounds boring, <a href="http://www.flickr.com/photos/kittytoes/8247156949/in/pool-99442622@N00/" target="_new">here&#8217;s a kitten!</a></p>
<p>After doing much reading of TAG <a href="http://www.w3.org/2001/tag/tag-weekly">meeting minutes</a>, <a href="http://www.w3.org/2001/tag/">f2f notes</a>, <a href="http://www.w3.org/2001/tag/group/track/">issues</a>, <a href="http://www.w3.org/2001/tag/group/track/products">delivered products</a>, and <a href="http://www.w3.org/2001/tag/findings#approved">findings</a> I&#8217;ve come to a sobering conclusion: the TAG isn’t focused on eliminating the biggest sources of developer pain today. Now, you can argue that this might not be their job, but I won&#8217;t agree. It&#8217;s the TAGs job to help ensure the health of the platform, both for publishers and search engines, but also for authors. And the web as a platform is in some real trouble today.</p>
<p>There doesn&#8217;t seem to be a sense of urgency in the TAG about the corrosive effects of poor design and integration on the overall usability and health of the system. The Web to the TAG, as I can understand it through the meeting minutes and notes, is a collection of documents that represent internally-referential collections of data which are are linked to other documents, not a series of applications that are attempting ever more impressive feats of richness on a platform that stymies them every time you hit one of the seams. In reality it is (aspirationally) both things but the very real tensions between them don&#8217;t appear in the TAG&#8217;s work, leading me to believe that it doesn&#8217;t comprehend the latter aspect of web development today and what that means for the future health and viability of the platform.</p>
<p>I drone <a href="http://infrequently.org/2012/04/bedrock/">on</a> and <a href="http://infrequently.org/2012/04/one-for-dave-and-david/">on</a> and <em><a href="http://infrequently.org/2012/11/layers-of-confusion/">on</a></em> about layering because explaining each bit of the platform in terms of the one below it relieves much of the tension created by disconnected declarative forms and APIs. This matters because in today&#8217;s web when you go <em>ever so slightly</em> off the path paved by a spec&#8217;s use-cases, the drop-off is impossibly steep, and the only way to keep from risking life-threatening abstraction level transitions is to flood the entire canyon with JavaScript and hope you can still swim in the resulting inland sea of complexity. This is what our biggest, &#8220;best&#8221; webapps do today, relying on ENORMOUS piles of JavaScript that largely serve to re-create what browsers already do in the hopes of marginally extending that capability. It&#8217;s simply nuts, but the TAG doesn&#8217;t seem to acknowledge the threat this poses to everything it holds dear: linking, declarative forms, data&#8230;it&#8217;s all about to be lost beneath the waves, and because the TAG doesn&#8217;t understand the growing importance of JS, it seemingly doesn&#8217;t see the threat. Declarative forms disappear first beneath imperatively-delivered complexity; lingua-franca APIs next. Without ways of getting what your app needs while keeping one foot on the declarative path, app developers do what they must; declarative data and relationships become &#8220;nice to haves&#8221; not &#8220;the way you do it&#8221;. Layering provides easy steps between the levels of abstraction, avoiding the need to re-create what the platform was already doing for you along with whatever custom thing you need &#8212; and it&#8217;s not the TAG&#8217;s current agenda.</p>
<p>If elected, I will work to fix that. The TAG is the right group to formulate and articulate a theory of good layering in the web platform&#8217;s architecture and it&#8217;s the only group at the W3C whose mission is to help spec authors wrestle with large-scale design and integration problems like this. My background is in apps, and JS, and browsers, and I work at one of the few places deeply invested in ensuring that we maintain a healthy, declarative web for the future. I care tremendously about the viability of the largely-declarative web. Through my work with Dimitry Glazkov and many others on Web Components I&#8217;ve done as much as anyone in the last decade to help build a bridge between the JS and declarative worlds. Dimitry and I created and led the team here at Google that have put Shadow DOM, CSS Variables, Custom Elements, Mutation Observers (and Object.observe) into specs and on the platform agenda, all with the explicit goal of creating better layering; explaining the magic in today&#8217;s platform and drawing connections between the bits that had none before. And I think we need to keep building more of those bridges, but it&#8217;s hard when W3C culture views that agenda with suspicion. Why would any WG concern itself with integration with specs outside its charter? It&#8217;s the TAGs job to inject that global perspective. I believe the TAG should pursue the following work as a way of filling its <a href="http://www.w3.org/2004/10/27-tag-charter.html">charter</a>:</p>
<ul>
<li><b>Getting reconnected to web developers</b>: <a href="http://www.w3.org/2001/tag/">today&#8217;s TAG</a> isn&#8217;t composed of web developers (<a href="http://www.youtube.com/watch?v=Ug6XAw6hzaw&#038;t=1m29s" target="_new">Sir Tim excepted</a>) and the general level of familiarity on the committee with the pressing issues in web development seems low. As a member I&#8217;ll press to ensure that at least one of the face-to-face meetings each year overlaps with an industry web development conference (not an academic symposium). Having the TAG simply go and listen, and perhaps answer questions in such a forum, would do much to illuminate the gulf in understanding. I also support <a href="http://marcosc.com/2012/12/w3c-tag-elections/">Marco&#8217;s agenda</a> of direct developer outreach (G+, AMA, IRC, etc.)</li>
<li><b>Forming and expressing an opinion about idiomatic JS APIs</b>: the W3C is the body that specifies JavaScript&#8217;s largest, most important standard library yet it doesn&#8217;t seem to treat that task with any care. Poor integration with JS types, idioms, library conventions, and calling conventions are the calling card of W3C APIs. The detrimental effects are pervasive and corrosive. The TAG should produce a guide on designing idiomatic JS APIs for WGs to use. Additionally, the TAG should use its spec review perch to call out poorly designed JS APIs as such and propose changes that improve full-stack integration. Lastly, the TAG should be open to facilitating (or teaching!) classes on how to design good APIs for the web. It&#8217;s a skill that can be learned like any other, and the TAG has  a unique responsibility towards ensuring that the next generation of APIs is better than the last.</li>
<li><b>Bridge building to TC39</b>: I&#8217;ve served on ECMA TC39 &#8212; the standards body for JavaScript &#8212; since 2007 and in that time I&#8217;ve seen how the dysfunctional relationship with the W3C enables terrible API design. Needless to say, the results haven&#8217;t been great. For a small taste, go look at some <a href="http://www.html5rocks.com/en/tutorials/indexeddb/todo/">IndexedDB samples</a>. There are dozens of terrible DOM APIs (from the perspective of JS) and JS fails to help describe interfaces well enough (from the perspective of DOM). The impasse has even <a href="http://www.w3.org/TR/WebIDL/">been codified</a>. For the sake of the platform and the developers who must use it, we need to do better. I will push to ensure that at least one of the face-to-face meetings of TC39 each year overlaps with a TAG meeting. I&#8217;m hopeful that with my fellow TC39 delegate (Yehuda Katz) and the maintainer of DOM (Anne van Kesteren) also on the TAG, we can make serious progress on this front, actively building a culture of understanding between TC39 and the W3C and furthering the common goal of a web that&#8217;s competitive and well integrated.</li>
<li><b>Advocate for layering</b>: it&#8217;s the TAGs natural role to advocate for coherence in the platform, not only at the markup level, but also inside the app runtime bits that take up so very much of the time in W3C&#8217;s most active WGs. If the TAG doesn&#8217;t do this, asking the important questions at the right time and working to show the benefits of collaboration and cross-API thinking, who will? To combat this, I propose that the TAG take as an open issue the lack of coherence in the client side platform and work to identify the largest developer pain-points in findings that work to set an agenda for WGs in the future. There is no hope for a well-integrated, layered platform without every WG accepting some responsibility for the usability and layering commons, and if elected I will work to ensure the TAG is a tireless advocate for that commons.</li>
</ul>
<p>If that sounds like meaningful progress to you, I&#8217;d appreciate your organization&#8217;s vote; along with your consideration to vote for my fellow reformers: Yehuda Katz, Anne van Kesteren, Peter Linss, and Marcos Cáceres. AC reps for each organization can <a href="https://www.w3.org/2002/09/wbs/33280/tag-20121203/">vote here</a> and have 4 votes to allocate in this election. Voting closes near the end of the month, and it&#8217;s also holiday season, so if you work at a <a href="http://www.w3.org/Consortium/Member/List">member organization</a> and aren&#8217;t the AC rep, please, find out who that person in your organization is and make sure they vote. The TAG can&#8217;t fix the web or the W3C, but I believe that with the right people involved it can do a lot more to help the well-intentioned people who are hard at work in the WGs to build in smarter ways that pay all of us back in the long run.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/12/reforming-the-w3c-tag/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Inadmissible Arguments</title>
		<link>http://infrequently.org/2012/08/inadmissible-arguments/</link>
		<comments>http://infrequently.org/2012/08/inadmissible-arguments/#comments</comments>
		<pubDate>Wed, 15 Aug 2012 14:16:04 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1896</guid>
		<description><![CDATA[I spend a lot of time working in, on, and around web standards. As a part of this work, several bogus perspectives are continuously deployed to defend preferred solutions. I hereby call bullshit on the following memetic constructs: &#8220;That&#8217;s just a browser caching problem.&#8221; Look for this to be deployed along standards-wonk classics such as [...]]]></description>
				<content:encoded><![CDATA[<p>I spend a lot of time working in, on, and around web standards. As a part of this work, several bogus perspectives are continuously deployed to defend preferred solutions. I hereby call bullshit on the following memetic constructs:</p>
<h2>&#8220;That&#8217;s just a browser caching problem.&#8221;</h2>
<p>Look for this to be deployed along standards-wonk classics such as &#8220;our job should just be to provide low-level primitives&#8221;, &#8220;we don&#8217;t know enough to solve this&#8221;, and &#8220;people will just write tiny libraries to provide that&#8221;.</p>
<p>&#8220;It&#8217;s a caching problem&#8221; is a common refrain of those who don&#8217;t build apps and aren&#8217;t judged on their latency. And it&#8217;s <em>transparently</em> bullshit in the web context. It relies on you forgetting &#8212; for just that split second while it sounds possible to duck the work at hand &#8212; that we&#8217;re talking about a platform whose primary use-case is sending content across a narrow, high-latency pipe. If you work in web standards and <em>don&#8217;t</em> acknowledge this constraint, you&#8217;re a menace to others.</p>
<p>Recent history alone should be enough to invalidate the caching argument; remember Applets? Yeah, Java had lots of problems on the client side, but what you saw with client-side Java were the assumptions of server-side engineers (who get to control things like their deployment VM versions, their hardware and spindle speeds, etc.) imported to distributed code environments where you weren&#8217;t pulling from a fast local disk in those critical moments when you first introduced your site/app/whatever to the users. Instead, you saw the piles upon piles of JARs that get created when you assume that that next byte is nearly free, that disk is only 10ms away, and that cold startups are the rare case. It worked out predictably and Java-like systems succeed on the client when their cultural assumptions <em>do</em> align with deployment constraints &#8212; Android and iOS are great examples. Their mediated install processes see to it.</p>
<p>Back out here on the wolly web, caching is something that&#8217;s under user control. It <em>must</em> be for privacy reasons, and we know from long experience that <em>users clear their caches</em>. The &#8220;cache&#8221; they can&#8217;t clear is the baseline set of functionality the platform provides &#8212; i.e., the built in stuff on all runtimes developer cares about&#8230;which is what specs can effect (obliquely and with some delay).</p>
<p>By the time you&#8217;re having a serious discussion about adding a thing to a spec among participants who aren&#8217;t obvious bozos, you can bet your sweet ass that the reason it was <em>brought up in the first place</em> is a clear and obvious replication of effort among existing users bordering on the ubiquitous &#8212; often in libraries they use. Saying that someone can write a library rises no higher than mere truism, and saying that a standards body shouldn&#8217;t provide some part of the common features found among those existing libraries because caching will make the cost of those libraries moot is <a href="http://httparchive.org/interesting.php#onLoad">ignorance</a> or standards-jujitsu in an attempt to get a particular proposal shelved for some other reason.</p>
<p>As bad as the above is, consider the (historically prevalent) use of this argument regarding &#8220;why we don&#8217;t need no stinking&#8221; markup features &#8212; just &#8220;fix&#8221; browser caching and &#8220;give me a low-level thing and I&#8217;ll build [rounded-corners, gradients, new layout mechanisms, CSS3d xforms, etc.] myself&#8221;. The subtle bias towards JavaScript and away from a declarative web is one of the worst, most insidious biases of the already enfranchised upper-class of JavaScript-savvy web developers, perpetuating a two-tier web in which &#8220;real engineers&#8221; can do better every year but wherein those same expressiveness and performance gains aren&#8217;t transmitted to folks without CS degrees (yes, I&#8217;m looking straight at you, WebGL). You almost want to give it to them, though, so they&#8217;ll finally come to terms with how wrong they really are about the ability for caching to be &#8220;fixed&#8221;.</p>
<p>We&#8217;ve spent a decade on this &#8212; remember that we&#8217;re all using CDNs, pulling our JS libraries from <a href="https://developers.google.com/speed/libraries/devguide">edge-cached servers with stable URLs for optimal LRU behavior</a>, running minifiers, setting far-forward expires, etc. And that&#8217;s just what webdevs are doing: meanwhile browser vendors have been working day and night to increase the sizes of caches, ensure full caches where possible, and implement sometimes crazy specs that promise to help. It&#8217;s not for lack of trying, but we still don&#8217;t collectively know how to &#8220;fix&#8221; caching.</p>
<p>Think libraries are free? Show me how you&#8217;ll make &#8216;em free and I&#8217;ll start taking you seriously. Until then, bozo bit <em>flipped</em>.</p>
<h2>&#8220;It should have exactly the same API as library X&#8221;</h2>
<p>Similar arguments include &#8220;it <em>must</em> be pollyfillable&#8221;, etc.</p>
<p>Why is this bullshit? Not because it represents an aversion to being caught in an implementation/deployment dead zone &#8212; that&#8217;s a serious concern. Nobody wants a better world dangling out there just beyond reach, waiting for Vendor X to pick it up and implement or for Version Y of Old Browser to die so that 90% of your clients can acces the feature. That&#8217;s where libraries provide great value <em>and will continue to, no matter what the eventual feature looks like</em>. Remember, the dominant libraries in use by developers don&#8217;t have Firefox, Chrome, IE, and Opera-specific versions that you serve up based on client. The platonic ideal is 180-degrees in the other direction: one code base, feature detection, polyfills, progressive enhancement &#8212; basically anything within (and often well outside of) reason to keep from serving differential content. So your library is going to have all those versions <em>anyway</em> until <em>all</em> of your clients have the new-spec version. Optimizing based on existing API design because &#8220;now we can polyfill it without extra effort!&#8221; misunderstands both the role of spec designers and of libraries and serves users very poorly indeed.</p>
<p>Where this argument becomes <em>truly</em> inadmissible, though, is when it seeks to define the problem to be &#8220;what our API already does&#8221;. Turns out that the language you can design features with when all you have is JavaScript and HTML/CSS patterns is&#8230;well&#8230;the JS, HTML, and CSS you have today. Powerful yes. Expressive? Hrm. If your job, however, is to evolve an integrated platform, taking on a constraint predicated on the current form of your systems is nuts. There are some hard constraints like that (backwards compatibility), but adopting some form of hack as the &#8220;blessed&#8221; way of doing something without looking around and going &#8220;how can we do this better given that we have more powerful and expressive language to solve the problem with?&#8221; is nothing but lost opportunity.</p>
<p>Yes, a standards group might look around and go &#8220;nope, we can&#8217;t do better than that polyfill/library&#8221; and adopt the solution wholesale. That&#8217;s not a bad thing. What <em>is</em> bad, though, is advocacy about far-future solutions to current problems based solely on the idea that some library totally nailed it and we shouldn&#8217;t be asking for anything more &#8212; e.g.: Microdata cribbed from RDFa and Microformats when what you <em>really</em> wanted was Web Components. Rote recital of existing practice is predictably weak sauce that robs the platform of its generative spark. We should all be hoping for enhancements that make the future web <em>stronger</em> than today&#8217;s, and you only find those opportunities by taking off the blinders and giving yourself free reign to do things that libraries, polyfills, and hack just can&#8217;t.</p>
<p>What to do about the developers and users caught in the crossfire? Well, we <em>can</em> advocate for degradable, polyfill-friendly designs, but there are limits to that. The most hopeful, powerful way to make the pain disappear is to ensure that more of our users year-over-year are on browsers/platforms that auto-update and won&#8217;t ever be structurally left-behind again. And yes, that&#8217;s something that every web developer should be working towards; prompting users to update to current-version auto-upgrading &#8212; &#8220;evergreen&#8221;, if you will &#8212; browsers. Remember: you get the web you ask your users for.</p>
<h2>&#8220;Just tell us the use cases&#8221;</h2>
<p>This is the one I&#8217;m most sick of hearing from the mouths of standards wonks and authors. What they&#8217;re <em>trying</em> to say is some well-meaning combination of:</p>
<ul>
<li>If you tell us exactly how you&#8217;re doing whatever it is you&#8217;re accomplishing today, we&#8217;ll run the risk of just adopting some API that was designed with some bogus constraints (see above).</li>
<li>We need to communicate to a lot of people involved in this effort why they should care, &#8217;cause putting stuff into browsers is a shitload of work.</li>
</ul>
<p>What it often winds up doing, however, is serving as a way for a standards body or author to shut up unproductive folks; folks who aren&#8217;t willing to do the work of helping them come to enlightenment about the architecture of the current solution, the constraints it was built under, and the deficiencies it leaves you with. Or it can be used to avoid that process entirely &#8212; which is where we&#8217;re getting towards bullshit territory. Taken to the extreme (and it too often is) the &#8220;use-cases, not details&#8221; approach infantilizes standards body participants, setting a bar too high for the folks who are crying out for help and setting the bar too low for the standards body because, inevitably, the tortured text of the &#8220;use cases&#8221; is an over-terse substitue for a process, a <em>way</em> of building, and an architectural approach. Use-cases (as you see them for HTML and CSS in particular) become architecture-free statements, no more informative than a line plucked at random from Henry V. Suggestive, yes. Useful? Nope. The very idea of building standards without a shared concept of architecture is <em>bogus</em>, and standards participants need to stop hiding behind this language. If you don&#8217;t understand something, say so. If many people work hard to explain it and can&#8217;t, <em>ask for a sample application or snippet to hack on</em> so you can do a mind-meld with their code and can ask questions about it in context.</p>
<p>Yes, having the use-cases matters, but nobody should be allowed to pretend that they&#8217;re a substitue for understanding the challenges of an architecture.</p>
<hr />
<p>While I&#8217;ve only covered a few of the very worst spec-building tropes, it&#8217;s by no means the end of the rhetorical shit list. Perhaps this will be a continuing series &#8212; although I&#8217;m sure this post will offend enough folks to make me think twice about it. If we put an end to just these, though, a lot of good could be accomplished. Here&#8217;s to hoping.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/08/inadmissible-arguments/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hoisted From The Comments</title>
		<link>http://infrequently.org/2012/04/hoisted-from-the-comments/</link>
		<comments>http://infrequently.org/2012/04/hoisted-from-the-comments/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 10:40:49 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1844</guid>
		<description><![CDATA[Some stuff is too good to leave in the shadows. On my Bedrock post, James Hatfield writes in with a chilling point, but one which I&#8217;ve been making for a long while: ”every year we’re throwing more and more JS on top of the web” The way things are going in my world, we are [...]]]></description>
				<content:encoded><![CDATA[<p>Some stuff is too good to leave in the shadows. On my <a href="">Bedrock</a> post, <a href="http://www.emenoh.com/">James Hatfield</a> writes in with a chilling point, but one which I&#8217;ve been making for a long while:</p>
<blockquote><p>
”every year we’re throwing more and more JS on top of the web”</p>
<p>The way things are going in my world, we are looking at replacing the web with JS, not simply layering. At a certain point you look at it all and say “why bother”. Browsers render the DOM not markup. They parse markup. Just cut out the middle man and send out DOM – in the form of JS constructs.</p>
<p>The second part is to stop generating this markup which then must be parsed on a server at the other end of a slow and high latency prone communication channel. Instead send small compact instructions to the browser/client that tells it how to render and when to render. Later you send over the data, when it’s needed&#8230;
</p></blockquote>
<p>This is a clear distillation of what scares me about the road we&#8217;re headed down because for each layer you throw out and decide to re-build in JS, you end up only doing what you <em>must</em>, and that&#8217;s often a deadline-driven must. Accessibility went to hell? Latency isn&#8217;t great? Doesn&#8217;t work at all without script? Can&#8217;t be searched? When you use built-ins, those things are more-or-less taken care of. When we make them optional by seizing the reigns with script, not only do we wind up playing them off against each other (which matters more, a11y or latency?) we often find that developers ignore the bits that aren&#8217;t flashy. Think a11y on the web isn&#8217;t great now? Just wait &#8217;till it&#8217;s <em>all</em> JS driven.</p>
<p>It doesn&#8217;t have to be this way. When we get <a href="http://code.google.com/p/mdv/">Model Driven Views</a> into the browser we&#8217;ll have the powerful &#8220;just send data and template it on the client side&#8221; system everyone&#8217;s looking for but without threatening the searchability, a11y, and fallback behaviors that make the web so great. And this is indicative of a particularly strong property of markup: it&#8217;s about <em>relationships</em>. &#8220;This thing references that thing over there and does something with it&#8221; is hard for a search engine to tease out if it&#8217;s hidden in code, but if you put it in <em>markup</em>, well, you&#8217;ve got a future web that continues to be great for users, the current crop of developers, and whoever builds and uses systems constructed on top of it all later. That last group, BTW, is you if you use a search engine.</p>
<p>But it wasn&#8217;t all clarity and light in the comments. <a href="http://mailmarkup.org/">Austin Cheney</a> <a href="http://infrequently.org/2012/04/one-for-dave-and-david/#comment-239698">commented</a> on the <a href="http://infrequently.org/2012/04/one-for-dave-and-david">last post</a> to say:</p>
<blockquote><p>
This article seems to misunderstand the intention of these technologies. HTML is a data structure and nothing more. JavaScript is an interpreted language whose interpreter is supplied with many of the most common HTML parsers. That is as deep as that relationship goes and has little or nothing to do with DOM.</p>
<p>&#8230;It would be safe to say that DOM was created because of JavaScript, but standard DOM has little or nothing to do with JavaScript explicitly. Since the release of standard DOM it can be said that DOM is the primary means by which XML/HTML is parsed suggesting an intention to serve as a parse model more than a JavaScript helper.</p>
<p>Types in DOM have little or nothing to do with types in JavaScript. There is absolutely no relationship here and there shouldn’t be&#8230;You cannot claim to understand the design intentions around DOM without experience working on either parsers or schema language design, but its operation and design have little or nothing to do with JavaScript. JavaScript is just an interconnecting technology like Java and this is specifically addressed in the specification in Appendix G and H respectively.
</p></blockquote>
<p>And, after <a href="http://infrequently.org/2012/04/one-for-dave-and-david/#comment-239699">I tried to make the case that noting how it is today is no replacement for a vision for how it should be</a>, Austin <a href="http://infrequently.org/2012/04/one-for-dave-and-david/#comment-239701">responds</a>:</p>
<blockquote><p>
The problem with today’s web is that it is so focused on empowering the people that it is forgetting the technology along the way. One school of thought suggests the people would be better empowered if their world were less abstract, cost radically less to build and maintain, and is generally more expressive. One way to achieve such objectives is alter where costs exist in the current software life cycle of the web. If, for instance, the majority of costs were moved from maintenance to initial build then it could be argued that more time is spent being creative instead of maintaining.</p>
<p>I have found that when working in HTML alone that I save incredible amounts of time when I develop only in XHTML 1.1, because the browser tells you where your errors are. &#8230; Challenges are removed and costs are reduced by pushing the largest cost challenges to the front of development.</p>
<p>&#8230; The typical wisdom is that people need to be empowered. If you would not think this way in your strategic software planning then why would it make sense to think this way about strategic application of web technologies? &#8230;
</p></blockquote>
<p>This might all sound very rational on one level, but a few points need to be made:</p>
<ul>
<li>If we&#8217;re not building technology <em>for people</em>, WTF are we doing with these CPU cycles exactly?
</li>
<li>Speed of iteration is a key enabler of progress in any technology stack I&#8217;ve ever worked in
</li>
<li>Strictness fails in the wild
</li>
</ul>
<p>I think Austin&#8217;s point about moving costs from maintenance to build is supposed to suggest that if we were only more strict about things, we&#8217;d have less expensive maintenance of systems, but it&#8217;s not clear to me that this has anything to do with strictness. My observation from building systems is that this has a lot more to do with being able to build modular, isolated systems that compose well. Combine that with systems that let you iterate fast, and you can grow very large things that can evolve in response to user needs without turning into spaghetti quite so quickly. Yes, the web isn&#8217;t great for that today, but strictness is orthogonal. Nothing about <a href="http://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html">Web Components</a> demands strictness to make maintainability infinitely better.</p>
<p>And the last point isn&#8217;t news. <a href="http://en.wikipedia.org/wiki/Jon_Postel#Postel.27s_Law">Postel&#8217;s Law</a> isn&#8217;t a plea about what you, dear software designer, <em>should</em> be doing, it&#8217;s an insightful clue into the economics of systems at scale. XML tried being strict and <em>it didn&#8217;t work</em>. Not even for RSS. Mark Pilgrim&#8217;s famously heroic attempts at building a reliable feed parser match the war stories I&#8217;ve heard out of the builders of every large RSS system I&#8217;ve ever talked to. It&#8217;s not that it&#8217;s a nice idea to be forgiving about what you accept, it&#8217;s that there&#8217;s no way around it if you want scale. What Austin has done is the classic bait-and-switch: he has rhetorically substituted what works in his organization (and works well!) for what&#8217;s good for the whole world, or even what&#8217;s plausible. I see this common logical error in many a standards adherent/advocate. They imagine some world in which it&#8217;s <em>possible</em> to be strict about what you accept. I think that world might be possible, but the population would need to be less than the size of a small city. Such a population would never have ever created any of the technology we have, and real-world laws would be how we&#8217;d adjudicate disputes. As soon as your systems and contracts deal with orders of magnitude more people, it <em>pays to be reliable</em>. You&#8217;ll win if you do and lose if you don&#8217;t. It&#8217;s inescapable. So lets banish this sort of small-town thinking to the mental backwaters where it belongs and get on with building things for <em>everyone</em>. After all, this is about people. Helping <em>sentient beings</em> achieve their goals in ways that are both plausible and effective.</p>
<p>If helping people is <em>not</em> what this is about, I want out.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/04/hoisted-from-the-comments/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>For Dave and David</title>
		<link>http://infrequently.org/2012/04/one-for-dave-and-david/</link>
		<comments>http://infrequently.org/2012/04/one-for-dave-and-david/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 14:49:16 +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=1819</guid>
		<description><![CDATA[Dave Herman jokingly accused me a couple of TC39 meetings ago of being an &#8220;advocate for JavaScript as we have it today&#8221;, and while he meant it in jest, I guess to an extent it&#8217;s true &#8212; I&#8217;m certainly not interested in solutions to problems I can&#8217;t observe in the wild. That tends to scope [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://calculist.org/">Dave Herman</a> jokingly accused me a couple of TC39 meetings ago of being an &#8220;advocate for JavaScript as we have it today&#8221;, and while he meant it in jest, I guess to an extent it&#8217;s true &#8212; I&#8217;m certainly not interested in solutions to problems I can&#8217;t observe in the wild. That tends to scope my thinking aggressively towards solutions that look like they&#8217;ll have good adoption characteristics. Fix things that are broken for real people in ways they can understand how to use.</p>
<p>This is why I get so exercised about <a href="http://www.w3.org/TR/WebIDL/">WebIDL</a> and the way it breaks the mental model of JS&#8217;s &#8220;it&#8217;s just extensible objects and callable functions&#8221;. It&#8217;s also why my discussions with folks at last year&#8217;s <a href="http://www.w3.org/2011/11/TPAC/">TPAC</a> were so bleakly depressing. I&#8217;ve been meaning to write about TPAC ever since it happened, but the time and context never presented themselves. Now that I got some of my words out about <a href="http://infrequently.org/2012/04/bedrock/">layering in the platform</a>, the time seems right.</p>
<p>Let me start by trying to present the argument I heard from multiple sources, most likely from (in my feeble memory) <strike><a href="http://annevankesteren.nl/">Anne van Kestern</a></strike> Jonas Sicking(?):</p>
<blockquote><p>
ECMAScript is not fully self-describing. <a href="http://es5.github.com/#x8.6.2">Chapter 8 drives a hole right through the semantics, allowing host objects to whatever they want</a> and more to the point, there&#8217;s no way in JS to describe e.g. list accessor semantics. You can&#8217;t subclass an Array in JS meaningfully. JS doesn&#8217;t follow it&#8217;s own rules, so why should we? DOM is just host objects and all of DOM, therefore, is Chapter 8 territory.
</p></blockquote>
<p>Brain <em>asploded</em>.</p>
<p>Consider the disconnect: they&#8217;re not saying &#8220;oh, it sure would be nice if our types played better with JS&#8221;, they&#8217;re saying &#8220;you and what army are gonna make us?&#8221; Remember, WebIDL isn&#8217;t just a shorthand for describing JavaScript classes, it&#8217;s an <a href="http://www.w3.org/TR/WebIDL/#idl-types">entirely parallel type hierarchy</a>.</p>
<p>Many of the Chapter 8 properties and operations are still in the realm of magic from JS today, and we&#8217;re working to open more of them up over time by giving them API &#8212; in particular I&#8217;m hopeful about Allen Wirfs-Brock&#8217;s work on making array accessors something that we can treat as a protocol &#8212; but it&#8217;s magic that DOM is appealing to and even <a href="http://www.w3.org/TR/WebIDL/#es-platform-objects">specifying itself in terms of</a>. Put this in the back of your brain: DOM&#8217;s authors have declared that they <em>can and will do magic</em>.</p>
<p>Ok, that&#8217;s regrettable, but you can sort of understand where it comes from. Browsers are largely C/C++ enterprises and DOM started in most of the successful runtimes as an FFI call <em>from</em> JS <em>to</em> an underlying set of objects which are owned by C/C++. The truth of the document&#8217;s state was not owned by the JS heap, meaning every API you expose is a conversation with a C++ object, not a call into a fellow JS traveler, and this has profound implications. While we have one type for strings in JS, your C++ side might have <code>bstr</code>, <code>cstring</code>, <code>wstring</code>, <code>std::string</code>, and/or some variant of <code>string16</code>. </p>
<p>JS, likewise, has <code>Number</code> while C++ has <code>char</code>, <code>short int</code>, <code>int</code>, <code>long int</code>, <code>float</code>, <code>double</code>, <code>long double</code>, <code>long long int</code>&#8230;you get the idea. If you&#8217;ve got storage, C++ has about 12 names for it. Don&#8217;t even get me started on <code>Array</code>.</p>
<p>It&#8217;s natural, then, for DOM to just make up it&#8217;s own types so long as its raison d&#8217;être is to front for C++ and not to be a standard library for JS. Not because it&#8217;s malicious, but because that&#8217;s just what one <em>does</em> in C++. Can&#8217;t count on a particular platform/endianness/compiler/stdlib? Macro that baby into submission. <a href="http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/platform/">WTF</a>, indeed.</p>
<p>This is the same dynamic that gives rise to the tussle over <a href="http://infrequently.org/2011/10/real-constructors-webidl-last-call/">constructable constructors</a>. To recap, there is no way in JS to create a function which cannot have <code>new</code> on the left-hand-side. Yes, that might return something other than an instance of the function-object on the right-hand side. It might even throw an exception or do something entirely non-sensical, but because <code>function</code> is a JavaScript concept and because all JS classes are <em>just functions</em>, the idea of an unconstructable constructor is entirely alien. It&#8217;s not that you <em>shouldn&#8217;t</em> do it&#8230;the moment to have an opinion about that particular question never arises in JS. That&#8217;s not true if you&#8217;re using magic to front for a C/C++ object graph, though. You <em>can</em> have that moment of introspection, and you can choose to say &#8220;no, JS is wrong&#8221;. And they do, <a href="http://lists.w3.org/Archives/Public/public-script-coord/2011JulSep/thread.html#msg114">over and over</a>.</p>
<p>What we&#8217;re witnessing here isn&#8217;t &#8220;right&#8221; or &#8220;wrong&#8221;-ness. It&#8217;s entirely conflicting world views that wind up in tension because from the perspective of some implementations and all spec authors, the world looks like this:</p>
<p><img src="http://infrequently.org/wp-content/uploads/2012/04/today_small.png" alt="" title="The layers of today&#039;s platform." width="404" height="274" class="aligncenter size-full wp-image-1821"/></p>
<p>Not to go all Jeff Foxworthy on you, but if this looks reasonable to you, <em>you might be a browser developer</em>. In this worldview, JS is just a growth protruding from the side of an otherwise healthy platform. But that&#8217;s not how webdevs think of it. True or not, this is the mental model of someone scripting the browser:</p>
<p><img src="http://infrequently.org/wp-content/uploads/2012/04/a_choice_cut_of_well_marbled_platform.png" alt="" title="The Well-Marbled Platform" width="404" height="275" class="aligncenter size-full wp-image-1824" /></p>
<p>The parser, DOM, and rendering system are browser-provided, but they&#8217;re just JS libraries in some sense. With <code>&lt;canvas&gt;</code>&#8216;s 2D and 3D contexts, we&#8217;re even punching all the way up to the rendering stack with JS, and it gets ever-more awkward the more our implementations look like the first diagram and not the second.</p>
<p>To get from parser to DOM in the layered world, you have to describe your objects <em>as JS objects</em>. This is the disconnect. Today&#8217;s spec hackers don&#8217;t think of their task as the work of describing the imperative bits of the platform in the platform&#8217;s imperative language. Instead, their mental model (when it includes JS at all) pushes it to the side as a mere consumer in an ecosystem that it is not a coherent part of. No wonder they&#8217;re unwilling to deploy the magic they hold dear to help get to better platform layering; it&#8217;s just not something that would ever occur to them.</p>
<p>Luckily, at least on the implementation side, this is changing. Mozilla&#8217;s work on <a href="https://github.com/andreasgal/dom.js">dom.js</a> is but one of <a href="https://github.com/arv/JS-DOM-Test">several</a> projects looking to move the source of truth for the rendering system out of the C++ heap and into the JS heap. Practice is moving on. It&#8217;s time for us to get our ritual lined up with the new reality.</p>
<p>Which brings me too David Flanagan who last fall <a href="https://twitter.com/#!/__DavidFlanagan/status/109415801542557696">asked to read my manifesto on how the platform should be structured</a>. Here it is, then:</p>
<blockquote><p>
The network is our bottleneck and markup is our lingua-franca. To deny these facts is to design for failure. Because the network is our bottleneck, there is incredible power in growing the platform to cover our common use cases. To the extent possible, we should attempt to grow the platform through markup first, since markup provides the most value to the largest set of people and provides a coherent way to expose APIs via DOM.</p>
<p>Markup begets JS objects via a parser. DOM, therefore, is merely the largest built-in JS library.</p>
<p>Any place where you cannot draw a line from browser-provided behavior from a tag to the JS API which describes it is magical. The job of Web API designers is first to introduce new power through markup and second to banish magic, replacing it with understanding. There may continue to be things which exist outside of our understanding, but that is a challenge to be met by cataloging and describing them in our language, not an excuse for why we cannot or should not.
</p></blockquote>
<p>The ground below our feet is moving and alignment throughout the platform, while not inevitable, is clearly desirable and absolutely doable in a portable and interoperable way. Time, then, to start making Chapter 8 excuses in the service of being <em>more</em> idiomatic and <em>better</em> layered. Not less and worse.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/04/one-for-dave-and-david/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Bedrock</title>
		<link>http://infrequently.org/2012/04/bedrock/</link>
		<comments>http://infrequently.org/2012/04/bedrock/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 05:41:28 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[dhtml]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1789</guid>
		<description><![CDATA[Jetlag has me in its throes which is as good an excuse as any to share what has been keeping me up many nights over the past couple of years; a theory of the web as a platform. I had a chance last week to share some of my thinking here to an unlikely audience [...]]]></description>
				<content:encoded><![CDATA[<p>Jetlag has me in its throes which is as good an excuse as any to share what has been keeping me up many nights over the past couple of years; a theory of the web as a platform.</p>
<p>I had a chance last week to share some of my thinking here to an unlikely audience at <a href="http://www.eclipsecon.org/2012/keynotes">EclipseCon</a>, a wonderful experience for which my thanks go to Mike Milinkovich and Ian Skerrett for being crazy enough to invite a &#8220;web guy&#8221; to give a talk.</p>
<p>One of the points I tried (and perhaps failed) to make in <a href="http://infrequently.org/12/eclipsecon/#1">the talk</a> was that in every platform that&#8217;s truly a <em>platform</em> it&#8217;s important to have a stable conceptual model of what&#8217;s &#8220;down there&#8221;. For Java that&#8217;s not the language, it&#8217;s the JVM. For the web&#8230;well&#8230;um. Yes, it bottoms out at C/C++, but that&#8217;s mostly observable through spooky action at a distance. The expressive capacity of C/C++ show up as limitations and mismatches in web specs all the time, but the essential semantics &#8212; C/C++ is just words in memory that you can do whatever you please with &#8212; are safely hidden away behind APIs and declarative forms that are unfailingly high-level. Until they aren&#8217;t. And you can forget about composition most of the time.</p>
<p>For a flavor of this, I always turn back to <a href="http://blog.j15r.com/">Joel Webber&#8217;s</a> question to me several years ago: why can&#8217;t I over-ride the rendering of a border around an HTML element?</p>
<p>It&#8217;s a fair question and one I wrote off too quickly the first time he posed it. We have <code>&lt;canvas&gt;</code> which lets us draw lines however we like, so why can&#8217;t we override the path painting for borders? Why isn&#8217;t it just a method you implement like in Flex or Silverlight?</p>
<p>Put another way: there are some low level APIs in the web that <em>suggest</em> that such power should be in the hands of us mortals. When using a low-level thing, you pay-as-you-go since lower-level things need more code (latency and complexity)&#8230;but that&#8217;s a choice. Today&#8217;s web is often mysteriously devoid of the sort of sane layering, <em>forcing</em> you to re-build parallel systems to what&#8217;s already in the browser to get a job done. You can&#8217;t just subclass the right thing or plug into the right lifecycle method most of the time. Want a <code>&lt;canvas&gt;</code>? Fine. There you go. Want a <code>&lt;span&gt;</code>? Hot <code>&lt;span&gt;</code>s coming up! But don&#8217;t go getting any big ideas about using the drawing APIs from <code>&lt;canvas&gt;</code> to render your <code>&lt;span&gt;</code>. Both are magic in their own right and for no reason other than that&#8217;s the way it has always been.</p>
<p>The craziest part in all of this is that JavaScript <em>does</em> exist in the web so you can strictly speaking do whatever you want. Goodness knows that when the platform fails us today, we&#8217;re all-too-willing to just throw JS at it. It&#8217;s crazy, in this context then, that spec authors seem to be trying to uphold a golden principle: JavaScript <em>doesn&#8217;t</em> exist. Writing it out of the story allows you to just claim that your bit of the system is magic and that it doesn&#8217;t need an exposed lifecycle and plug-in architecture. New things can just be bolted onto the magic, no layering required. It&#8217;s magical turtles all the way down.</p>
<p>You can see why people who think in terms of VM&#8217;s and machine words might find this a bit <em>ahem</em> limiting.</p>
<p>But how much should we &#8220;web people&#8221; care about what they think? After all, &#8220;real programmers&#8221; have been predicting the imminent death of this toy browser thing for so long that I&#8217;m forgetting exactly when the hate took its various turns through the 7 stages; &#8220;Applets will save us from this insanity!&#8221;&#8230;&#8221;Ajax is a hack&#8221;&#8230;&#8221;just put a compiler in front of it and treat it as the dumbest assembler ever&#8221; (which is at least acceptance, of a sort). The web continues to succeed in spite of all of of this. So why bother with the gnashing of teeth?</p>
<p>Thanks to <a href="http://httparchive.org/trends.php">Steve Souders, I have an answer</a>: every year we&#8217;re throwing more and more JS on top of the web, dooming our best intended semantic thoughts to suffocation in the Turing tar pit. Inexorably, and until we find a way to send less code down the wire, us is them, and more so every day.</p>
<p><img style="height: 300px; width: 450px;" src="http://chart.apis.google.com/chart?chd=t:-1|12,11,12,12,12,12,12,12,12,12,13,13,13,13,13,14,14,13,14,14,14,14,14,13,14,14,14,14,14,14,14,14|-1|113,113,115,115,116,117,117,119,121,123,125,125,126,128,131,135,139,137,140,144,147,148,152,155,161,167,172,170,173,175,179,180&amp;chxl=0:|+%7C11%2F30%7C+%7C+%7C1%2F21%7C+%7C+%7C2%2F26%7C+%7C+%7C4%2F15%7C+%7C+%7C6%2F1%7C+%7C+%7C7%2F15%7C+%7C+%7C9%2F1%7C+%7C+%7C10%2F15%7C+%7C+%7C12%2F1%7C+%7C+%7C1%2F15%7C+%7C+%7C3%2F1&amp;chxt=x,y,r&amp;chs=450x300&amp;cht=lxy&amp;chco=E63C0B,982807&amp;chm=N,E63C0B,0,1::3,12,,h::8|N**kB,982807,1,1::3,12,,h::8&amp;chds=9,99,0,30,9,99,100,200&amp;chts=982807,24&amp;chtt=JS+Transfer+Size+%26+JS+Requests&amp;chma=5,5,5,25&amp;chls=1,6,3|1&amp;chxr=1,100,200,20|2,0,30,10&amp;chxs=1,982807,11.5,-0.5,lt,982807,982807|2,E63C0B,11.5,-0.5,lt,E63C0B,E63C0B&amp;chxtc=0,4|1,4&amp;chxp=0&amp;chdl=JS+Requests|JS+Transfer+Size+(kB)&amp;chdlp=bv|r"/></p>
<p>Let that picture sink in: at 180KB of JS on average, script isn&#8217;t some helper that gives meaning to pages in the breech, it <em>is</em> the meaning of the page. Dress it up all you like, but that&#8217;s where this is going.</p>
<p>Don&#8217;t think 180KB of JS is a lot? Remember, that&#8217;s <em>transfer size</em> which accounts for gzipping, not total JS size. Oy. And in most cases that&#8217;s more than 3x the size of the HTML being served (both for the page and for whatever iframes it embeds). And that&#8217;s not all; it&#8217;s worse for many sites which should know better. Check out those loading &#8220;filmstrip&#8221; views for <a href="http://httparchive.org/viewsite.php?pageid=905867">gawker</a>, <a href="http://httparchive.org/viewsite.php?pageid=903377">techcrunch</a>, and <a href="http://httparchive.org/viewsite.php?pageid=903208">the NYT</a>. You might be scrolling down, looking at the graphs, and thinking to yourself &#8220;looks like Flash is the big ticket item&#8230;&#8221;, and while that&#8217;s true in absolute terms, Flash isn&#8217;t what&#8217;s blocking page loads. <a href="http://httparchive.webpagetest.org/video/compare.php?tests=120315_8F_QAVB-r:1-c:0">JS is</a>.</p>
<p>And what for? What&#8217;s all that code doing, anyway?</p>
<p>It&#8217;s there for three reasons: first, to clean up the messes that browser vendors aren&#8217;t willing or able to clean up for themselves; second, to provide an API that becomes the new platform, and lastly to provide the app-specific stuff you are trying to get across. Only the last one is strictly valuable. You&#8217;re not including JQuery, Backbone, Prototype or Dojo into your pages <em>just</em> because you like the API (if you are, stop it). You&#8217;re doing it because the combination of API and even behavior across browsers makes them the <em>bedrock</em>. They are the new lisp of application construction; the common language upon which you and your small team can agree; just don&#8217;t expect anyone else to be able to pick up your variant without squinting hard.</p>
<p>This is as untenable as it is dangerous. It was this realization that set me and <a href="https://plus.google.com/111648463906387632236/posts">Dimitri Glazkov</a> off to build a team to do something about it more than a year and a half ago. The results are showing up now in the form of <a href="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html">Web Components and Shadow DOM</a>, <a href="http://www.youtube.com/watch?v=eRZ4pO0gVWw">Mutation Observers</a> as plumbing for <a href="http://code.google.com/p/mdv/">Model Driven View</a>, and a host of new CSS capabilities and JavaScript language expressiveness wins. If that sounds like a huge pile of seemingly un-related work, let me walk back to one of the motivating questions and then I&#8217;ll fast forward to the approach:</p>
<blockquote><p>What would it mean to be able to subclass an HTML Element?</p></blockquote>
<p>We observed that most of what the current libraries and frameworks are doing is just trying to create their own &#8220;widgets&#8221; and that most of these new UI controls had a semantic they&#8217;d like to describe in a pretty high-level way, an implementation for drawing the current state, and the need to parent other widgets or live in a hierarchy of widgets.</p>
<p>Heeeeeyyyyyy&#8230;.wait a minute&#8230;that sounds a lot like what HTML does! And you even have HTML controls which generate extra elements for visual styling but which you can&#8217;t access from script. This, BTW, is what you want when building your own controls. Think the bullets of list items or the sliders generated by <code>&lt;input type="range"&gt;</code>. There are even these handy (<a href="http://infrequently.org/2011/10/real-constructors-webidl-last-call/">non-constructable!?!</a>) constructors for the superclasses in JS already.</p>
<p>So what would you need access to in order to plug into that existing system? And how should it be described? This, by the way, is the danger zone. Right about this point in the logical chain most folks tend to fall back to what they know best: C++ hacker? Give &#8216;em a crappy C++-inspired high-level-ish JS API that will make the people yelling loudest stop beating you up. Declarative guy? Force everyone to describe their components as separate documents and&#8230;yeah. XUL. You get the idea. JavaScript person? Demand the lowest level API and as much unwarranted power as possible and pretend you don&#8217;t need the browser. JS libraries are the &#8220;fuck it, we&#8217;ll do it live!&#8221; of the web.</p>
<p>None of these are satisfying. Certainly not if what we want is a platform of the sort you might consider using &#8220;naked&#8221;. And if your &#8220;platform&#8221; always needs the same shims here and polyfills there, let me be candid: it ain&#8217;t no platform. It&#8217;s some timber and bolts out of which you can make a nice weekend DIY project of building a real platform.</p>
<p>So we need to do better.</p>
<p>What does better look like?</p>
<p>Better is layered. Better is being able to just replace what you need, to plug in your own bits to a whole that supports that instead of making you re-create everything above any layer you want to shim something into. This is why mutable root prototypes in JS and object mutability in general are such cherished and loathed properties of the web. It <em>is</em> great power. It&#8217;s just a pity we need it so often. Any plan for making things better that&#8217;s predicated on telling people &#8220;oh, just go pile more of your own parallel systems on top of a platform that already does 90% of what you need but which won&#8217;t open up the API for it&#8221; is <b><em>DOOMED</em></b>.</p>
<p>Thus began a archaeology project, one which has differed in scope and approach from most of the recently added web capabilities I can think of, not because it&#8217;s high-level or low-level, but because it is layered. New high-level capabilities are added, but instead of then poking a hole nearly all the way down to C++ when we want a low-level thing, the approach is to look at the high-level thing and say:</p>
<blockquote><p>How would we describe what it&#8217;s doing at the next level down in an API that we could expose?</p></blockquote>
<p>This is the reason low-level-only API proposals drive me <em>nuts</em>. New stuff in the platform tends to be driven by <em>scenarios</em>. You want to do a thing, that thing probably has some UI (probably browser provided), and might invoke something security sensitive. If you start designing at the lowest level, throwing a C++ API over the wall, you&#8217;ve turned off any opportunity or incentive to layer well. Just tell everyone to use the very fine JS API, after all. Why should anyone want more? (hint: graph above). Instead of opening doors, though, it&#8217;s mostly burden. Everything you have to do from script is expensive and slow and prone to all sorts of visual and accessibility problems by default. If the browser can provide common UI and interaction for the scenario, isn&#8217;t that better <em>most</em> of the time? Just imagine how much easier it would be to build an app if the initial cut at location information had been <code>&lt;input type="location"&gt;</code> instead of the <a href="http://dev.w3.org/geo/api/spec-source.html">Geolocation API we have now</a>. True, that input element would need lots of configuration flags and, eventually, a fine-grained API&#8230;if only there were a way to put an API onto an HTML element type&#8230;hrm&#8230;</p>
<p>In contrast, if we go declarative-only we get a lot of the web platform today. Fine at first but horrible to work with over time, prone to attracting API barnacles to fill perceived gaps, and never quite enough. The need for that API keeps coming back to haunt us. We&#8217;re gonna need both sides, markup and imperative, sooner or later. A framework for thinking about what that might look like seems in order. Our adventure in excavation with Web Components has largely been a success, not because we&#8217;re looking to &#8220;kernalize the browser&#8221; in JS &#8212; good or bad, that&#8217;s an idea with serious reality-hostile properties as soon as you add a network &#8212; but because when you force yourself to think about what&#8217;s <em>already</em> down there as an API designer, you start making connections, finding the bits that are latent in the platform and should be used to explain more of the high level things in terms of fewer, more powerful primitives at the next layer down. This isn&#8217;t a manifesto for writing the whole world in JS; it&#8217;s a reasonable and practical approach for how to succeed by starting high and working backwards from the 80% use-case to something that eventually has most of the flexibility and power that high-end users crave.</p>
<p>The concrete steps are:</p>
<ol>
<li>Introduce new platform capabilities with high-level, declarative forms. I.e., <em><b>invent new tags and attributes</b></em>. DOM gives you an API for free when you do it that way. Everyone&#8217;s a winner.
</li>
<li>When the thing you want feels like something that&#8217;s already &#8220;down there&#8221; somewhere, try to <em><b>explain</b></em> the bits that already exist in markup in terms of a lower-level JS or markup primitive. If you can&#8217;t do that or you think your new API has no connection to markup, go back to step 1 and start again.
</li>
<li>When it feels like you&#8217;re inventing new language primitives in DOM just to get around JS language limitations, <em><b>extend the language</b></em>, not the API
</li>
</ol>
<p>On the web, JavaScript <em>is</em> what&#8217;s down there. When it&#8217;s not, we&#8217;re doing it wrong. It has taken me a very long time to understand why the Java community puts such a high premium on the &#8220;pure java&#8221; label, and fundamentally what it says to others in the community is &#8220;I appealed to no gods and no magic in the construction of this, merely physics&#8221;. That&#8217;s a Good Thing (TM), and the sort of property that proper platforms should embody to the greatest extent possible.</p>
<p>And this brings me to my final point. C/C++ might be what&#8217;s &#8220;down there&#8221; for web browsers, but that&#8217;s also been true of Java. What separates the web and Java, however, is that the Java community sees their imperative abstraction that keeps them from having to think about memory correctness (the JVM) as an <em>asset</em> and many &#8220;web people&#8221; think of JS as pure liability. I argue that because of the &#8220;you&#8217;re gonna need both sides&#8221; dynamic, trying to write JS out of the picture is a dumb as it is doomed to fail. JavaScript <em>is</em> what&#8217;s &#8220;down there&#8221; for the web. The web has an imperative backbone and we&#8217;re never going to expose C/C++ ABI for it, which means JS is our imperative successor. The archaeological dig which is adding features like Web Components is providing more power to JS by the day and if we do this right and describe each bit as a layer with an API that the one above builds on, we can see pretty clearly how the logical regress of the &#8220;you must use JS to implement the whole browser&#8221; isn&#8217;t insane. JS itself is implemented as C/C++, so there&#8217;s always room for the mother tongue and of course many of the APIs that we interact with from JS must be C/C++; you can&#8217;t write it out of the story &#8212; but that doesn&#8217;t mean we need to design our APIs there or throw bad design decisions over the wall for someone else to clean up. It is high time we started designing low-level stuff for the web in idiomatic JS (not IDL), start describing the various plug-in points for what they are. We can provide power from our imperative abstraction <em>to</em> and <em>through</em> our declarative layer in ways that make both high and low-level users of the web platform more able to interoperate, build on each other&#8217;s work, and deliver better experiences at reasonable cost. That&#8217;s the difference between a minefield and a platform. Only one of them is reasonable to build on.</p>
<p>The trash truck just came by which means it&#8217;s 6AM here in almost-sunny London. WordPress is likewise telling me that I&#8217;m dangerously out of column-inches, so I guess I&#8217;ll see if I can&#8217;t get a last hour or two of sleep before the weekend is truly over. The arguments here may not be well presented, and they are subtle, but layering matters. We don&#8217;t have enough of it and when done well, it can be a powerful tool in ending the battle between imperative and declarative. I&#8217;ll make the case some other time for why custom element names are a good idea, but consider it in the layered context: if I could subclass <code>HTMLElement</code> from JavaScript in the natural way, why can&#8217;t I just put a new tag name in the map the parser is using to create instances of all the other element types? Aside from the agreement about the names, what makes the built-in elements so special, anyway?</p>
<p>Cognitive dissonance, ahoy! You&#8217;re welcome ;-)</p>
<p><b>Note:</b> this post has evolved in the several days since its initial posting, thanks largely to feedback from <a href="https://plus.google.com/112108146349792378878/posts">Annie Sullivan</a> and <a href="http://souders.org/">Steve Souders</a>. But it&#8217;s not their fault. I promise.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/04/bedrock/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Misdirection</title>
		<link>http://infrequently.org/2012/02/misdirection/</link>
		<comments>http://infrequently.org/2012/02/misdirection/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 23:04:26 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[chrome]]></category>
		<category><![CDATA[economics]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[licensing]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1724</guid>
		<description><![CDATA[As the over-heated CSS vendor prefix debate rages, I can&#8217;t help but note the mounting pile of logical fallacies and downright poor reasoning being deployed. Some context is in order. Your Moment Of Zen The backdrop to this debate is that CSS is absolutely the worst, least productive part of the web platform. Apps teams [...]]]></description>
				<content:encoded><![CDATA[<p>As the over-heated CSS vendor prefix debate rages, I can&#8217;t help but note the mounting pile of logical fallacies and downright poor reasoning being deployed. Some context is in order.</p>
<h3>Your Moment Of Zen</h3>
<p>The backdrop to this debate is that CSS is <em>absolutely</em> the worst, least productive part of the web platform. Apps teams at Google are fond of citing the meme that &#8220;CSS is good for documents, but not for apps&#8221;. I push back on this, noting the myriad ways in which CSS is <em>abysmal</em> for documents. That isn&#8217;t to minimize the pain it causes when building apps, it&#8217;s just that the common wisdom is that CSS surely must be <em>fantastic</em> for <em>somebody else</em>. Once we find that person, I&#8217;ll be sure to let you know. In the mean time we should contemplate how very, very far behind the web platform is in making it delightful to build the sorts of things that are work-a-day in native environments.</p>
<p>But it&#8217;s worse than simply being under-powered: CSS has the weakest escape hatches to imperative code and demands the most world-view contortion to understand its various layout modes and their interactions. Imagining a more congruent system isn&#8217;t hard &#8212; there are many in the literature, might I humbly suggest that now might be a good time to read <a href="http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.101.4819">Badros &#038; Borning</a>? &#8212; and even CSS could be repaired were we able to iterate quickly enough. Things have been moving faster lately, but fast enough to catch up with the yawning gap in platform capabilities? We&#8217;ll come back to the speed/scale of change later.</p>
<p>For now, consider that the debate (as <a href="http://folktrash.com/css-vendor-prefixes/">captured by Nate Vaughn</a>) is about the <em>retrospective</em> implications of the few things that have already gotten better for some set of developers in <em>some</em> situations. That this sort of meaningful progress (corners, gradients, animations, transitions, flexing boxes, etc.) is rare makes the debate all the more bone-chilling to me. We finally got a few of the long list of things we&#8217;ve been needing for a decade or more, and now because the future is unevenly distributed, we&#8217;re about to blow up the process that enabled even that modicum of progress? How is it we&#8217;re extrapolating causality about engine usage from this unevenness, anyhow? None of this is obvious to me. The credible possibility of losing prefixes as a way to launch-and-iterate is mind-exploding when you realize that the salient competition isn&#8217;t other browsers, it&#8217;s <em>other platforms</em>. Either the proponents of squatting other vendor&#8217;s prefixes haven&#8217;t thought this through very hard or they&#8217;re bad strategists on behalf of the web as a platform&#8230;not to mention their own products. The analysis that we&#8217;re being asked to accept rests on an entire series of poor arguments. Lets start with the&#8230;</p>
<h3>Uncomfortable Assumptions</h3>
<p>In an <a href="http://www.alistapart.com/articles/the-vendor-prefix-predicament-alas-eric-meyer-interviews-tantek-celik/">interview out yesterday with Eric Meyer</a>, <a href="http://tantek.com/">Tantek Çelik of Mozilla</a> tried to present this debate as a question of barriers to the adoption of non-WebKit based browsers, specifically <a href="http://www.mozilla.org/en-US/mobile/">Firefox Mobile</a>. Opera has made a similar case. What they ommit is that the only platforms where they can credibly ship such browsers are Android and S60 (a dead end). That&#8217;s <a href="http://en.wikipedia.org/wiki/File:World-Wide-Smartphone-Market-Share.png">a large (and growing) chunk</a> of the world&#8217;s handsets &#8212; good news for me, as I now work on Chrome for Android here in London &#8212; but for whatever reason it appears that <a href="http://marketshare.hitslink.com/browser-market-share.aspx?qprid=0&#038;qpcustomd=1">iOS users surf a whole lot more</a>.</p>
<p>Let that sink in: on the devices that are the source of most mobile web traffic today, it&#8217;s not <em>even possible</em> to install a browser based on a different engine, at least not without a proxy architecture like the one used in the excellent <a href="https://market.android.com/details?id=com.opera.mini.android&#038;hl=en">Opera Mini</a> or <a href="http://amazonsilk.wordpress.com/">Amazon&#8217;s Silk</a>. iOS and Windows Phone are both locked-down platforms that come with only one choice of engine (if not browser shell). When folks from the vendors who want to appropriate others&#8217; prefixes talk about &#8220;not being able to compete&#8221;, remember that competition <em>isn&#8217;t even an option</em> for the most active users of mobile browsers. And it&#8217;s prefixes that are keeping us down? We must go deeper.</p>
<p>The tension comes into focus when we talk in terms of <b>conversion</b>, <b>retention</b>, and <b>attrition</b>. Conversions are users who, if able, <em>switch</em> to a new product from an old one. Retention is a measure of how many of those users <em>continue to use</em> the product after some period of time. Today (and since Windows first included a browser), the <em>single largest factor</em> in the conversion of users to new browsers is <em>distribution with an OS</em>. This is the entire rationale behind the <a href="http://arstechnica.com/microsoft/news/2010/02/microsofts-eu-browser-ballot-approved-arrives-march-1.ars">EU&#8217;s browser choice UI, mandated on first start of new Windows installs</a>. Attrition is the rate at which users stop choosing to use your product day after day, and for most desktop installed software, attrition is <em>shockingly</em> high after 3 to 6 months. The attrition rate is usually measured by cohorts over time; users who installed on the same day/week/month to measure what % of that group continue to use the product over increasingly long periods of time. The rate of decay falls, but the overall attrition invariably continues to rise. You might not get un-installed, but that doesn&#8217;t mean you&#8217;ll still be the go-to icon on the user&#8217;s home screen or desktop. Eventually every device is recycled, wiped, or left for history in a drafty warehouse and along with it, your software. A key factor in getting attrition under control for Chrome has been evangelism to improve site compatibility, e.g. &#8220;I&#8217;m not using your browser because my bank website doesn&#8217;t work with it&#8221;. That argument &#8212; that site compatibility is key to ensuring a competitive landscape for what otherwise are substitutes &#8212; puts the entire thing in some perspective. Attrition isn&#8217;t the same thing as conversion, and conversion is driven primarily by integrations and advertising. Implicit in the arguments by Tantek and others is a sub-argument of the form:</p>
<blockquote><p>Our product would have measurably more users if sites were more compatible.</p></blockquote>
<p>Thanks to what we know about what drives conversions, in the short run this is simply false. Long term, what invariably gives you more users is <em>starting with more users</em>. The set of things that are most effective at convincing users to swap browsers, even for a day, include: advertising, word-of-mouth, a superior product, distribution/bundling, and developer advocacy. Depressingly, only one of those involves <em>actually being a better product</em>, and the prerequisite for all of them is the ability to switch (thanks, Android team!). There&#8217;s a similar dynamic at work when doing advocacy to web developers: if you&#8217;re nowhere in their browser stats, they&#8217;re adding support for a standard or worse a second prefix in order to do service to a cause, not because it&#8217;s <em>measurably good for them</em>. Clearly, that&#8217;s going to be somewhat less effective. Where, then, is the multi-million dollar advertising campaign for Fennec? The carrier and OEM rev-share deals for bundling on new Android phones? Hmm. To hear Tantek et. al. tell it, non-WebKit-based browsers would be prevalent on mobile if only it weren&#8217;t for those damned browser prefixes causing users of other browsers to receive different experiences! Also, those kids and that damned dog.</p>
<p>Over the long haul compatibility can have a dramatic effect on the rate of attrition by changing the slope of the curve &#8212; which, remember, is a rate with decay and not a single % &#8212; but it begs the next uncomfortable question: what do we mean by &#8220;compatibility&#8221; here? What sorts of incompatibility <em>cause</em> attrition? Is it content that looks <em>slightly worse</em> but still essentially works (think grey PNG backgrounds on IE6) or does it simply turn you away, not allow you to play in any way, and generally fails (think the ActiveX dependencies of yore)?</p>
<h3>Inaccessible or Ugly?</h3>
<p>Eric was good enough to call out what I view as a key point in this debate: what sort of &#8220;broken&#8221; are we talking about? Tantek responded with a link to side-by-side screenshots of various properties rendered on <a href="http://people.mozilla.com/~atrain/mobile/Evangelism/chrome-compare/chrome-compare.html">Chrome for Android&#8217;s Beta and current Fennec</a>. In some of these cases we may be looking at Fennec bugs. <a href="http://wordpress.com">WordPress.com</a> serves the same content to Fennec which seems to bork what <code>float: left;</code> means. That, or some media query is preventing the main blocks from being floated; it&#8217;s hard to tell which from a quick <code>view-source:</code>. For the versions of google.* included in the list, the front end is simply serving the desktop version to Fennec which makes the wonky button rendering even stranger. Is there room to improve what gets sent to Fennec? You bet, but that&#8217;s not what&#8217;s being argued in the main. Ask yourself this: is what you see on that page worth destroying the prefix system for? &#8216;Cause that&#8217;s what the advocates of prefix-squatting would have you believe. In effect, they&#8217;re suggesting that <em>nothing</em> will cause developers to test on non-pervasive engines, a deeply fascinating assertion. Even if we accept it, it doesn&#8217;t point clearly to a single tactic to resolve the tension. It certainly doesn&#8217;t argue most strongly for prefix-squatting.</p>
<p>An important point Eric failed to follow up on was Tantek&#8217;s assertion that Mozilla will be cloaking user-agent strings. Does he imagine that the only thing that might be cause someone to send different content is CSS support? API support for things like touch events differs, the performance characteristics of device classes and browsers vary wildly, and application developers are keen to deliver known-good, focused experiences. The <a href="http://code.google.com/mobile/articles/webapp_fixed_ui.html">endless saga of <code>position: fixed;</code> as plumbed by Google teams</a> and others is a story of competing constraints: browser vendors optimize for content, content fights back. Repeat. What does Mozilla imagine is going to happen here? Maintained content will react to the browser usage of end-users (and as we&#8217;ve covered, compat != conversions). Unmaintained content, well, that&#8217;s what fallback is all about. And bad things deserve to lose. Assuming that your browser is 100% compatible with developer expectations and testing if you only switch the UA and implement a few prefixes is NPAPI-level crazy all over again, and it&#8217;s entirely avoidable. Tantek and Brendan, of all people, should be able to reason that far. I guess they&#8217;ll find out soon enough &#8212; although we will have all been made poorer for it.</p>
<p>Now, what about the related argument that Mozilla &#038; Co. are only going to be doing this for properties which are &#8220;stable&#8221; (nevermind their actual <a href="http://www.w3.org/Style/CSS/current-work">standardization status</a>)? The argument says that because something hasn&#8217;t changed in another vendor&#8217;s prefixed version in a while, it must be safe to squat on. Not only is this (again) incredibly short-sighted, it says that instead of forcing a standard over the line and clobbering both developers and other vendors with the dreaded label of &#8220;proprietary&#8221; (the usual and effective tactic in this situation), they&#8217;re instead willing to <em>claim ownership and therefore blame</em> for the spread of this soon-to-be-proprietary stuff, all the while punting on having an independent opinion about how the features should be structured and giving up on the standards process&#8230;and all for what?</p>
<h3>Product vs. Platform</h3>
<p>Perhaps there wasn&#8217;t space in Tantek&#8217;s interview with Eric, but both of them chose not to be introspective about the causes of WebKits use in so many mobile browsers, with Tantek merely flagging the use of a single engine by multiple products as &#8220;a warning sign.&#8221; But a warning of what, exactly? Eric didn&#8217;t challenge him on this point, but I sorely wish he had. Why did Safari, the Android Browser, Chrome, Silk, Black Berry, and many others all pick WebKit as the basis for their mobile browsers?</p>
<p>WebKit <em>isn&#8217;t a browser</em>. It&#8217;s just not. To make a browser <em>based</em> on WebKit, one might bring along <em>at least</em> the following bits of infrastructure which WebKit treats as bits to be plugged in:</p>
<ul>
<li>Networking</li>
<li>Caches of some sort</li>
<li>Graphics rendering</li>
<li>A build system</li>
<li>POSIX or other platform plumbing</li>
</ul>
<p>And that&#8217;s a <em>minimum</em>. Competitive ports tend to include WebSQL, LocalStorage, and Indexed DB back-ends, video codecs, 3D infrastructure (deeply non-trivial), perhaps an alternative JavaScript engine (V8 or other), and alternative/additional image decoders (e.g., <a href="http://code.google.com/speed/webp/">WebP</a>). All of that is in addition to needing to create your own UI for bookmarking, navigation, etc. WebKit is an <em>engine</em>, not a fully-functioning vehicle. Therein may lay some of the difference in the relative success of the WebKit and Gecko on mobile to date. Want to build a Gecko-based browser? Great, first clone <a href="https://wiki.mozilla.org/Mobile/Build/Fennec#Install_build_dependencies_.28non-Maemo.29">the <em>entire Firefox codebase</em> from Mercurial</a>, then layer your stuff on top/around. Oh, wait, things might not cleanly be factored to allow you to plug in your own X, Y, or Z? Your builds take forever? Welcome to life in the Mozilla universe where your product is always second fiddle to Firefox. Now, that&#8217;s not by way of criticism, mind you. <em>It is entirely reasonable</em> for a product like Firefox not to pay coordination costs with other vendors/users of their code. God knows the overhead over here in WebKit land of trying to keep the menagerie of ports building against all changes is downright daunting. Mozilla (the organization) has made choices that prioritized the success of their <em>product</em> (Firefox) over their <em>codebase</em> (Gecko). WebKit was structured as platform only (no product), both forcing enormous costs onto every port while also freeing them from swimming upstream against a single product&#8217;s imperatives in the codebase.</p>
<p>What we&#8217;re witnessing isn&#8217;t open vs. closed, it&#8217;s differences in initial cost of adoption. In JS terms, it&#8217;s jQuery (focused core, plugins for everything else) vs. Sencha or Dojo (kitchen sink). Entirely different target users, and both will find their place. Nobody should be shocked to see smaller, more focused bits of code with good plugin characteristics spreading as the basis for new projects. The Mozilla Foundation wants to help prevent monoculture? In addition to making the Firefox product a success, there are concrete engineering things they can do to make Gecko more attractive to the next embedder, Firefox-branded or not. I haven&#8217;t heard of progress or prioritization along those lines, but I&#8217;m out of the loop. Perhaps such an effort is underway, if so, I applaud it. Whatever the future for Gecko, Product success isn&#8217;t related to platform success as a first approximation. Having a good, portable, pluggable core increases the odds of success in evolutionary terms, but it&#8217;s absolutely not determinant; see MSIE.</p>
<p>Speaking of IE&#8230;I respect those guys a lot, but the logical leap they&#8217;re asking us to swallow is that <em>the reason people return Windows Mobile phones is that some CSS doesn&#8217;t work</em>. That&#8217;s what attrition means on a platform where they&#8217;re the only native runtime. Data would change my mind, but it&#8217;s a hell of a lot to accept without proof.</p>
<h3>The Time Component</h3>
<p>Lets take a step back and consider Tantek&#8217;s claim that Mozilla has gotten very little traction in evangelizing multi-prefix or prefix-free development for the past year: Firefox for Android has been available since Oct. 2010 and stable for just 6 months. Opera Mobile on Android has been stable for just over a year. IE 9 (the only IE for mobile you could ever seriously consider not serving fallback experiences to) only appeared with Windows Phone 7.5 (aka &#8220;Mango&#8221;), shipped to users an <em>entire</em> 6 months ago.</p>
<p>And we expect webdevs to have updated all their (maintained) content? Never mind the tenuous correlation between the sorts of soft incompatibilities we&#8217;re seeing at the hands of CSS and user attrition; the argument that even this lesser form of harm hasn&#8217;t been blunted by evangelism appears suspect. Taking the incompatibilities seriously, I can quickly think of several other measures which are preferable to destroying the positive incentives towards standardization the prefix system creates (from least to most drastic):</p>
<ul>
<li>Continued evangelism to web developers with particular focus on major sites</li>
<li>Political pressure on browser vendors to start dropping prefixes (i.e., we&#8217;d all be <em>equally</em> disadvantaged until users pick up the standard version)</li>
<li>UA spoofing <em>without</em> prefix squatting</li>
<li>Blacklists to trigger alternative identity (UA/prefixes) on a subset of sites</li>
</ul>
<p>All of these are less blow-up-the-world than what MSFT, Mozilla, and Opera are proposing. It&#8217;s not even an exhaustive list. I&#8217;m sure you can think of more. Why these have either been not considered or dismissed remains a mystery.</p>
<h3>It&#8217;s More Complicated Than That</h3>
<p>In all of this, we&#8217;re faced with an existential question: what right do web developers have to shoot themselves in the foot? Is there a limit to that right? What sort of damage do we allow when some aspect of the system fails or falls out of kilter for some period of time? It&#8217;s a question with interesting parallels in other walks of life (for a flavor, substitute &#8220;web developers&#8221; with &#8220;banks&#8221;).</p>
<p>Can we show active harm to other browsers from the use of prefixes? The data is at best unclear. Arguing that any harm rises to a level that would justifies destroying the prefixes system entirely is rash. I argued many of the reasons for this in my <a href="http://infrequently.org/2011/11/vendor-prefixes-are-a-rousing-success/">last post</a>, but lets assume in our mental model that developers respond to incentives in <em>some</em> measure. If, concurrently with achieving as-yet un-managed distribution, Mozilla et. al. implement others&#8217; prefixes, what should we expect developers to do in response? After all, they will have reduced whatever tension might have been created by content that &#8220;looked wonky&#8221; and, where standards exist, will have reduced the incentive to switch to the standard version.</p>
<p>Now lets play the model one more turn of the wheel forward too: assume that Chrome or Safari (or both!) act in good faith and contemplate removing the <code>-webkit-*</code> prefix support for standardized features at a quick clip&#8230;and Mozilla doesn&#8217;t. You see how this quickly leads to a Mexican standoff: web developers won&#8217;t stop using prefixed versions because those are the way you get 100% support (thanks to Mozilla&#8217;s support for them); vendors won&#8217;t un-prefix things because <em>others</em> who squat their prefixes will then have a compatibility advantage; and nobody will be keen to add new things behind prefixes because they can no longer be assumed to be experiments that can change. Lose, lose, lose.</p>
<p>Some on the other side of the debate are keen to cite game theory as a support for their course of action, but the only conclusion I can draw is that their analysis must be predicated on a set of user and developer motivations that are entirely unlike the observable world we inhabit.</p>
<h3>A Call To Reason, Not Arms</h3>
<p>Based on a better understanding of the landscape, what should the various parties do to make the world better for themselves now and in the long run and for the web as a platform?</p>
<ul>
<li><b>Web Devs</b>: first, do no harm; test in multiple runtimes, pointedly including a &#8220;fallback&#8221;. Then enhance with prefixes. Do not apologize for giving some (or even many) of your users a better experience. That, after all, is your <em>job</em>. But know this: prefixed properties are not supported, <em>will</em> go away, and when something you didn&#8217;t test the fallback for falls over, it&#8217;s <em>your</em> fault.</li>
<li><b>Browser Vendors</b>: invest in advocacy and distribution enhancing moves for your product before threatening to blow up effective standards policies. If you&#8217;re going to implement a prefixed version, please have a different opinion or push to ram a standard through to Recommendation ASAP. Incompatible right-hand-sides help developers understand that things are still evolving. <em>DO NOT</em> squat on prefixes. It&#8217;s both relative ineffective and will make developer&#8217;s lives harder when they want to <em>legitimately</em> move to standard or support your prefixes.</li>
<li><b>Vendor CSS WG Reps</b>: get it through your heads, you&#8217;re <em>behind</em>. It&#8217;s not quaint and it&#8217;s not excusable. The platform needs more powerful CSS features, and stat. It&#8217;s long past time to start stealing good ideas from the pre-processors. Appeals to a lack of manpower to implement must never block others and shouldn&#8217;t block standardization, so please stop making them. If you care about the platform&#8217;s success, let those who are able and willing to take risks do so.</li>
<li><b>The CSS WG (as a whole)</b>: get the lead out. It&#8217;s not exclusively the W3C&#8217;s fault that things are slow, but the current MTTR (Mean Time To Recommendation) is still glacial. It is unreasonable to expect vendors to drop prefix support immediately upon standardization, but the W3C has a role here to advocate for quick sunsetting. Daniel Glazman is, as ever, right on most of this, but more can be done to streamline the process post CR.</li>
<li><b>The WebKit Project</b>: Add build flags to allow WebKit-based products to enable/disable vendor prefix support independently.</li>
<li><b>Chrome/Safari/Other-prefix-supporting-browsers</b>: Sunset prefixes as soon as is practicable post-standardization. Similarly, don&#8217;t ship prefixed features you&#8217;re not willing to be on the hook for via your reps to the CSS WG. Disabling them may be painful, but it&#8217;s the only good-faith thing to do.</li>
</ul>
<h3>Endnotes</h3>
<p>I&#8217;ve left a lot out of this post, but it&#8217;s too long already. I do truly hope it&#8217;s the last I write on prefixes because, as I said up front, we have <em>much</em> bigger fish to fry. Stat. Prefixes <em>do</em> work, they&#8217;re essential to delivering a future platform that can compete, and yes, they should be torn down at the same pace they&#8217;re erected.</p>
<p>A few things that folks have asked about as tangents to this debate:</p>
<ul>
<li>It&#8217;s never a good thing for there to be homogeneity in the experimentation phase. The <em>explicit goal</em> of the prefixes system is to enable diversity of early opinion and fast coalescing around the best answer, thereby enabling the writing of a standard which is likely to need less revising and iteration. Diversity provides some value, the market tests the alternatives, and we deliver the most value we can over time through the <em>standard</em> version. It has always been thus, but prefixes make it less risky&#8230;assuming we don&#8217;t start stepping on everyone else&#8217;s toes.</li>
<li>If the reasoning behind prefixes is to set up and tear down large-scale experiments, iterate, and collect feedback then Lea&#8217;s <a href="http://leaverou.github.com/prefixfree/">-prefix-free</a> approach and PPK&#8217;s <a href="http://www.quirksmode.org/blog/archives/2012/02/alpha_and_beta.html"><code>-alpha-*</code>/<code>-beta-*</code></a> proposals are equally counter-productive and should be avoided at all costs. Making prefixes less painful to use reduces the natural incentives for migrating to a standard while blindly assuming the same right-hand for a future standard version as we have for <em>some</em> prefixed versions is plainly idiotic. What were they thinking?</li>
<li><code><a href="http://felipe.wordpress.com/2012/02/02/a-proposal-to-drop-browser-vendor-prefixes/">@-vendor-unlock</a></code> is only slightly smarter, but in every possible way inferior to <a href="http://lists.w3.org/Archives/Public/www-style/2011Mar/0478.html">CSS Mixins</a>. Would that the WG spent as much time on Mixins as they have on this prefix kerfuffle.</li>
<li>Yes, I was in Paris when the CSS WG F2F was happening. No, I wasn&#8217;t at the meetings. Duty (Chrome for Android) called.</li>
<li>If you&#8217;ve read this far, congrats. You may be the only one. I&#8217;ve been assured by CSS WG delegates that nobody cares what I think, which statistically seems to just be rounding down by a tiny bit. Fair enough.</li>
</ul>
<p><em><b>Update</b>: <a href="http://infrequently.org/2012/02/misdirection/comment-page-1/#comment-239566">Michael Mullany of Sencha adds epicly good, epicly long context about what causes developers to target UAs and what the incentives that&#8217;ll change their minds about supporting a given browser really are.</a></em></p>
<p><em>Thanks to <a href="http://fberriman.com/">Frances Berriman</a>, <a href="http://jakearchibald.com/">Jake Archibald</a>, <a href="http://gent.ilcore.com/">Tony Gentilcore</a>, and <a href="http://www.xanthir.com/blog/">Tab Atkins</a> for reviewing earlier versions of this post. Errors of fact and form are all mine, however. Updated occasionally for clarity and to remove typos.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2012/02/misdirection/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Vendor Prefixes Are A Rousing Success</title>
		<link>http://infrequently.org/2011/11/vendor-prefixes-are-a-rousing-success/</link>
		<comments>http://infrequently.org/2011/11/vendor-prefixes-are-a-rousing-success/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 14:36:27 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1715</guid>
		<description><![CDATA[tl;dr version: Henri Sivonen&#8217;s arguments against vendor prefixing for CSS properties focus on harm without considering value, which in turn has caused him to come to a non-sensical set of conclusions and recommendations. Progress is a process, and vendor prefixes have been critical in accelerating that process for CSS. For a while now I&#8217;ve been [...]]]></description>
				<content:encoded><![CDATA[<p><em>tl;dr version: Henri Sivonen&#8217;s arguments against vendor prefixing for CSS properties focus on harm without considering value, which in turn has caused him to come to a non-sensical set of conclusions and recommendations. Progress is a process, and vendor prefixes have been critical in accelerating that process for CSS.</em></p>
<p>For a while now I&#8217;ve been hearing the meme resurface from CSS standards folks and a few implementers that &#8220;vendor prefixes have failed&#8221;. I&#8217;d assumed this was either a (bad) joke or that it was one of those things that web developers would scoff at loudly enough to turn the meme recessive. I was wrong.</p>
<p>Henri Sivonen, Mozilla hacker extrordinare, <a href="http://hsivonen.iki.fi/vendor-prefixes/">has made the case directly and at length</a>. Daniel Glazman, co-chair of the CSS WG posted a <a href="http://www.glazman.org/weblog/dotclear/index.php?post/2011/11/16/CSS-vendor-prefixes-an-answer-to-Henri-Sivonen">point-by-point response.</a> If you have the patience, you should read both.</p>
<p>Lost in the debate between &#8220;browser people&#8221; and &#8220;spec people&#8221; is the the essential nature of what has happened with prefixes: they <em>worked</em>. From the perspective of a web developer, any first approximation of the history of vendor prefixes are <em>pure win</em>, even if only a fraction of the value that has been delivered behind them is attributable to prefixes un-blocking vendors from taking risks and shipping early.</p>
<p>Daniel&#8217;s rebuttal to Henri gets a lot of things right, but he gives in on an essential point; by agreeing with Henri that vendor prefixes are &#8220;hurting web authors&#8221; he wites off the benefits that they&#8217;ve delivered &#8212; namely the ability of vendors to get things out to devs in a provisional way that has good fallback and future-proofing properties and the ability for devs to build with/for the future in an opt-in, degradable way.</p>
<p>Rounded corners, gradients, animations, flex box, etc. are all design and experience enablers that developers have been able to take advantage of while waiting for the standards dust to settle, and thanks to W3C process, it takes a LONG time to to settle. Yes, that has some costs associated with it. Henri is very worried that browsers that aren&#8217;t keeping up quickly will be &#8220;left behind&#8221; by webdevs who use only one vendor&#8217;s prefix. But surely that&#8217;s a lesser harm than not getting new features and not having the ability to iterate. And it provides incentive for following browsers to try to make a standard happen. What&#8217;s not to love? More to the point, I just don&#8217;t believe that this is a serious problem in practice. What front-ender in 2011 doesn&#8217;t test on <em>at least</em> two browsers? Yes, yes, i&#8217;m sure such a retrograde creature exists, but they were going to be making non-portable content <em>regardless of prefixes</em>. Assuming you&#8217;re testing fallback <em>at all</em> (e.g., by testing on more than one browser), prefixes not appearing on some browser are just the fallback case. CSS FTW! Webdevs who don&#8217;t test on more than one browser&#8230;well, they&#8217;re the ones hanging the noose around the neck of their own apps. Vendor prefixes no more enable this stupidity than the existence of the <code>User-Agent</code> header. Compatibility is a joint responsibility and the best each side (browser, webdev) can hope of the other is some respect and some competence. Cherry picking egregious examples and claiming &#8220;it&#8217;s hurting the web&#8221; seems, at a minimum, premature.</p>
<p>And how did we think we&#8217;d get a good standard, anyway? By sitting in a room in a conference center more often and thinking about it harder? Waiting on a handfull of early adopters to try something out in a tech demo and never stress it in practice? That&#8217;s not a market test (see: XHTML2), it doesn&#8217;t expose developers to the opportunities and tradeoffs that come with a new feature, and doesn&#8217;t do anything to address the inevitable need to integrate feedback at <em>some</em> point.</p>
<p>Yes, we could go with Henri&#8217;s suggestion that the first person to ship wins by default, never iterate on any designs, and avoid any/all first-mover disadvantage situations, but who among the browser vendors is perfect? And what would the predictable consequences be? I can only assume that Henri thinks that we&#8217;ll end up in a situation where vendors coordinate with the CSS WG early to add new stuff, will design things more-or-less in the open, and will only ship features to stable (no flag) when they&#8217;re sure of their design. That could happen at the limit, but I doubt it. Instead, the already fraught process of adding new features to the platform will be attempted by even fewer engineers. Who wants the responsibility for having to be perfect lest you screw the web over entirely? Fuck that noise, I&#8217;m gonna go work on a new database back-end or tune something to go faster. Browsers are made by smart people who have a choice of things to be working on, and any time you see a new platform feature, it probably came about as the result of an engineer taking a risk. Many times the engineers in a position to take those risks don&#8217;t have a great sense for what good, idiomatic web platform features might be designed, so they&#8217;ll need to tweak/iterate based on feedback. And feedback is painfully hard to extract from webdevs unless you&#8217;ve made something available in a tangible way such that they can use it and discover the limitations.  Shipping things only to dev is perhaps a good idea for other aspects of the platform where we can&#8217;t count on CSS&#8217;s forgiving parsing behavior (the basis for prefixes). Syntax changes for JS and CSS seem like good examples. But for features that are primarily new CSS properties? Oy. Making the stakes even higher, reducing the ability to get feedback and iterate isn&#8217;t going to lead to a harmonious world of good, fast standards creation. It&#8217;s going to predictably reduce the amount of new awesome that shows up in the platform.</p>
<p>Prefixes are an enabler in allowing the <em>necessary</em> process of use, iteration, and consensus building to take place. Want fewer messes? There&#8217;s an easy way to achieve that: try less stuff, add fewer features, and make each one more risky to add. That&#8217;s Henri&#8217;s prescription, wether or not he knows it, and the predictable result is a lower rate of progress &#8212; advocating this sort of thing is <em>much</em> worse for the web and for developers than any of the harm that either Henri or Daniel perceive.</p>
<p>Which brings me to Henri&#8217;s undifferentiated view of harm. His post doesn&#8217;t acknowledge the good being done by prefixed implementations &#8212; I get the sense he doesn&#8217;t build apps with this stuff or it&#8217;d be obvious how valuable prefixed implementations are for work-a-day web app building &#8212; instead focusing on how various aspects of the process of prefixed competition can be negative. So what? Everything worth having costs <em>something</em>. Saying that things &#8220;hurt the web&#8221; or &#8220;hurt web developers&#8221; without talking in terms of <em>relative harm</em> is just throwing up a rhetorical smoke screen to hide behind. If you focus only on the costs but write the benefits out of the story of <em>course</em> the conclusion will be negative. In many cases, the costs that Henri points out are <em>correctly aligned</em> with getting to a better world: having to type things out many times sucks, creating demand among webdevs for there to be a single, standardized winner. Having multiple implementations in your engine sucks, creating demand from vendors to settle the question and get the standards-based solution out to users quickly. Those are good incentives, driven by prices that are low but add up over time in ways that encourage a good outcome:  a single standard implemented widely.</p>
<p>And as Sylvain Galineau pointed out, what looks like pure cost to one party might be huge value to another. I think there&#8217;s a lot of that going on here, and we shouldn&#8217;t let it go un-contextualized. The things that Henri sees as down-sides are the predictable, relatively minor, costs inherent in a process that allows us to make progress faster and distribute the benefits quickly, all while <em>minimizing</em> the harm. That he&#8217;s not paying the price for not having features available to build with doesn&#8217;t mean those opportunity costs aren&#8217;t real and aren&#8217;t being borne by webdevs every day. Being able to kill table and image based hacks for rounded corners is providing HUGE value, well ahead of the spec. Same for gradients, transitions, and all the rest. Calling prefixed implementations in the wild a bad thing needs to argue that the harm is greater than all of that value. I don&#8217;t think Henri could make that case, nor has he tried.</p>
<p>I think the thing that most shocks me about Henri&#8217;s point of view is that he&#8217;s arguing against a process when in fact the motivating examples (transforms, gradients) have been sub-optimal in <em>exactly</em> the better-than-before ways we might have hoped for! Gradients, for example, saw a lot of changes and browsers had different ideas about what the syntax should be. Yes, it&#8217;s harder to get a consistent result when you&#8217;re trying to triangulate multiple competing syntaxes, but we got to <em>use</em> this stuff, get our hands dirty, and get most of the benefits of the feature while the dust settled. Huzzah! This is <em>exactly</em>> the way a functioning market figures out what&#8217;s good! Prefixes help developers understand that stuff can and will change, and they clear the way for competition of ideas without burdening the eventual feature&#8217;s users with legacy bagage tied to a single identifier.</p>
<p>So what about the argument that there might be content that doesn&#8217;t (quickly?) adopt the non-prefixed version, or that vendors can&#8217;t remove their prefixed implementations because content depends on it?</p>
<p>To the first, I say: show me a world where 90+% of users have browsers support the standard feature and I&#8217;ll show you a world in which nobody (functionally) continues to include prefixes. That process is gated in part by the WG&#8217;s ability to agree to a spec, and here I think there&#8217;s real opportunity for the CSS WG to go faster. The glacial pace of CSS WG in getting things to a final, ratified spec is in part due to amazingly drawn-out W3C process, and in part a cultural decision on the part of the WG members to go slow. My view is that they should be questioning both of these and working to change them, not blaming prefixes for whatever messes are created in the interim.</p>
<p>As for removing prefixes, this is about vendors just doing it, and quickly. But the definition of &#8220;quickly&#8221; matters here. My view is that vendors should be given <em>at least</em> as long as it took to get a standard finalized from the introduction of their prefixed version for the removal process to be complete. So if Opera adds an amazing feature behind a <code>-o-</code> prefix in early 2012 and the standard is finalized in 2014, the deprecation and eventual removal should be expected to take 2 years (2016). This has the nice symmetry of incentives that punish the WG for going slow (want to kill prefix impls? get the standard done) while allowing the vendors who took the biggest risks to provide the softest landings for their users. And it doesn&#8217;t require that we simply go all-in on the first person&#8217;s design to ship. Yes, there will be mounting pressure to get <em>something</em> done, but that&#8217;s good too!</p>
<p>The standards process needs to lag implementations, which means that we need spaces for implementations to lead in. CSS vendor prefixes are one of the few shining examples of this working in practice. It&#8217;s short-term thinking in the extreme to either flag the costs associated with them as either justifying their removal or even suggesting that the costs are too high.</p>
<p>And webdevs, always be skeptical when someone working on an implementation or a spec tells you that something is &#8220;hurting the web&#8221; when your experience tells you otherwise. The process of progress needs more ways to effectively gauge webdev interest, collect feedback, and test ideas. Not fewer or narrower channels.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2011/11/vendor-prefixes-are-a-rousing-success/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<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"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">new</span> HTMLDivElement<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></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"><table><tr><td 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></td></tr></table></div>

<p>to this:</p>

<div class="wp_syntax"><table><tr><td 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></td></tr></table></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>Google &amp; the Future of JavaScript</title>
		<link>http://infrequently.org/2011/09/google-the-future-of-javascript/</link>
		<comments>http://infrequently.org/2011/09/google-the-future-of-javascript/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 00:36:54 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[openweb]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1657</guid>
		<description><![CDATA[Simply stated, Google is absolutely committed to making JavaScript better, and we're pushing hard to make it happen.]]></description>
				<content:encoded><![CDATA[<p>There&#8217;s very little public information yet about Dart (nee, Dash), and as I&#8217;m not on Lars&#8217; team I can&#8217;t comment about it. More details will be forthcoming at the <a href="http://gotocon.com/aarhus-2011/presentation/Opening%20Keynote:%20Dart,%20a%20new%20programming%20language%20for%20structured%20web%20programming">GOTO session next month</a>. I&#8217;ll also be at GOTO, <a href="http://gotocon.com/aarhus-2011/presentation/Send%20Less,%20Do%20More,%20Go%20Faster:%20The%20Future%20of%20Front%20End%20Development">speaking on JavaScript and the state of the web platform</a>.</p>
<p>Making the rounds is an accidentally leaked early draft of notes from a meeting last year that discusses both Dart and JavaScript. I work on many web platform-related things at Google, including serving as a representative to TC39, the body that standardizes the JavaScript language. I wasn&#8217;t at the meetings having previously committed to <a href="http://2010.full-frontal.org/">presenting at FFJS</a>, but my views were represented by others and my name is on the document. As I said, though, it was a draft and doesn&#8217;t reflect either the reality of what has happened in the meantime or even the decisions that were taken as a result. And it certainly doesn’t reflect my personal views.</p>
<p>So what&#8217;s the deal with Google and JavaScript?</p>
<p>Simply stated, Google is absolutely committed to making JavaScript better, and we&#8217;re pushing hard to make it happen.</p>
<p>Erik Arvidsson, Mark Miller, Waldemar Horwat, Andreas Rossberg, Nebojša Ćirić, Mark Davis, Jungshik Shin and I attend TC39 meetings, work on implementations, and try to push JS forward in good faith. And boy, does it need a push.</p>
<p>Erik and I have specifically been working to focus the TC39 agenda away from syntax-free, semantics-only APIs (Object.defineProperty, anyone?) which might be good for tools, compilers, and frameworks but which are hard for day-to-day use.</p>
<p>Through <a href="http://code.google.com/p/traceur-compiler/">Traceur</a> and other efforts we&#8217;ve been socializing the idea that the one thing the committee can exclusively do &#8212; and should do more of &#8212; is to carve out syntax for commonly exercised semantics. Seemingly small things like the <a href="http://wiki.ecmascript.org/doku.php?id=harmony:classes"><code>class</code> keyword as sugar</a> for the constructor function pattern, or a <a href="http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax&#038;s=short+function">shorter syntax for functions</a> are big improvements, if only because it&#8217;s TC39 that&#8217;s making them. Syntax can end battles over common patterns and help you say what you mean, and JS is overdue for some of this. Larger but more subtle things, like agreement to use pragmas as a way to enable the process of progress in a compatible web, are even more exciting to me. Even proposals that haven&#8217;t made it through like <a href="http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions">Scoped Object Extensions</a> and <a href="http://wiki.ecmascript.org/doku.php?id=strawman:deferred_functions">deferred functions</a> have been fought for by us because we desperately want JavaScript to get better. We&#8217;re big fans of much of the work coming out of Mozilla for the same reason &#8212; in particular Dave Hermann&#8217;s excellent <a href="http://wiki.ecmascript.org/doku.php?id=harmony:modules">modules proposal</a>. Together, these are going to do much to help give modern JS some &#8220;backbone&#8221; in the near term. I’m proud of what we’ve accomplished in TC39 over the last year, and while I hoped for more, the result is an ES.next that looks like it’ll embody many of the things I feel are currently missing. The day-to-day practice of writing JS is going to change dramatically for the better when ES.next arrives.</p>
<p>But it&#8217;s not the end &#8212; not by a long shot. Classes will give us a humane, interoperable inheritance syntax, but it leaves composition unaddressed by syntax. I&#8217;m hopeful that we bless traits in future versions, removing the use of inheritance in most cases. Similarly, I think we can find a way to repair &#8220;this&#8221; binding foot-guns with softly-bound &#8220;this&#8221;. Repairing the shared-prototypes issue, either through DOM or through something like Scoped Object Extensions, can and should be done. And once we have all of this, the stage will be set for a flexible, advanced type system that does not need to be all-or nothing and does not need to be hobbled by the ghost of C++/Java&#8217;s inflexible nominal-only types. That&#8217;s the dream, and we&#8217;re not shying away from it.</p>
<p>It&#8217;s hard to square this sort of wild enthusiasm for &#8220;raw&#8221; JavaScript with what&#8217;s in the leaked memo, and I can only beg for some amount of understanding. As committed and enthusiastic as I am about the prospects for JavaScript, others are just as enthused about Dart. Google is big, can do many things at once, and often isn&#8217;t of one mind. What we do agree on is that we&#8217;re trying to make things better the best we know how. Anyone who watches Google long enough should anticipate that we often have different ideas about what that means. For my part, then, consider me and my team to be committed JS partisans for as long as we think we can make a difference.</p>
<h3>Reality Check</h3>
<p>There are risks, of course. TC39 is long on seasoned language design skill and short on webdev experience, meaning that many things that Erik and I may take for granted as pressing problems need to be explained, sometimes to an incredulous audience. The flip side risk is that naïve solutions may have better alternatives that seasoned language hands can quickly spot and that simple answers have non-obvious risks or preclude movement in other important areas later. It&#8217;s good, then, that the committee is working well and is taking appeals to developer productivity seriously.</p>
<p>Whatever you might think about programming languages for the browser, let me assure you of one thing: your problem isn&#8217;t the language. Not really, anyway. We&#8217;ve made good progress in the last year repairing some of the seams between JS and DOM, and Cameron McCormack has helped us drive a new version of WebIDL that correctly explains DOM as a reasonable prototype chain. But it&#8217;s only the beginning. The DOM is in terrible shape, and not due to implementation differences. The malign neglect of IDL-addled designs, the ghosts of dead-end XML experiments, and endless cruft will plague any language that sidles up to it. Until we get a real <a href="http://wiki.whatwg.org/wiki/Component_Model">Component Model</a>, a better CSS OM, and some sort of a pragma for DOM that allows us to fix DOM&#8217;s abhorrent JS bindings, we&#8217;ll continue to be hostage to C++ APIs inartfully wired up to an incredibly dynamic language. And that’s to say nothing of the pressing need for <a href="http://code.google.com/p/experimental-css/">better CSS</a>, animations, and <a href="http://code.google.com/p/mdv/">a built-in data-binding/templating system</a>. When the platform doesn’t provide it, today, we get it from JavaScript. But that’s not where the solutions always belong.</p>
<p>Let me put it another way: when you find yourself thinking &#8220;man, JavaScript sucks,&#8221; remember that it&#8217;s only painful in large quantities. And why do you need so much of it? &#8216;Cause the DOM, CSS, and HTML standards are letting you down. Any language wired up to the browser today is subject to the same fate, and the insane reality that these things are specified under different roofs in processes that aren&#8217;t subject to the popular will of web developers. Python doesn’t have it’s DOM APIs decided by the W3C, they borrow the idiomatic <a href="http://docs.python.org/library/xml.etree.elementtree.html">ElementTree API</a> from within their own community. WebIDL is an artifact of a different time that has a tenuous relationship to idiomatic JavaScript, the CSS-OM barely exists, and DOM apologists are doing more harm than any of JavaScript&#8217;s warts ever have. We can fix these things, of course, and here at Google we&#8217;re trying – in good faith – to work in standards to make them better. But the bottom line is that the language isn’t the problem. I repeat: the language isn’t the problem, the platform is.</p>
<p>The only thing that&#8217;s going to replace the web as universal platform is the next version of the web. Those of us working on Chrome believe that to the core and feel a deep urge to make things better faster. We might not always agree on the &#8220;how,” but we all believe that we can’t do it alone.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2011/09/google-the-future-of-javascript/feed/</wfw:commentRss>
		<slash:comments>36</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>Cutting The Interrogation Short</title>
		<link>http://infrequently.org/2011/01/cutting-the-interrogation-short/</link>
		<comments>http://infrequently.org/2011/01/cutting-the-interrogation-short/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 22:21:04 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://infrequently.org/?p=1560</guid>
		<description><![CDATA[I&#8217;ve been having a several-day mail, IRC, and twitter discussion with various folks about performance and the feature detection religion technique, particularly on mobile where CPU ain&#8217;t free. So what&#8217;s the debate? I say you shouldn&#8217;t be running tests in UA&#8217;s where you can dependably know the answer a-priori. Wait, what? Why does Alex Russell [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been having a several-day mail, IRC, and twitter discussion with various folks about performance and the feature detection <strike>religion</strike> technique, particularly on mobile where CPU ain&#8217;t free. So what&#8217;s the debate? I say you shouldn&#8217;t be running tests in UA&#8217;s where you can dependably know the answer a-priori.</p>
<p>Wait, what? Why does Alex Russell hate feature testing, kittens, and cute fuzzy ducklings?</p>
<p>I don&#8217;t. <a href="http://paulirish.com/">Paul</a> warned me that my approach isn&#8217;t going to be popular at first glance, but hear me out. My assumptions are as follows:</p>
<ul>
<li>Working is better than busted</li>
<li>Fast is better than slow</li>
<li>No browser vendor changes the web-facing features in a given version. Evar. Does not happen</li>
</ul>
<p>If you buy those, then I think we can all get some satisfaction by retracing our steps and asking, seriously, what <em>is</em> the point of feature testing?</p>
<p>Ok, I&#8217;ll go first: feature testing is motivated by a desire not to be busted, particularly in the face of new versions of UA&#8217;s which will (hopefully) improve standards support and reduce the need for hacks in the first place. Sensible enough. Why should users wait for a new version of your library just &#8217;cause a new browser was released or because you didn&#8217;t test on some version of something.</p>
<p>Extra bonus: if you don&#8217;t mind running them every time, you can write just the feature test and your work is done now and in the future! Awesome! Except some of us do mind. Yes, things are now resilient in the face of new UA&#8217;s and new versions of old ones, but only on the back of testing for everything you need ever time you load a library on a page. Slowly. Veeerrrrry slooowly.</p>
<p>Paul suggested that some library could use something like Local Storage to cache the results of these tests locally, but this hardly seems like an answer. First, what if the user upgrades their browser? Guess you have to cache and check against the UA string anyway. And what about the cost of going to storage? Paul reported that these tests can be <em>wicked</em> expensive to run at all, on the order of 30ms for the full suite (which you hopefully won&#8217;t hit&#8230;but sheesh). Reported worst-case for <a href="https://github.com/phiggins42/has.js/">has.js</a> is even worse. But apparently going to Local Storage is <em>also</em> expensive. And we&#8217;re still running all these tests in the fast path the first time anyway. If we think that they&#8217;re so expensive that we want to cache the results, why don&#8217;t we think they&#8217;re so expensive that we don&#8217;t want to run them in the common case?</p>
<p>Now for a modest proposal: <b>feature tests should only ever be run <em>when you don&#8217;t know what UA you&#8217;re running in</em></b>.</p>
<p>Feature testing libraries should contain pre-built caches &#8212; the kind that come with the library, not the kind that get built on the client &#8212; but they should only be consulted for UA versions that you <em>know</em> you know. If we assume that behavior for UA/version combination never changes, we&#8217;ve got ourselves a get-out-of-jail free card. Libraries can have <code>O(1)</code> behavior in the common case and in the situations where feature testing would keep you from being busted, you&#8217;re still not busted.</p>
<p>So what&#8217;s the cost to this? Frankly, given the size of some of the feature tests I&#8217;ve seen, it&#8217;s going to be pretty minimal vs. the bloat the feature tests add. All performance work is always a tradeoff, but if your library thinks it&#8217;s important not to break <em>and</em> to be fast, then I don&#8217;t see many alternatives. New versions of libraries can continue to update the caches and tests as necessary, keeping the majority of users fast, while at the same time keeping things working in hostile or unknown environments.</p>
<p>Anyhow, if you&#8217;re a library author or maintainer, please please <em>please</em> consider the costs of feature tests, particularly the sort that mangle DOM and or read-back computed layout values. Going slow hurts users, hurts the web, and hurts the culture of performance that&#8217;s so critical to keeping the platform a viable contender for the next generation of apps. We owe it to users to go faster.</p>
<p><b>A quick aside</b>: I hesitated writing this for the same reasons that Paul cautioned me about how unpopular this was going to be: there&#8217;s a whole lot of know-nothing advocacy that&#8217;s still happening in the JS/webdev/design world these days, and it annoys me to no end. I&#8217;m not sure how our community got so religious and fact-disoriented, but it has got to stop. If you read this and your takeaway was &#8220;Alex Russell is against feature testing&#8221;, then you&#8217;re part of the problem. Think of it like a feature test for bogosity. Did you pass? If so, congrats, and thanks for being part of the bits of the JavaScript universe that I like.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2011/01/cutting-the-interrogation-short/feed/</wfw:commentRss>
		<slash:comments>51</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>View-Source Is Good? Discuss.</title>
		<link>http://infrequently.org/2010/01/view-source-is-good-discuss/</link>
		<comments>http://infrequently.org/2010/01/view-source-is-good-discuss/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 03:36:22 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[webdev]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[openweb]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[viewsource]]></category>

		<guid isPermaLink="false">http://alex.dojotoolkit.org/?p=1241</guid>
		<description><![CDATA[I&#8217;ve been invited by Chris Messina and some kindly folks at MSFT to participate in a panel at this year&#8217;s SxSW regarding the value and/or necessity of view-source, and so with apologies to my fellow panelists, I want to get the conversation started early. First, my position: ceteris paribus, view-source was necessary (but not sufficient) [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been invited by <a href="http://factoryjoe.com/blog/">Chris Messina</a> and some <a href="http://chrisbernard.blogs.com/">kindly folks</a> at MSFT to participate in a panel at this year&#8217;s SxSW regarding the value and/or necessity of view-source, and so with apologies to my fellow panelists, I want to get the conversation started early.</p>
<p>First, my position: <em><a href="http://en.wikipedia.org/wiki/Ceteris_paribus">ceteris paribus</a></em>, view-source was necessary (but not sufficient) to make HTML the dominant application platform of our times. I also hold that it is under attack &mdash; not least of all from within &mdash; and that losing view-source poses a significant danger to the overall health of the web.</p>
<p>That&#8217;s a lot to hang on the shoulders of a relatively innocent design decision, and I don&#8217;t mean to imply that any system that has a view-source like feature will become dominant. But I do argue that it helps, particularly when coupled with complementary features like reliable parsing, semantic-ish markup, and plain-text content. Perhaps it&#8217;s moving the goal line a bit, but when I talk about the importance of view-source, I&#8217;m more often than not discussing these properties together.</p>
<p>To understand the importance of view-source, consider how people learn. <a href="http://vis.berkeley.edu/papers/prefuse/2005-prefuse-CHI.pdf">Some evidence exists</a> that even trained software engineers chose to work with copy-and-pasted example code. Participants in the linked study even expressed guilt over the copy-paste-tweak method of learning, but guilt didn&#8217;t change the dynamic: a blank slate and abstract documentation doesn&#8217;t facilitate learning nearly as well as poking at an example and feeling out the edges by doing. View-source provides a powerful catalyst to creating a culture of shared learning and learning-by-doing, which in turn helps formulate a mental model of the relationship between input and output faster. Web developers get started by taking some code, pasting it into a file, saving, loading it in a browser and hitting <code>ctrl-r</code>. Web developers switch between editor and browser between even the most minor changes. This is a stark contrast with technologies that impose a compilation step where the process of seeing what was done requires an intermediate step. In other words, immediacy of output helps build an understanding of how the system will behave, and <code>ctrl-r</code> becomes a seductive and productive way for developers to accelerate their learning in the copy-paste-tweak loop. The only required equipment is a text editor and a web browser, tools that are free and work together instantly. That is to say, there&#8217;s no waiting between when you save the file to disk and when you can view the results. It&#8217;s just a <code>ctrl-r</code> away.</p>
<p>With that hyper-productive workflow as the background, view-source helps turn the entire web into a giant learning lab, and one that&#8217;s remarkably resilient to error and experimentation. See an interesting technique or layout? No one can tell you &#8220;no&#8221; to figuring out how it was done. Copy some of it, paste it into your document, and you&#8217;ll get <em>something</em> out the other side. Browsers recovering from errors gracefully create a welcome learning environment, free of the inadequacy that a compile failure tends to evoke. You can <em>see</em> what went wrong as often as not. The evolutionary advantages of reliable parsing have helped to ensure that strict XML content comprises roughly none of the web, a decade after it was recognized as &#8220;better&#8221; by world+dog. Even the most sophisticated (or broken) content is inspectable at the layout level and tools like <a href="http://getfirebug.com/">Firebug</a> and the <a href="http://webkit.org/blog/829/web-inspector-updates/">Web Inspector</a> accelerate the copy-paste-tweak cycle by inspecting dynamic content and allowing live changes without reloads, even on pages you don&#8217;t &#8220;own&#8221;. The predicate to these incredibly powerful tools is the textual, interpreted nature of HTML. There&#8217;s much more to say about this, but lets instead turn to the platform&#8217;s relative weaknesses as a way of understanding how view-source is easily omitted from competing technologies.</p>
<p>The first, and most obvious, downside to the open-by-default nature of the web is that it encourages multiple renderers. Combined with the ambiguities of reliable parsing and semantics that leave room for interpretation, it&#8217;s no wonder that web developers struggle through incompatibilities. In a world where individual users each need to be convinced to upgrade to the newest version of even a single renderer, differences only in version can wreak havoc in the development process. Things that work in one place may not look exactly the same in another. This is both a strength and a weakness for the platform, but at the level of sophisticated applications, it&#8217;s squarely a liability. Next, ambiguities in interpretation and semantics mean that the project of creating tooling for the platform is significantly more complex. If only one viewer is prevalent (for whatever reason), then tools only need to consume and generate code that understands the constraints, quirks, and performance of a single runtime. Alternate forms of this simplification include only allowing code (not markup) so as to eliminate parsing ambiguity. The code-not-markup approach yields a potentially more flexible platform and one that can begin to execute content more quickly (as Flash does). These advantages, taken together, can create an incredibly productive environment for experts in the tools that generate content: no output ambiguity, better performance, and tools that can deliver true WYSIWYG authoring. These tools can sidestep the <code>ctrl-r</code> cycle entirely.</p>
<p>But wait, I hear you shout, It&#8217;s possible to do code-only, toolable, full fidelity development in JavaScript! Tools like GWT and Cappuccino generate code that generates UI, ensuring that only those who can write code or have tools that can will participate; removing the potential value of view-source for those apps. But lets be honest: view source is nearly never locally beneficial. I can hardly count the number of times I&#8217;ve seen the &#8220;how do I hide my code?&#8221; question from a web n00b who (rightly or wrongly) imagines there&#8217;s value in it. For GWT the fact that the output is an HTML DOM that&#8217;s styled with CSS is as much annoyance as benefit. The big upside is that browsers are the dominant platform and you don&#8217;t have to convince users to install some new runtime.</p>
<p>Similarly Flex, Laszlo, GWT&#8217;s UI Binder, and Silverlight have discovered the value in markup as a simple declarative way for developers to understand the hierarchical relationships between components, but they correspond to completely unambiguous definitions of components they rely on compiled code &mdash; not reliably parsed markup &mdash; for final delivery of the UI. These tight contracts turn into an evolutionary straightjacket. Great if you&#8217;re shipping compiled code down the wire that can meet the contract, but death if those tags and attributes are designed to live for long periods of time or across multiple implementations. You might be able to bolt view-source into the output, but it&#8217;ll always be optional and ad-hoc, features that work against it being pervasive. Put another way, the markup versions of these systems are leaky abstractions on the precise, code-centric system that under-girds both the authoring and runtime environments. This code-centric bias is incredibly powerful for toolmakers and &#8220;real&#8221; developers, but it cuts out others entirely; namely those who won&#8217;t &#8220;learn to program&#8221; or who want to build tools that inject content into the delivery format.</p>
<p>Whatever the strengths of code-based UI systems, they throw web crawlers for a loop. Today, most search engines deal best with text-based formats, and those search engines help make content more valuable in aggregate than it is on its own. Perhaps it&#8217;s inevitable that crawlers and search engines will need to execute code in order to understand the value of content, but I remain unconvinced. As a thought experiment, consider a web constructed entirely of Flash content. Given that Flash bytecode lacks a standard, semantic way to denote a relationship between bits of Flash content, what parts of the web wouldn&#8217;t have been built? What bits of your work would you do differently? What would the process be? There&#8217;s an alternate path forward that suggests that we can upgrade the coarse semantics of the web to deal with ever-more-sophisticated content requirements. Or put another way, use the features of today&#8217;s toolkits and code generators as a TODO list for markup driven features. But the jury is still out on the viability that approach; the same dynamic that makes multiple renderers possible ensures that getting them to move in a coordinated way is much harder than the unilateral feature roadmap that plugin vendors enjoy. HTML 5 and CSS 3 work is restarting those efforts, but only time will tell if we can put down the code and pick markup back up as a means to express ourselves.</p>
<p>I&#8217;ve glossed over a lot of details here, and I haven&#8217;t discussed implications for the server side of a non-text format as our lingua-franca, nor have I dug into the evolution metaphor. Many of the arguments are likewise conditional on economic assumptions. There&#8217;s lots of discussion yet to have, so if you&#8217;ve got links to concrete research in either direction or have an experience that bears on the debate post in the comments! Hopefully my fellow panelists will respond in blog form and I&#8217;ll update this post when they do.</p>
]]></content:encoded>
			<wfw:commentRss>http://infrequently.org/2010/01/view-source-is-good-discuss/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>
