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

<channel>
	<title>onenaught.com</title>
	<atom:link href="http://www.onenaught.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.onenaught.com</link>
	<description>A blog on web standards, accessibility, css, javascript, xslt, and more</description>
	<pubDate>Sun, 04 May 2008 09:30:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
	<image>
		<title>One Naught</title>
		<url>http://www.onenaught.com/wp-content/themes/onenaught/images/onenaught.png</url>
		<link>http://www.onenaught.com</link>
		<width>116</width>
		<height>130</height>
		<description>OneNaught.com</description>
	</image>		<item>
		<title>How to fix huge text in Firefox 3 Beta 5 on Kubuntu 8.04</title>
		<link>http://www.onenaught.com/posts/77/how-to-fix-huge-text-in-firefox-3-beta-5-on-kubuntu-804</link>
		<comments>http://www.onenaught.com/posts/77/how-to-fix-huge-text-in-firefox-3-beta-5-on-kubuntu-804#comments</comments>
		<pubDate>Sat, 03 May 2008 21:37:42 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.onenaught.com/?p=77</guid>
		<description><![CDATA[<img src="http://www.onenaught.com/wp-content/uploads/kubuntu-firefox.png" alt="" title="kubuntu-firefox" class="post-img" align="left" /> Firefox 3.0 beta 5 on Kubuntu 8.04 renders <em>some</em> text way too big. It turns out to be an issue when using points for your font size units in CSS (although generally relative units should be preferred, anyway!). You can fix this by

<ol>
<li>Going to about:config</li>
<li>Look for the setting called <code>layout.css.dpi</code>. The default value is -1.</li>
<li>Change it to 96</li>
</ol>

The problem appears not to be Firefox, but the GNOME window manager's settings. However, I don't know how to change those when running KDE instead of GNOME. Anyone know?

Firebug may also have trouble running so this post has a tip on how to sort that out.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.onenaught.com/wp-content/uploads/kubuntu-firefox.png" alt="" title="kubuntu-firefox" class="post-img" align="left" /> Firefox 3.0 beta 5 on Kubuntu 8.04 (I don&#8217;t know about other Linux distributions) renders <em>some</em> text way too big. It turns out to be an issue when using points for your font size units in CSS (you should use a relative font unit, generally anyway!).</p>
<h3 id="toc-the-quickfix">The quickfix</h3>
<p>You can fix this by doing the following:</p>
<ol>
<li>Type <code>about:config</code> in the Firefox address bar</li>
<li>Look for the setting called <code>layout.css.dpi</code>. The default value is -1.</li>
<li>Change it to 96</li>
</ol>
<p>There may be a deeper problem; Firefox on Linux is a GNOME application and so uses the GNOME window manager settings. Kubuntu uses the KDE window manager, so the DPI settings for it do not seem to apply to GNOME and I don&#8217;t know where/how to set GNOME ones while running Kubuntu. </p>
<p>Some forums suggest a few things that have not worked. While the above change in Firefox has worked, ideally I&#8217;d like to change the GNOME settings instead. Anyone have any ideas on that?</p>
<h3 id="toc-getting-firebug-working-properly-too">Getting Firebug working properly, too</h3>
<p>To get Firebug to work properly (YSlow 0.9.5b1 seems to stop it working, which is a shame):</p>
<ol>
<li>Uninstall YSlow if you have it</li>
<li>Uninstall any existing Firebug</li>
<li>Install DOM Inspector if not already installed</li>
<li>Get <a href="http://www.getfirebug.com/releases/">Firebug 1.2 alpha</a> (1.1 beta did not seem to work properly for me)</li>
<li>Restart as prompted</li>
</ol>
<p>I tried to reinstall YSlow, but no joy. That&#8217;s a bummer as YSlow is useful. Until they fix it, you can remote to a PC/Mac running it or use a virtual machine of something that runs it!</p>
<h3 id="toc-some-additional-thoughtsnotes">Some additional thoughts/notes</h3>
<p>The <a href="http://kb.mozillazine.org/Layout.css.dpi">Mozilla Knowledgebase on layout.css.dpi</a> says that the default of -1 means to use the OS dpi or 96, whichever is *greater*, although Kubuntu/KDE reports 96! Somewhere there is a higher value, but I am a bit new to Linux to know where to find that.</p>
<p>While I initially suspected this to be a problem specific to Firefox on Linux when I used the vector graphic application, Inkscape, as I was exporting an svg to a bitmap, I noticed that the dpi settings it reported was something like 116dpi. Inkscape is also a GTK application, so now I think that it is a DPI setting used by GNOME.</p>
<p>Unless someone knows how to set those things while using Kubuntu, I have to make my change in Firefox itself (and see what happens when the final version is released). A few forums and posts suggested things like running the gnome setting daemon at start up, using the KDE GUI for GTK settings etc, but none of those seem to make any difference. Any ideas anyone?</p>
<p>I can live with this for now (I just need to figure out how to get those ugly close buttons replaced with something else &#8212; anyone know how to get GNOME apps to use a different icon set or theme when running Kubuntu???)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/77/how-to-fix-huge-text-in-firefox-3-beta-5-on-kubuntu-804/feed</wfw:commentRss>
		</item>
		<item>
		<title>Accessibility 2.0 Conference</title>
		<link>http://www.onenaught.com/posts/64/accessibility-20-conference</link>
		<comments>http://www.onenaught.com/posts/64/accessibility-20-conference#comments</comments>
		<pubDate>Tue, 29 Apr 2008 22:38:06 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Accessibility]]></category>

		<guid isPermaLink="false">http://www.onenaught.com/?p=64</guid>
		<description><![CDATA[<img src="http://www.onenaught.com/wp-content/uploads/accessibility2-logo.jpg" class="post-img" align="left" alt="Accessibility 2.0; A million flowers bloom, Conference." /> I attended the <a href="http://www.abilitynet.org.uk/accessibility2/">Accessibility 2.0 conference</a>, held in London on 25th April, 2008.

This post is a summary of some main points from each session, including links to notes from others, as well as slides from presenters.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.onenaught.com/wp-content/uploads/accessibility2-logo.jpg" class="post-img" align="left" alt="Accessibility 2.0; A million flowers bloom, Conference." /> I attended the <a href="http://www.abilitynet.org.uk/accessibility2/">Accessibility 2.0 conference</a>, held in London on 25th April, 2008.</p>
<p>While I won&#8217;t summarize all the things that the session speakers said (there are some links towards the end for that), here are some key things I took away from each presenter:</p>
<h3 id="toc-open-data-keynote-presentation-from-jeremy-keith">Open Data &#8212; Keynote Presentation from Jeremy Keith</h3>
<p>This guy is usually quite funny, but this time he decided to read something he had written. I thought this was going to be a long and dry session, but instead it was very interesting, looking at the importance of</p>
<ul>
<li>Open data for accessible information (to everyone) and for digital preservation</li>
<li>Standards for format longevity and innovation (bred by constraints)</li>
</ul>
<p>He was approaching accessibility from the perspective of accessible data for everyone.</p>
<h3 id="toc-assistive-technologies-and-ajax-by-steve-faulkner">Assistive Technologies and AJAX by Steve Faulkner</h3>
<p>Steve Faulkner is a noted accessibility expert and has lots of detailed information about accessibility  on <a href="http://www.paciellogroup.com/blog/">his blog</a> (and in particular, some decent research on how screen readers work in different scenarios). His examples mainly came from <a href="http://twitter.com/">Twitter</a>, the micro-blogging tool.</p>
<p>There were some interesting examples of how <a href="http://www.w3.org/WAI/intro/aria">WAI ARIA</a> live regions would help make some simple features accessible, such as the text countdown that shows how many characters you have left to type, common on many sites where you fill in text areas.</p>
<p>(One of his points about the problem of using the <code>abbr</code> element&#8217;s title attribute to put in an <a href="http://www.w3.org/TR/NOTE-datetime">ISO 8601</a> date time format eventually led to a public argument during the final panel session between <a href="http://www.isolani.co.uk/blog/access/AccessibilityOfDateTimeMicroformat<br />
">Mike Davies</a> and <a href="http://adactio.com/journal/1457/">Jeremy Keith</a>!)</p>
<h3 id="toc-fencing-in-the-habitat-by-christian-heilmann">Fencing in the Habitat by Christian Heilmann</h3>
<p>Christian Heilmann works for Yahoo but has long <a href="http://www.wait-till-i.com">blogged</a> about accessibility, JavaScript and more.</p>
<p>This talk was about how not to approach accessibility. He has already published his <a href="http://www.wait-till-i.com/2008/04/26/fencing-in-the-habitat-doing-things-right-and-getting-the-accessibility-wrong/">slides and notes for the talk</a>, so the only thing I will add here are my main take-away points:</p>
<ul>
<li>There&#8217;s no need to scare people into doing accessibility anymore</li>
<li>It&#8217;s generally easy (despite a lot of misconceptions) and helps so many people. He described the immense joy some elderly people had when they were given a wii without any knowledge how to use it. Yet, very quickly they were having immense fun playing on it! Accessibility is more than guidelines; it is also about usability.</li>
</ul>
<h3 id="toc-rich-media-and-web-applications-for-people-with-learning-disabilities-by-antonia-hyde">Rich Media and Web Applications for People with Learning Disabilities by Antonia Hyde</h3>
<p>This talk was really interesting about how a group that is often left behind in accessibility implementations &#8212; people with learning disabilities &#8212; are affected by the web.</p>
<p>A number of instructive videos showed how some people can struggle with common features on sites.</p>
<p>She ran out of time but put up her <a href="http://hiantonia.wordpress.com/2008/04/26/3/">slides on her blog</a>.</p>
<h3 id="toc-user-generated-content-by-jonathan-hassell">User Generated Content by Jonathan Hassell</h3>
<p>Jonathan Hassell is the head of Audience Experience and Usability for BBC Future Media &amp; Technology. He also leads the BBC Usability &#038; Accessibility team so had quite a lot of interesting things to say.</p>
<p>User generated content is of course a major issue in modern web sites when it comes to concerns like standards and accessibility.</p>
<p>One of the strategies Hassell mentioned was to use a moderator approach, accepting it is really hard to get end users to know about how to create accessible content. This way, a moderator adds accessibility and other things once the content has been created.</p>
<p>This is quite an expensive way to do thing, he accepted and sometimes will not be possible.</p>
<p>The other problem is that as more content moves away from basic text-based formats that is the web, assistive technologies will struggle even more to provide accessible alternatives. While not impossible, the implications include the following:</p>
<ul>
<li>Those formats require accessibility be built in, or have alternatives</li>
<li>Content producers will become increasingly responsible for accessible content</li>
</ul>
<p>The other point he stressed, like many others, is that accessibility is a misleading word; it is really an issue of usability.</p>
<p>As content becomes more multi-media the additional challenge he finds is how to make such multi media accessible in innovative ways. One example was using 3D and stereo sound in a Flash-based children&#8217;s game where they had to push a train carriage from the left part of the screen to the right hand side. By using 3D sound and stereo, audio feedback to a child who is blind or has poor eyesight, would still allow them to experience more of the game than usual. Another game showed sign language being used.</p>
<p>Another interesting point he made was regarding JavaScript: As a number of people have noted for a long time, there is a common misconception that JavaScript is an accessibility no-no. Hassell noted that it helped make the new BBC home page <em>more</em> accessible to screen readers, rather than less.</p>
<h3 id="toc-a-case-study-building-a-social-network-for-disabled-users-by-stephen-eisden">A Case Study: Building a Social Network for Disabled Users by Stephen Eisden</h3>
<p>This talk was about the user testing, accessibility audits and technology decisions that come with building a social network for disabled users called Disability Information Portal (DIP). After evaluating a few different ways to do this, they settled on WordPress as the basis of their network, currently in pilot stage, <a href="http://www.dip-online.org/">http://www.dip-online.org/</a>.</p>
<p>Eisden also noted that an accessible site was generally a more usable site, too.</p>
<h3 id="toc-tools-technologies-to-watch-or-to-avoid-by-ian-forrester">Tools &amp; Technologies to Watch or to Avoid by Ian Forrester</h3>
<p>Ian Forrester runs BBC&#8217;s <a href="http://backstage.bbc.co.uk/">Backstage</a>, a web site for designers and developers.</p>
<p>This promised to be an excellent session, but for some reason they only gave him about 20 minutes and he had some 80 slides to go through! So he had to cut really short which was disappointing. I had the opportunity to talk to him a bit more after the sessions were over, and that was really interesting. He has a good interest in XSLT too <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Some of the points he did manage to get across were how some Web 2.0 sites made it hard enough for normal users to do things, let alone people with additional needs. Examples included hard to understand user licenses and terms &amp; conditions; Flash videos and captioning; using various sites to import contacts or export data, etc.</p>
<h3 id="toc-accessibility-20-panel-discussion-chaired-by-julie-howell">Accessibility 2.0 Panel Discussion chaired by Julie Howell</h3>
<p>This panel was an interesting enough discussion, chaired by one of the most prominent people in the accessibility circles. Nothing to really add here that is not captured in the notes by others listed below.</p>
<h3 id="toc-slides-and-notes-from-each-session">Slides and notes from each session</h3>
<p>AbilityNet, who hosted the conference will be putting up <a href="http://www.abilitynet.org.uk/accessibility2/">videos and transcripts of each session</a> shortly.</p>
<p>Jeremy Keith, one of the speakers, and well known for his work on DOM Scripting (I think he coined that term?) was taking notes during the session and posted them as follows:</p>
<ol>
<li><a href="http://adactio.com/articles/1450/">Open Data</a> by Jeremy Keith.</li>
<li><a href="http://adactio.com/journal/1451/">Making twitter tweet</a> by Steve Faulkner.</li>
<li><a href="http://adactio.com/journal/1452/">Fencing in the habit</a> by Christian Heilmann.</li>
<li><a href="http://adactio.com/journal/1453/">Rich Media and Web applications for people with learning disabilities</a> by Antonia Hyde.</li>
<li><a href="http://adactio.com/journal/1454/">User-generated Content</a> by Jonathan Hassell.</li>
<li><a href="http://adactio.com/journal/1455/">A case study: Building a social network for disabled users</a> by Stephen Eisden.</li>
<li><a href="http://adactio.com/journal/1456/">Tools and Technologies to Watch and Avoid</a> by Ian Forrester.</li>
<li><a href="http://adactio.com/journal/1457/">Accessibility 2.0 panel discussion</a> with Mike Davies, Kath Moonan, Bim Egan, Jonathan Hassell, Antonia Hyde and Panayiotis Zaphiris, moderated by Julie Howell.</li>
</ol>
<p>Christian Heilmann also did some live-blogging and posted his <a href="http://developer.yahoo.net/blog/archives/2008/04/accessibility_2.html">notes</a> up on the Yahoo Developer Network. He also includes a number of additional links to speakers, and other live-bloggers.</p>
<h3 id="toc-summarising-the-whole-day">Summarising the whole day</h3>
<p>A common theme running through the day was that <a href="http://www.onenaught.com/posts/38/web-accessibility-not-just-for-disabled-people">web accessibility is not just for disabled people</a>; it is about usability and ensuring as wide an audience as possible can access the content.</p>
<p>Jeremy Keith also had a useful summary:</p>
<blockquote cite="http://adactio.com/journal/1458/">
<p>All in all, it was a great day of talks with some recurring points:</p>
<ul>
<li>Accessibility is really a user-experience issue.</li>
<li>Guidelines for authoring tools are now more relevant than guidelines for content.</li>
<li>Forget about blindly following rules: nothing beats real testing with real users.</li>
</ul>
<p class="source">&#8211; <cite>Jeremy Keith, <a href="http://adactio.com/journal/1458/">Open Data and Accessibility</a>, April 26, 2008</cite></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/64/accessibility-20-conference/feed</wfw:commentRss>
		</item>
		<item>
		<title>Searching for apps and commands by typing rather than clicking; is typing the new clicking?</title>
		<link>http://www.onenaught.com/posts/67/is-typing-the-new-clicking</link>
		<comments>http://www.onenaught.com/posts/67/is-typing-the-new-clicking#comments</comments>
		<pubDate>Tue, 29 Apr 2008 01:02:46 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.onenaught.com/?p=67</guid>
		<description><![CDATA[Microsoft recently announced an add-on to Office 2007 to let people search for commands by typing it in if they can't find it in the new Ribbon user interface.

<img src="/wp-content/uploads/search-commands-in-word.png" alt="" width="420" height="139" />

I find it interesting that a number of interfaces are now offering "shortcuts" to mouse clicking everywhere.

Is typing become the new clicking?]]></description>
			<content:encoded><![CDATA[<p>Microsoft recently announced an add-on to Office 2007 to let people <a href="http://www.news.com/8301-13860_3-9929280-56.html?part=rss&#038;subj=news&#038;tag=2547-1_3-0-5">search for commands</a> by typing it in if they can&#8217;t find it in the new Ribbon user interface.</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/search-commands-in-word.png" alt="Office 2007 search for commands add-on lets you type the command you are looking for" width="420" height="139" /></p>
<p>I find it interesting that a number of interfaces are now offering &#8220;shortcuts&#8221; to mouse clicking everywhere.</p>
<p>While desktop search applications already provide this kind of convenience for finding files, such an interface for finding <em>commands</em> is quite interesting, to me.</p>
<p>I have noticed this more so in products used typically by technical people.</p>
<p>For example, on the Mac at various places, such as the System Preferences, you can type for the settings you want to adjust and the application will highlight possible matches for you:</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/mac-osx-sys-prefs.png" alt="Mac OSX System Preferences allows you to type for a feature and it will highlight matches" /></p>
<p>KDE 4, a Linux window manager, has a start-like menu (called the KickOff) where you can type the program you want to find:</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/kde4-kickoff.png" alt="" /></p>
<p>Vista has a similar thing from its Start menu:</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/vista-start.png" alt="" /></p>
<p>Various software development tools from the excellent <a href="http://www.jetbrains.com/resharper/">Resharper</a> add-in for C# in Visual Studio, to API documentation readers, all offer some way to type in the class, file, method etc you are looking for. And such features are sometimes an efficient alternative to clicking through large trees of information:</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/resharper-type-search.gif" alt="Resharper's handy type pop up allows you to start typing the name of a class you want to open" /></p>
<p>Someone wrote a very useful <a href="http://remysharp.com/jquery-api/">jQuery API guide</a> where the main form of navigation is to begin typing for the api feature you are looking for:</p>
<p><img src="http://www.onenaught.com/wp-content/uploads/jquery-api.png" alt="jquery-api documentation allows you to start typing for functionality and the api adjusts accordingly" /></p>
<p>The Office add-on for finding commands, while still in early testing, is a feature that targets more than just technical users, so it will be interesting to see how this works out.</p>
<p>Is Microsoft&#8217;s announcement a sign of failure of the Ribbon interface? I don&#8217;t think so; it may be more reflective of the challenge they find of getting users who are so used to a well-established product to doing things dramatically differently.</p>
<p>As people are getting more used to searching on the web, perhaps that metaphor is making its way back into more traditional user interfaces and that typing is perhaps no longer seen as a poor usability option compared to clicking around using a mouse.</p>
<p>(To clarify, I don&#8217;t expect, or want to imply, that typing/command lines etc should replace window managers and pointing/clicking interfaces; instead, there seems to be some appropriate situations where typing looks more efficient than clicking, often in places where the GUI was there because of the advantages of pointing and clicking. Or, at least, typing helps augment a GUI, reducing barriers.)</p>
<p>This reminds of my first job (technically a placement year/internship at Northern Telecom in London but it was such a good experience I consider it a proper job!) in 1996 looking at the HP-UX box on my desk (HP&#8217;s UNIX machines) trying to get it all set up and asking the person opposite how to use the file manager GUI to do a certain thing; she just looked at me, smiled, and said, &#8220;just use the console; typing is a lot more efficient!&#8221;</p>
<p>Typing seems to have become the new mouse clicking&#8230;</p>
<p><a href="http://www.flickr.com/photos/pockafwye/239304886/"><img src="http://www.onenaught.com/wp-content/uploads/computer-mouse.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/67/is-typing-the-new-clicking/feed</wfw:commentRss>
		</item>
		<item>
		<title>Onenaught.com nominated for a logo design award</title>
		<link>http://www.onenaught.com/posts/60/onenaughtcom-nominated-for-a-logo-design-award</link>
		<comments>http://www.onenaught.com/posts/60/onenaughtcom-nominated-for-a-logo-design-award#comments</comments>
		<pubDate>Mon, 07 Apr 2008 10:03:02 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Design]]></category>

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

		<guid isPermaLink="false">http://www.onenaught.com/?p=60</guid>
		<description><![CDATA[<img src="/wp-content/uploads/logo-design-awards.gif" alt="Logo design love awards" /> What a pleasant surprise to see the onenaught.com logo nominated for a logo design award at David Airey's Logo Design Love Awards web site.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.onenaught.com/wp-content/uploads/logo-design-awards.gif" alt="Logo design love awards" /> What a pleasant surprise to see the onenaught.com logo nominated for a logo design award at David Airey&#8217;s Logo Design Love Awards web site.</p>
<p>I have to admit, I have never thought of myself as a graphic designer so this is really nice to see.</p>
<p>If you like it, why not head over to the Logo Design Love Awards site and <a href="http://www.logodesignlove.com/logo-awards-technology-blogs">add your vote</a> &#8212; come to think of it, why not vote anyway, even if you prefer other logos <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/60/onenaughtcom-nominated-for-a-logo-design-award/feed</wfw:commentRss>
		</item>
		<item>
		<title>IE8 meta switch switch!</title>
		<link>http://www.onenaught.com/posts/58/ie8-meta-switch-switch</link>
		<comments>http://www.onenaught.com/posts/58/ie8-meta-switch-switch#comments</comments>
		<pubDate>Wed, 05 Mar 2008 15:12:54 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/58/ie8-meta-switch-switch</guid>
		<description><![CDATA[<img src="/wp-content/uploads/ie8-preview-acid2.png" class="post-img" align="left" alt="" /> A little while back the web development blogs were abuzz with Microsoft's announcement that IE 8 will, by default, render in IE7 mode, so as not to "break the web."

Well, it seems that the IE team have decided to change that decision, and decided that IE8 will, by default, interpret web content in the most standards compliant way it can.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.onenaught.com/wp-content/uploads/ie8-preview-acid2.png" class="post-img" align="left" alt="" /> A little while back the web development blogs were abuzz with Microsoft&#8217;s announcement that IE 8 will, by default, render in IE7 mode, so as not to &#8220;break the web.&#8221;</p>
<p>I also had a post on the <a href="http://www.onenaught.com/posts/52/ie8-meta-switch-ie7">implications of that meta switch</a>.</p>
<p>Well, it seems that the IE team have decided to change that decision, and decided that <a href="http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-interoperability-principles-and-ie8.aspx">IE8 will, by default, interpret web content in the most standards compliant way it can</a>.</p>
<p><span id="more-58"></span></p>
<p>The reasons cited were to match Microsoft&#8217;s recently published interoperability principles, and due to developer community feedback.</p>
<p>It seems that legal concerns may have also been a factor.</p>
<p>Rather than go through all those issues here, have a look at these for more information:</p>
<ul>
<li><a href="http://www.microsoft-watch.com/content/web_services_browser/microsoft_spins_ie8_rendering_changes.html">Microsoft Spins IE 8 Rendering Changes</a>, Microsoft Watch</li>
<li><a href="http://meyerweb.com/eric/thoughts/2008/03/04/principles-and-legality/">Principles and Legality</a>, by Eric Meyer (see also the interesting <a href="http://meyerweb.com/eric/thoughts/2008/03/04/principles-and-legality/#comment-330531">comment by Matt Wilcox</a> in the comments thread)</li>
</ul>
<p>It certainly seems like a welcome switch. If nothing else, Matt Wilcox made an interesting observation in the link above, that if this happens, Microsoft will be able to get a good set of stats on who actually decided to opt out and go for the IE7 rendering mode, and this may help inform a better and more accurate decision for IE9.</p>
<p>Are there any catches, or is this a welcome decision?</p>
<p><strong>Update</strong>: Looks like <a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/DevelopersNew.htm">a whole new raft of features coming in IE8</a> &#8212; some of them are playing catch up with other browsers, while other things seem new. (Interesting that they are increasing parallel HTTP connections to 6 per host, not just 2. Hope other browsers do similar things&#8230;!) Are we finally seeing innovation with IE again?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/58/ie8-meta-switch-switch/feed</wfw:commentRss>
		</item>
		<item>
		<title>Why Use XSLT in Server Side Web Frameworks For Output Generation?</title>
		<link>http://www.onenaught.com/posts/8/xslt-in-server-side-web-frameworks</link>
		<comments>http://www.onenaught.com/posts/8/xslt-in-server-side-web-frameworks#comments</comments>
		<pubDate>Mon, 18 Feb 2008 18:02:27 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Server Side]]></category>

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

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/8/xslt-in-server-wide-web-frameworks</guid>
		<description><![CDATA[<img class="post-img" align="left" alt="" src="/wp-content/uploads/xsl-transformers.jpg" /> Just as web developers want to use standards on the client side, standards such as XSLT on the server side may be an efficient way to create good quality markup and other web output.

It can help avoid the hard coded or hard to edit HTML strings that are often seen in server side templates and scripts.

As an open standard, XSLT is reasonably universal, and skills can be easily transferable. 

Some people don't like it or have had bad experiences with it in the past.

But it can be a very powerful tool in the developer's toolbox. Perhaps it is worth giving it another look?

This article looks at why XSLT could be useful as part of the View in an Model-View-Controller pattern, its benefits and potential drawbacks.]]></description>
			<content:encoded><![CDATA[<h3 id="toc-summary">Summary</h3>
<p><img class="post-img" align="left" alt="" src="http://www.onenaught.com/wp-content/uploads/xsl-transformers.jpg" /> This post follows on from previous posts about the way markup is sometimes created.</p>
<p>In a previous post, I worried about some web frameworks that <a href="http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction">abstract away the creation of markup</a>, thus preventing (or making it more difficult for) web developers to create what they need &#8212; the leaky abstraction.</p>
<p>This post explores one way to overcome this, using XSLT.</p>
<p>As this is a rather long post, here are the key points:</p>
<ul>
<li><strong>Creating good quality markup is important</strong> for a variety of reasons (quick loading pages, cross browser compatibility, accessibility, etc).</li>
<li><strong>Some server side frameworks may either generate poor quality markup</strong> or use templating systems that are specific to that framework.</li>
<li>Using XSLT to generate the output can be one way to overcome these limitations, while giving you <strong>full control of the markup that you need to be create</strong>.</li>
<li>Markup generation via <strong>XSLT may be simpler to unit test</strong> as part of a developer’s daily work, which may not be the case (or not necessarily as simple) in other templating systems.</li>
<li>Being <strong>platform agnostic</strong>, XSLT can be an <strong>effective part of a View in an MVC framework</strong> and be applied to different frameworks and platforms, reducing upskilling costs in the long term.</li>
<li><strong>XSLT may not always be appropriate in all cases</strong>, and many are certainly put off by its oddities or perceived limitations, but perhaps it deserves another look?</li>
</ul>
<p>(Some forth-coming posts will provide some code-examples, in particular of unit-testing XSLT and how it might fit into MVC as well as how it can be written in a reusable manner.)</p>
<p><span id="more-8"></span></p>
<h3 id="toc-poor-quality-markup-from-the-server-side">Poor quality markup from the server side.</h3>
<p>A <a href="http://www.onenaught.com/posts/4/should-web-developers-avoid-wysiwyg-editors">previous post on WYSIWYG editors</a> described how the output quality from editors that hide content markup generation can result in markup that is of poor quality, hard to customize/correct/change, affect accessibility (which is a legal requirement in some countries), result in excess bloat, etc. </p>
<p>Some server-side techniques, tools, and frameworks can contribute to this poor markup. This can happen for number of reasons. For example,</p>
<ul>
<li>Popular IDEs may encourage the use of WYSIWYG editors to drop in and drag around HTML controls (or groups of them). As argued in that previous post, WYSIWYG as a paradigm for HTML may actually be inappropriate, (unless you treat WYSIWYG as WYSIWYG-when-css-is-not-enabled).</li>
<li>Popular frameworks may abstract away the creation of HTML, to do it for you. ASP.NET and GWT are such examples. But, as argued in a previous post, such <a href="http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction">abstractions are leaky</a>.</li>
<li>Some popular scripting environments have also encouraged spaghetti code (mixing markup, presentation, and business logic, for example).</li>
</ul>
<p>And so it seems there is a gap between web standards and server-side output generation that is web standards-friendly.</p>
<h4 id="toc-web-application-frameworks-help-immensely">Web application frameworks help immensely</h4>
<p>Various frameworks have been commonplace for a long time now. These help separate out the presentation, business/mid-tier and data access logic.</p>
<p>Most frameworks are not solely about markup generation (if that is their priority at all). Frameworks have been important to address a number of important issues from data access, scalability, performance, transaction management, object-relational mappings, code maintenance, and so on.</p>
<p>These are certainly of value and usually worth using as they have teams of people devoted to them. At their best, they empower the framework user (developers and designers, for example). Yet, on the other hand, some frameworks may take some things too far, thus disempowering framework users.</p>
<h4 id="toc-some-frameworks-still-produce-poor-quality-markup">Some frameworks still produce poor quality markup</h4>
<p>Those of you who have used ASP.NET 1.x will know what a mess its controls create in terms of markup output. (ASP.NET 2 is far better, but can still encourage poor markup or make full control trickier than it needs to be.)</p>
<p>While server side programming using the .NET framework, and C# in particular, are extremely powerful, when it comes to creating web sites, that power is used to typically generate poor quality markup (even though it may be maintainable!).</p>
<p>Some of this stems from the fact that although it tries to hide away the markup creation, <a href="http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction">ASP.NET is a leaky abstraction</a>. (This isn’t just a problem with ASP.NET, but potentially anything that tries to make markup creation a hidden, dark art!)</p>
<h4 id="toc-abstraction-a-good-idea-but-leaky">Abstraction: a good idea but leaky</h4>
<p>Abstraction and loose coupling are certainly important, especially between layers such as presentation, business/middle tier logic and data access. It is a common approach to writing software.</p>
<p>Understandably, developers often like the idea of abstracting away markup/output creation, too. In ASP.NET for example, you could create a simple site without almost writing any HTML. Instead, you instantiate/declare controls such as asp:Label, asp:Panel etc, and you trust .NET to create the markup for you(!).</p>
<p>Interesting attempts are even available so you don&#8217;t have to write JavaScript and you get the benefit of tool support in IDEs for .NET and Java. For example, <a href="http://projects.nikhilk.net/Projects/ScriptSharp.aspx">Script#</a> enables developers to write code in C# (or any .NET language) and then compile it into JavaScript. Google has also been doing such a thing for a long time with its <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> (GWT) for Java. Such ideas are certainly very interesting and appealing.</p>
<p>While appealing perhaps (and maybe more to back end developers), a <em>web</em> developer also loses the ability to control how the output is created.</p>
<h3 id="toc-gaining-control-of-how-you-create-the-output">Gaining control of how you create the output</h3>
<h4 id="toc-why-does-it-matter">Why does it matter?</h4>
<p>Being able to control how you create the output ultimately gives you greatest flexibility, especially when you need to create a flexible, rich, yet lean web-based UI.</p>
<p>Using the &#8220;web standards&#8221; approach (i.e. following W3C recommendations) to achieve these things most efficiently has been well thrashed out for years.</p>
<p>And, just as developers take pride in the quality and readability of their server side code, web developers increasingly take pride in the sites and web apps they create from the code perspective, too.</p>
<p>People from anywhere can easily see your markup; less will see your server side code (though that is not an excuse to write poor server side code!).</p>
<p>Although this is by no means the only factor, when hiring we will often look at sites that people have mentioned in their CVs/resumes (or ask for examples to be sure to see what is theirs) and try to understand how they have coded bits.</p>
<h4 id="toc-some-frameworks-give-full-control-but-may-use-specific-templating-languages">Some frameworks give full control but may use specific templating languages</h4>
<p>Templating languages that accompany many popular web development frameworks may be open, but use mechanisms specific to that framework.</p>
<p>But there are clearly advantages to this approach, too (else they wouldn’t be so common).</p>
<p>For example, templates based on HTML, combined with the language of that framework (e.g. PHP, or Python, or Ruby, or C#, etc.) means there is some familiarity for developers to get on with the task at hand.</p>
<h4 id="toc-consultants-and-contractors-moving-between-frameworks">Consultants and contractors moving between frameworks</h4>
<p>If you work as a consultant or contractor for numerous clients, you may find yourself moving from project to project and then having to learn different templating languages, some with more limitations than others.</p>
<p>In some cases it may be that you end up limiting yourself to just advising on markup, or only providing XHTML/CSS/JavaScript template files, which other coders then have to reproduce.</p>
<p>I have talked to many who have been frustrated at this process, especially with .NET, it seems, as their nicely validating, clean, accessible markup becomes something completely unrecognisable, when ASP.NET gets its way! Unnecessary trade-offs then result.</p>
<p>At work, we have recently been hiring both permanent and contract web developers mostly for work with .NET platforms. We have found it hard to find people with exceptional skills at both the front end <em>and</em> .NET back-end. We tend to find either good front end skills but a different back end (PHP, Java, etc.) or good ASP.NET but little or no real front end knowledge.</p>
<p>In some instances, this is not a problem, but other times it has been preferable to have .NET and good client side skills.</p>
<p>XSLT as the templating mechanism can perhaps help achieve the best of both worlds:</p>
<h3 id="toc-xslt--an-open-standard">XSLT — an open standard</h3>
<p>XSLT could help achieve both abstraction and full control of the markup.</p>
<p>XSLT is a templating language for transforming XML documents into another format (another XML document or some other text-based format).</p>
<p>For web development this can be useful to output exactly what you want and thus gain full control of the markup output generation.</p>
<p>You can re-use XSLT, and even create a hierarchy of XSLTs, that follow a Method Template design pattern, similar to a class hierarchy in Object Oriented Programming, whereby the base XSLT is equivalent to an abstract base class, and other XSLTs that import the base one can override various templates. (A future post will demonstrate this.)</p>
<p>It does of course assume you can easily (or without much cost) get your data in XML format, so you can transform it.</p>
<h3 id="toc-xslt-in-mvc">XSLT in MVC</h3>
<p>Web developers are familiar with separation of concerns (semantic HTML markup for good document structure, CSS for style/layout, JavaScript for behaviour) and progressive enhancement (or graceful degradation).</p>
<p>Back-end/mid-tier software developers are also familiar with separation of concerns (n-tier architectures, single responsibility per class, MVC, etc.)</p>
<p>The Model-View-Controller (MVC) pattern for developing user interfaces has been around for a while. It is a decent approach to separating concerns (the model to represent the data, the view to represent the presentation, and the controller to bind them together).</p>
<p>It can also be seen at a high level (a typical n-tier architecture), as well as being used within the presentation tier (the model may interact with the middle tier, the controller will be part of the presentation tier passing the data (model) to the view code to display it).</p>
<p>It is a well-proven pattern in graphical/desktop application development and being successfully applied by many web-based frameworks today.</p>
<p>MVC can also help improve testability. For example, unit testing can sometimes be easier by testing specific views, models and controllers in separation.</p>
<p>Microsoft has recently announced an <a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx">MVC model for ASP.NET development</a>. I understand one of the many drivers is the unit testability.</p>
<p>From an initial read, this sounds quite good. It encourages better separation. Interestingly it also seems not to support their post-back model which most of their controls are built from. It is therefore not clear to me at the moment if this means you write out more HTML (meaning you get more control of what you output) or if you still use packaged controls (which may risk getting HTML that is not appropriate, or hard to control).</p>
<p>But Microsoft is a bit behind on MVC for web development (though that can also mean it can learn from the earlier frameworks). Other popular frameworks have existed for a while that do this for the web, such as <a href="http://www.rubyonrails.org/">Ruby on Rails</a>, <a href="http://www.djangoproject.com/">Django</a>, <a href="http://www.cakephp.org/">CakePHP</a>, and many more etc. (I am quite impressed with the Python-based Django, for example, even though I have only had a cursory exposure to it &#8212; and I usually prefer curly brace type programming languages!)</p>
<p>While these all have their own merits, they all have different ways of constructing the markup.</p>
<p>XSLT, then, could be part of the View part of an MVC framework. (It need not be the <em>only</em> way to create the view, of course.) For example,</p>
<ul>
<li>A Controller can invoke a Model to get data the way it needs to</li>
<li>The Controller can pass the Model to the View</li>
<li>The View can internally serialize that data into XML and transform it with XSLT to the output.</li>
</ul>
<p>In this way, the markup generation is still nicely abstracted away, but inside that abstraction itself, you have full control of what you need to output.</p>
<h3 id="toc-advantagesbenefits-of-an-xslt-based-approach">Advantages/Benefits of an XSLT-based approach</h3>
<p>Here are a few more detailed reasons XSLT can be useful (though, of course, some of these reasons are by no means unique to an XSLT-based approach).</p>
<h4 id="toc-xslt-is-an-open-standard">XSLT is an Open Standard</h4>
<p>People often talk about the benefits of using open standards on the web client side of things (”web standards”, for example), so why not on the server side?</p>
<p>XSLT 1.0 also has reasonably universal support. (Universal 2.0 support would be even better, though we are not there yet, unfortunately.)</p>
<h4 id="toc-better-separation-of-the-view-from-the-model-and-controller-in-mvc">Better Separation of the View from the Model and Controller in MVC</h4>
<p>A follow-up blog post will demonstrate this in PHP and, time-allowing, Mono/ASP.NET.</p>
<h4 id="toc-unit-testable">Unit Testable</h4>
<p>Many framework templates have been tricky, if not impossible, to fully unit test in isolation from other layers and dependent systems.</p>
<p>ASP.NET&#8217;s new MVC model mentioned earlier has unit testing and test driven development as a driver for this approach, but from what I understand, while it makes controllers and models unit testable, the views are still not (please correct me if I am wrong in the comments below!).</p>
<p>From what I have seen of the other View templates in other frameworks, I believe the same constraint applies (but please let me know if I have missed something).</p>
<p>XSLT, however, requiring mostly an XML input (and possibly arguments passed in programmatically), can therefore make it easier to unit test the view, in isolation of a running web server, database, etc. It can therefore be easier to integrate into a developer’s coding process.</p>
<p>XSLT-based unit tests don&#8217;t necessarily need a whole web server set up to execute. Such unit tests, which are typically numerous by their nature, would be quick to run for the developer during development. This is important in the adoption of unit testing so it doesn’t make running them feel like watching paint dry after each modification!</p>
<p>Another follow-up blog post will attempt to demonstrate this.</p>
<h4 id="toc-gain-full-control-of-the-markup-generation">Gain Full Control of the Markup Generation</h4>
<p>As explained above, markup is important. XSLT gives you the ability to output the markup as you want, with little or no trade-off. (Some other frameworks also allow this, so this isn’t a unique advantage, by any means.)</p>
<h4 id="toc-platform-and-framework-agnostic">Platform and Framework Agnostic</h4>
<p>While the suggestion of using XSLT may introduce a problem of yet another technology, it may also enable skills-standardisation across platforms. This would be useful for say web developers that need to work on multiple projects, for different clients, using different technologies.</p>
<p>This of course makes the assumption that XSLT would be widely adopted in this way! If it were, migrating to desirable new frameworks where the View at least is somewhat XSLT-driven may not be as time-consuming (though of course time is still required on the middle-tier and database layers).</p>
<p>I have, for example, migrated an XSLT-driven site based on “classic” ASP, to PHP-driven XSLT, using the same pattern, but where the XSLT hardly changed at all, saving a fair chunk of time.</p>
<p>For a major client of ours at work, their extremely high-traffic .NET 1.1 web site (now moving to .NET 2.0) was architected to by-pass the .NET controls, to avoid all the problems described above, and we transformed XML with XSLT.</p>
<p>Doing this gave us a number of benefits all in one go:</p>
<ol>
<li>We got the lean &#8212; and accessible &#8212; output needed</li>
<li>The &#8220;object-oriented&#8221; XSLT-based approach also allowed us to create reusable template hierarchies</li>
<li>The customer also wanted multiple sub-sites which was achieved with very little effort or duplication of code, while allowing each sub-site to be customised as needed &#8212; not just CSS or database-driven data differences, but template level changes such as markup and layout changes. (Had we attempted this with ASP.NET, we would have had to create Server Controls with lots of configuration and then in each sub-site we would have to wire them all up, which would lead to a lot of repetition.)</li>
<li>In one case, it wasn&#8217;t just separate sub-sites they wanted, but entirely separate web sites/applications (a public facing one, a kiosk-mode one, and a version of the site that could be used by customer support). All this ran off pretty much the same XSLTs with minor adjustments in inherited XSLTs for each web site.</li>
<li>The migration to .NET 2 involved no XSLT change (only C# changes to take advantage of things like generics, the improved XSLT processor, etc.)</li>
</ol>
<p>And the sites comfortably take thousands of orders an hour on very few web servers (though of course performance is a bigger architectural issue; the point here is that XSLT is not a performance hindrance that some believe &#8212; see below for more on this).</p>
<h4 id="toc-portable-skill">Portable skill</h4>
<p>Being both platform and framework agnostic makes this a portable skill. Of course, XSLT is not limited to just web-based scenarios, either, so it may be quite a good skill to have, generally.</p>
<h4 id="toc-repeatable">Repeatable</h4>
<p>Just as OO techniques and design patterns help with repeatability in different contexts, or just as adopting web standards/CSS-based layout helps to create a repeatable process that can be applied across any web site you wish to develop, using an XSLT-approach can apply to many different projects and in different frameworks.</p>
<h4 id="toc-development-productivity-help-inject-key-skills-into-project-delivery">Development Productivity; Help Inject Key Skills into Project Delivery</h4>
<p>I have consulted at a few companies, and read/heard others describe similar scenarios, whereby skilled client side developers are limited to providing templates they throw over to the developers who are not often <em>web</em> developers.</p>
<p>This can result in either extra time explaining the required markup to the developers. Time may also be needed in working out alternatives (and unnecessary trade-offs) because of limitations in the framework of choice, or garbled markup coming out of the development process (ASP.NET, looking at you!).</p>
<p>This past year at work, we have been aggressively hiring for web development positions, looking for a mixture of strong web standards, <em>and</em> server side programming with .NET. We have found it incredibly hard to hire candidates who are exceptional in all these areas (many good <em>web</em> developers seem to avoid .NET for example, and many ASP.NET experts we find know little on web standards).</p>
<p>But we don’t always need everyone to have <em>all</em> those skills, either; the separation afforded by XSLT has allowed us to hire really strong people with parts of these and get them to work in parallel with others. Those well versed in web standards seem to find XSLT easier to adopt, in my experience, especially if full-blown, back-end programming is not their usual area.</p>
<p>Such developers are therefore not excluded from the development process.</p>
<p>Getting the key skills into the project in this way gives a number of benefits, including</p>
<ul>
<li><strong>Greater productivity and adaptability</strong>: as project requirements change even during development, having more skilled, specialist staff than generalists in all these areas can pay off. (Generalists can often be extremely valuable too, not knocking that at all!)</li>
<li><strong>Parallel development</strong>. We have found it incredibly powerful when development phases are tight and mid-tier and client side development have to start somewhat in parallel. Some of our front-end guys who have not got skills in C# and ASP.NET are nonetheless able to fully contribute to the development process, and the project gains from their in-depth knowledge of the client side.</li>
</ul>
<h4 id="toc-encourage-front-and-back-end-developers-to-work-more-closely">Encourage Front and Back-end Developers to Work More Closely</h4>
<p>During <a href="http://www.onenaught.com/posts/36/day1-media-ajax-november-2007">day 1 of @media AJAX</a>, interface designer Mike Stenhouse gave a talk from the perspective of a designer/front end developer having to know more about development, getting more involved in agile development, test-driven, even behaviour-driven development.</p>
<p>Designers understanding more software development processes, getting involved in it – not just throwing templates over the proverbial fence – would help communicate the importance of the “lowly” client side technologies.</p>
<p>At the same time, mid-tier developers get a chance to explain concerns such as architecture, OO, patterns, frameworks etc. This common understanding, even though they need not have to be experts on the other area, would allow them to be more productive.</p>
<p>Of course, Mike Stenhouse’s point isn’t unique to an XSLT-based approach (in fact, I think he was talking about Java or PHP). But one possible advantage an XSLT-based approach may have here is that it might be simpler to learn (controversial statement, maybe!) than some of the framework languages, such as Java, C#, PHP, etc. Where this is the case, XSLT can be a useful way to help bridge the gap.</p>
<h4 id="toc-coding-productivity">Coding productivity</h4>
<p>Using something like ASP.NET controls and simply dropping them onto a canvas seems really productive at first. I was certainly excited back in 2000/2001 as information about ASP.NET started to come out. I remember being really excited about the date control that ASP.NET had demoed years ago! Such a time saver – or so it seemed.</p>
<p>However, if you factor in the time you often need to sort out the mucky markup output, make things accessible, CSS-friendlier, and so on, the overall time, in my experience doesn’t seem that much better (in some cases worse, some cases better) than an XSLT-driven approach.</p>
<p>If you know the output you need to create, I find writing XSLT to be more liberating as you are in full control of your output destiny!</p>
<p>The switch I described earlier from ASP based XSLT-driven site to an PHP based XSLT-driven was also a switch from Windows/IIS to Linux/Apache (I was finally fed up of IIS’s limited configurability, in a hosted environment).</p>
<p>In just two weeks, a site with about 700 pages was converted, fully tested, and up and running again on a new hosting company. There was virtually no XSLT change, and the design pattern (a kind of Page Controller pattern which I might change slightly to MVC if time allows) was just reapplied to PHP. PHP 5’s object oriented capabilities meant further reduction in server side code. (Come to think of it, it wasn’t two weeks – it was a LOT less, as it was just spare time during some of the evenings.)</p>
<p>For work, most of our customers (one of them being amongst the largest in the world in their industry) use .NET. We often by-pass ASP.NET controls and use XSLT to generate the output instead. C#/.NET are still used on the server side, as .NET itself is quite powerful.</p>
<p>For the generation of the UI, XSLT has allowed us to even create multiple web sites simultaneously, as all the XSLTs can be reused. Where creating a separate sub-site in the past has take 6 months or more, our move to the XSLT-based approach has meant it has taken a fraction of that time (and included SEO, accessibility, web standards, etc.).</p>
<p>As another recent example: For my current project, a colleague (an excellent developer in general, though not well-versed in web-standards, yet) is creating a functionally rich and powerful page as part of the overall app we are developing. It has a complex grid of tabular data, with a folder/tree type browser on the side with lots of dynamic stuff possible on that page. Some controls created by a vendor for ASP.NET 2.0 are being used. While they are rich in functionality, the page produces just under 1MB of output!!!</p>
<p>The output from these controls are plagued with excess divs and unnecessary table-based layout (tables for tabular data of course is fine). Styling some of the specific features also becomes tricky (because the markup created is not very good and can&#8217;t be changed).</p>
<p>In addition, on a gut feel, the amount of C# used to prepare the data to bind it to the grid-based controls seems excessive. In the output, there is a lot of unnecessary (and bloated) JavaScript needed to get it to behave as needed, too.</p>
<p>This also (currently) runs like a dog on IE 6 because of all that JavaScript and HTML bloat! I have spent a total of 15 <em>days</em> just trying to get the resizer/splitter control that contains the table and tree to resize properly by battling its JavaScript (to be fair, during that time in the summer, I discovered the excellent <a href="http://jquery.com/">jQuery</a>, which helped reduce that effort considerably but I was still using jQuery to do unnecessary stuff)!</p>
<p>In my own opinion, it would have been much more efficient to have written the whole thing with XSLT and use high quality client-side components from people like jQuery, YUI, Dojo, etc. The trees and tabular data on that page are really well suited for XSLT processing. To be fair, the guy writing the page isn’t as well versed in XSLT/web development but an experienced GUI developer, so the control approach makes perfect sense for him and he has certainly made me appreciate that approach more than I used to. (I do still feel that the amount of code needed feels excessive and the experience so far has strengthened my view that while ASP.NET is powerful on the server side, I prefer to use XSLT to create the markup, where possible.)</p>
<h3 id="toc-drawbacks-or-perceived-drawbacks-to-the-xslt-approach">Drawbacks (or perceived drawbacks) to the XSLT approach</h3>
<p>XSLT is certainly not to everyone’s liking. The right tools may not be there in the favored IDE, or it may just look too weird for some people (it is more like functional programming than procedural or object oriented, so can sometimes take a while to get used to). Here are the disadvantages of XSLT I can think of, and where I can, some ways to overcome those problems.</p>
<h4 id="toc-not-everyone-likes-xslt">Not everyone likes XSLT!</h4>
<p>Many who are used to OO or procedural programming may find this functional programming language strange to get around. Angle bracket coding isn’t to everyone’s taste! And these personal preferences can be important for a team/project. Initially I didn’t find it too intuitive, but after a few days with it, it grew on me.</p>
<p>(And I certainly don&#8217;t hold the position that one must only use XSLT. Different people will prefer different technologies, and are of course free to use them.)</p>
<h4 id="toc-yet-another-technology-to-learn">Yet another technology to learn</h4>
<p>I kind of appreciate this concern, but also in some ways do not. For example, XQuery, or the more generic and powerful LINQ from Microsoft, get many developers excited, and they are willing to learn those if needed. People will invest time in learning CSS, JavaScript, etc.</p>
<p>So, perhaps it could be argued that just like any other technology, <em>if</em> XSLT is determined to be appropriate for the project at hand, then that can be learned too.</p>
<h4 id="toc-xslt-10-is-verbose-and-weakly-typed">XSLT 1.0 is Verbose and Weakly Typed</h4>
<p>Some simple things in XSLT 1.0 are a bit verbose to code (though <a href="http://www.onenaught.com/posts/23/xslt-tips-for-cleaner-code-and-better-performance">XSLT 1.0 can often be written more cleanly</a> than what many people write).</p>
<p>XSLT (and XPath) are indeed weak on typing — at least 1.0, though given the nature and purpose of XSLT this is not too limiting a factor as it would be if this were a full-blown language. (Some popular languages for the web are also weakly typed, too, e.g. PHP and JavaScript and the “limited” typing can also result in many capabilities, depending how they are used.)</p>
<p><a href="http://www.xml.com/pub/a/2007/07/12/xquery-and-data-abstraction.html">XSLT 2.0 and XPath 2.0 are more powerful</a> and overcome many of these limitations, adding many more powerful capabilities, allowing for leaner code and improved performance.</p>
<p>However, while XSLT 2.0 is an open standard, many have not supported it. (Microsoft, for example, has a decent implementation of XSLT 1.0 in .NET — and MSXML — but has hinted that <a href="http://blogs.msdn.com/xmlteam/archive/2007/11/16/chris-lovett-interview.aspx">XSLT 2.0 is not a priority for .NET at the moment</a> — see also <a href="http://www.oreillynet.com/xml/blog/2007/11/question_is_microsoft_working_1.html">this discussion</a> for more information.)</p>
<h4 id="toc-xslt-is-a-limited-language">XSLT is a limited language</h4>
<p>In a way, if compared to more general purpose languages such as Java or C#, XSLT (especially 1.0) is very limited in what you do.</p>
<p>That can be off-putting straight away.</p>
<p>However, (using extension objects etc aside), the simplicity of the language can also be considered a strength; it may help architect a better separation of data, presentation and logic. I personally have not felt too much pain from its limitation.</p>
<h4 id="toc-poor-tool-support-compared-to-other-languages">Poor Tool Support Compared to Other Languages?</h4>
<p>Tool support for XSLT does not seem as good as ones for say C# or Java.</p>
<p>With C#, both Visual Studio in-built refactoring or JetBrain’s excellent Resharper makes refactoring a lot easier. Same with Eclipse and other such IDEs for Java and various other languages.</p>
<p>Need to rename a class that is used throughout your super-massive project? No problem, just right-click the definition and rename; the IDE will correctly update everything for you. Want to implement missing implementations of an interface? Right-click and get it to fill out the missing implementations. Want to move a block of code into a separate method? Highlight it, right click and select an option to extract a method. Want to find all the places where a particular method is used? Right click it and select find all instances. And so on.</p>
<p>In addition, many IDEs and plugins for code assistance goes beyond &#8220;intellisense&#8221;, advising on good coding practices, code formatting, etc. This is immensely powerful, especially when establishing team standards.</p>
<p>With XSLT, however, the level of sophistication is not as high, as far as I am aware. For example, finding instances of where a given XSLT template is used seems limited. The best editor I have come across for this purpose is oXygen (let me know if there are better ones!). It is has various refactoring and finding capabilities, but finds don’t support searches for XSLT template modes. (I find using moded templates is generally a cleaner way to code many XSLT.)</p>
<p>A developer is therefore reduced to global finds within their text editor of choice. To be honest, I don’t particularly find this a problem, but I know that some developers, especially when used to using tools like JetBrain’s excellent refactoring tools, will find this backward, and I can’t blame them!</p>
<p>Many IDE vendors, such as Microsoft, don’t have their priorities on XSLT. While somewhat understandable, it does contribute to the chicken-egg situation:</p>
<ul>
<li>IDE tools are not as good for XSLT;</li>
<li>XSLT therefore not as widely adopted in that sphere of development;</li>
<li>IDE tools remain limited for XSLT;</li>
<li>XSLT development seen as backward from an IDE/tool support perspective so usually not looked at.</li>
</ul>
<p>As to what IDEs/tools/editors are useful:</p>
<ul>
<li>A number of people at work like to use <a href="http://www.altova.com/">XML Spy</a> for XSLT development, though I personally don’t like it’s text editor.</li>
<li>I tend to use <a href="http://www.jedit.org/">jEdit</a>, which is a Java-based IDE, so I have used it on Linux, PC and Mac, quite nicely (it is hideous to look at initially, and I have spent a long time customising it! I will explain that in some future blog post!).</li>
<li><a href="http://www.eclipse.org/">Eclipse</a> and the <a href="http://www.aptana.com/">Aptana</a> plugin looks really useful, and I am beginning to look at that more.</li>
<li>Many people also swear by <a href="http://www.oxygenxml.com/">oXygen</a>, so I am looking at that a bit more, too.</li>
<li>But, for my current project, for the past year, at work I have been content with using Visual Studio 2005 (and now 2008) for XSLT. It has an XSLT debugger (and recently a profiler) but I have not needed to use the XSLT debugger yet, so can&#8217;t comment on it.</li>
</ul>
<p>If you know of any other useful XSLT tools, please comment so!</p>
<h4 id="toc-refactoring-in-a-mixed-language-environment-can-be-problematic">Refactoring in a mixed language environment can be problematic</h4>
<p>Suppose you have an XSLT that transforms some XML which comes from a Java or C# serialized object.</p>
<p>If you modify that object in a simple way (rename the class or a public member), in IDEs such as Visual Studio and Eclipse, you can very quickly update all usages of your class/method throughout your project and unit tests, and you are done.</p>
<p>But, imagine you are renaming class members that get serialized in such a way that the name of that class member is the name of the element/attribute in the XML representation. IDEs aren’t going to easily know that and you are likely to have to manually update the XSLTs.</p>
<p>Unit Tested XSLTs may help to some extent to find where changes are needed, but it may still be more work than just working in C# or Java.</p>
<h4 id="toc-getting-data-as-xml-may-not-be-practical">Getting data as XML may not be practical</h4>
<p>Using XSLT assumes you can easily (or without much cost) get your data in XML format, so you can transform it. This may not be possible in many cases.</p>
<p>In many instances, with in-built XML serialization capabilities, such costs are often minimized or minimal. (You are often doing well if this is your biggest problem in your overall system architecture!)</p>
<p>Even if serialization is not possible, XSLT performance can benefit from well structured XML. Is it easy to create that structure from your object model? Depends on the project at hand.</p>
<h4 id="toc-perceived-performance-concerns">Perceived Performance Concerns</h4>
<p>A common question I often get in discussions of XSLT is concerns of performance.</p>
<p>XSLT performance, amongst other things, is also affected by:</p>
<ul>
<li>The XML being transformed – its structure, size, etc.</li>
<li>The efficiency of the XPath expressions (e.g. using ‘//’ or invoking dynamic scripting languages from within XSLT can be performance killers).</li>
<li>XSLT itself (e.g. loading, interpreting and executing XSLT in general, whether or not the XSLT Processor is compiled/cached/reused or not, etc.)</li>
</ul>
<p>As well as addressing the XML and XPath concerns, the XSLT performance concern can also be addressed in many cases.</p>
<p>Using cachable XSLT Processor implementations can dramatically boost performance. (Kind of like XSLT being compiled into the native code, like Java bytecode or .NET IL, etc. and then caching them in memory across sessions, for subsequent reuse). We use this approach on one of UK’s most profitable and biggest online retail web sites, for example.</p>
<p>Also, as a high level language, XSLT has potential to be optimized further at the implementation level resulting in better performance without changes needed to the XSLT itself.</p>
<p>(Extensibility through XSLT extension objects may offer some performance gains if you write extension objects in a compiled language such as Java or C#. A risk may be that you lose some portability — though how much that is a risk depends on your circumstances.) </p>
<h4 id="toc-it-implies-error-prone-xml-based-templates">It implies error-prone XML-based templates</h4>
<p>Consider this concern from Django&#8217;s design philosophies behind its templating system:</p>
<blockquote cite="http://www.djangoproject.com/documentation/design_philosophies/"><p>
<strong>XML should not be used for template languages</strong></p>
<p>Using an XML engine to parse templates introduces a whole new world of human error in editing templates — and incurs an unacceptable level of overhead in template processing.</p>
<p class="source">&#8211; <cite><a href="http://www.djangoproject.com/documentation/design_philosophies/">Design philosophies</a>, Django, last accessed January 4, 2008</cite></p>
</blockquote>
<p>While the above is not specifically geared towards XSLT, human error is certainly an issue with XML-based templates, or XSLT-authoring.</p>
<p>That error, if it comes at template creation time, is typically caught during the development/debug/test cycles, as malformed XML will error early.</p>
<p>Of course, if content comes from external sources (user generated, from third parties, etc) the well-formedness of that XML cannot be guaranteed. However, these are usually not likely to be within the template itself. It may or may not be possible to cleanse such data, depending on the project.</p>
<p>In addition, as addressed earlier, I do not believe the overhead of template processing is that bad. Cached XSLT processors, as well as other caching strategies can help, for example.</p>
<p>A colleague of mine found an ASP.NET data grid control taking some 2 minutes to bind and render a standard .NET dataset. He changed that into an XSLT transformation instead and the data transformed in around 20 seconds &#8212; clearly an exceptional case compared to most web needs (2 minutes <em>or</em> 20 seconds implies a LOT of data), but XSLT is not automatically slow.</p>
<p>In addition, depending on the application, the generation of the XML may come entirely through serialization of objects, which in languages such as Java and .NET (not sure about python, which Django is in) is reasonably fast.</p>
<p>In a current project I serialize a very large object (about 200K when saved as XML) and transform it into HTML. The HTML is a very complex form of over 300 form fields! (Fear not, we use a tab-like interface and various other techniques to group them!) Using the cached XSLT Processors on my developer box, the transformation takes just 5-10 milliseconds. The far bigger cost is getting the data from the database in the first place (about 50 to 120 milliseconds, but that is on a developer database on the same box as the rest of the stack). The serialization takes about 5 milliseconds. Even when the XSLT processor is not cached, the transformation times are very small (I think about 150-300 milliseconds depending on the data).</p>
<p>That same design philosophy&#8217;s very next point was that you should</p>
<blockquote cite="http://www.djangoproject.com/documentation/design_philosophies/"><p>
<strong>Assume designer competence</strong></p>
<p>The template system shouldn’t be designed so that templates necessarily are displayed nicely in WYSIWYG editors such as Dreamweaver. That is too severe of a limitation and wouldn’t allow the syntax to be as nice as it is. Django expects template authors are comfortable editing HTML directly.</p>
<p class="source">&#8211; <cite><a href="http://www.djangoproject.com/documentation/design_philosophies/">Design philosophies</a>, Django, last accessed January 4, 2008</cite></p>
</blockquote>
<p>I would tend to agree with the bit about assuming designer competence, which is actually why I find XML for templates are not as bad as it may initially seem.</p>
<p>As I mentioned earlier, in my experience, when trying to hire front end developers, we have found they are quite capable at adopting XSLT.</p>
<p>It is not that Django&#8217;s is wrong in my opinion; I am sure there are many for whom XML-based templates are not appropriate. My point here is that there are also many for whom XSLT will be seen as appropriate, too.</p>
<p>(And this is not a criticism of Django, either. I have only looked at it very, very, very briefly and am already impressed with it!)</p>
<h4 id="toc-coding-productivity-is-perceived-to-be-poor-hand-writing-all-that-code-seems-inefficient">Coding Productivity is Perceived to be Poor; Hand writing all that code seems inefficient</h4>
<p>A common concern I hear (usually from middle-tier developers who want to avoid writing HTML) is that it is inefficient to hand write all that code. I can certainly understand their concerns; it is something I shared when I used to do more middle-tier development than front-end.</p>
<p>However, I actually find the opposite can be true: After using it for many years, a few colleagues of mine and I find it is far more productive creating web sites this way, because we know what we need to output, and we don’t spend ages battling tools that generate HTML to make them do stuff they don’t easily want to. We also help minimize, or completely avoid the excessive bloat that many tools create.</p>
<p>In addition, past experiences suggest that many of our XSLT projects seem to have less code than would be needed in say a C#/ASP.NET template (like the tree/grid example mentioned earlier).</p>
<h4 id="toc-unlikely-to-get-vendor-buy-in-if-they-have-vested-interest-in-other-ways">Unlikely to get vendor buy-in if they have vested interest in other ways</h4>
<p>Vendor buy-in may be limited if there is an inherent interest in vendor lock-in.</p>
<p>This is a mixed one too. Take .NET for example. Microsoft is unlikely to do away with its control-based approach and cause more upheaval to its target developer audience by doing this. It also reduces the dependency on Microsoft!</p>
<p>I would think that <em>if</em> this XSLT idea has any large-scale merit, open source platforms/frameworks are more likely to adopt it, though that is not necessarily a given, either.</p>
<h4 id="toc-xslt-for-web-based-views-hasnt-taken-off-yet-so-it-must-be-a-bad-choice">XSLT for web-based Views hasn’t taken off yet, so it must be a bad choice</h4>
<p>I think this point can have merit. However, I think there may be a number of different reasons why XSLT has not taken off.</p>
<p>For example, it may not have been appropriate in the past because XSLT tools were not as mature. While the XSLT tools were maturing, other technologies came through.</p>
<p>In addition, not all data is always easy to represent as, or convert into, XML, and the tools built into languages these days such as serialization may not have been around sufficiently in the past.</p>
<p>But the chicken-egg scenario mentioned above about IDEs not supporting XSLT as much so XSLT not getting as much traction in this area, could also be a factor. And, as hinted above, some vendors may have interests in promoting their own ways of doing things as an open standard may make it easier for someone to move to another platform, if needed.</p>
<p>Of course, developers not liking the language may also be a factor. (It seems to be quite big in the Java world, from what I can tell, though I don’t have much hands-on experience with Java these days – if anyone has some more insights here, please let me know!)</p>
<p>We have used this XSLT approach very successfully on a number of projects, one of which is one of the most prominent online retail web sites in the UK, if not the world. We haven’t really had a chance to write about it. Maybe there are some (many?) others who have also not had a chance to write about similar approaches? The BBC, I understand from some colleagues/friends that have worked there in the past, use it but in a more off-line scenario to pre-generate certain pages/sub-sites. So it can’t be all bad!</p>
<p>In addition, valid (or invalid) reasons to reject it in the past do not always automatically apply in for now or the future, especially in a dynamically changing environment such as the Internet. Times and technology change, so maybe it is at least worth re-validating (not adopting blindly of course!).</p>
<h3 id="toc-in-conclusion">In conclusion</h3>
<p>Despite the concerns, or perceived concerns, I feel the potential advantages make it worth considering.</p>
<p>There are certainly XSLT-based frameworks out there, though not as popular. (<a href="http://cocoon.apache.org/2.1/">Apache&#8217;s Cocoon project</a> comes to mind, for example.)</p>
<p>I would think that just as advocates of web standards have pushed hard to get open standards adopted for client side web development, maybe there is a case for XSLT on the server side to aide in that process.</p>
<p>But it also depends on personalities, priorities, and specific requirements, too. Some people really don&#8217;t like XML-based things, which is fair enough as sometimes there are legitimate reasons for it.</p>
<p>Others may not be convinced by the need for controlling markup, thinking it is unimportant or that their favourite vendor will sort it all out for them!</p>
<p>I am not arguing that XSLT should be the only way of doing things. I think it can be useful in many situations, and I have certainly found it to be so. Following the ideas of using web standards on the client side, using XSLT on the server side (at least for the generation of output) appeals to me too. What I therefore hope to do in coming posts is demonstrate some possibilities.</p>
<h3 id="toc-some-examples">Some examples</h3>
<p>To explore this further, as this post is already quite long, in the next few days or weeks (whenever I get the time!) I will add posts to demonstrate</p>
<ul>
<li>Unit testable XSLT </li>
<li>“Object-oriented” XSLT </li>
<li>XSLT as the View part of MVC, or as part of a Page Controller pattern.</li>
</ul>
<p>[You might, rightly, wonder why this is a WordPress blog, and not something I have written using say PHP with XSLT! Fair, but lack of spare time is the main problem: It has taken me two years just to get round to starting this blog! One day I will convert, time allowing!]</p>
<p>In the meanwhile, if you have got this far, thanks for bearing with me!</p>
<p>Do you have similar concerns, or agree/disagree?</p>
<h3 id="toc-image-credits">Image credits</h3>
<p>&#8220;XSL Transformers&#8221; reposted with kind permission from <a href="http://www.flickr.com/photos/nagradim/">NaGraDim</a> from flickr. See the original image at <a href="http://www.flickr.com/photos/nagradim/750087828/">http://www.flickr.com/photos/nagradim/750087828/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/8/xslt-in-server-side-web-frameworks/feed</wfw:commentRss>
		</item>
		<item>
		<title>XSLT Profilers</title>
		<link>http://www.onenaught.com/posts/56/xslt-profilers</link>
		<comments>http://www.onenaught.com/posts/56/xslt-profilers#comments</comments>
		<pubDate>Sat, 16 Feb 2008 17:47:56 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[XSLT]]></category>

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/56/xslt-profilers</guid>
		<description><![CDATA[<img src='http://www.onenaught.com/wp-content/uploads/stopwatch.jpg' alt='' class="post-img" align="left" /> A couple of XSLT profilers have recently been announced.

One by Microsoft, and one by PHP for the up-coming PHP 5.3.

The PHP one is interesting as it can be invoked from within your PHP code thus profiling actual run time XSLTs.]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.onenaught.com/wp-content/uploads/stopwatch.jpg' alt='' class="post-img" align="left" /><a href="http://blogs.msdn.com/xmlteam/archive/2008/02/07/announcing-the-xslt-profiler-addin-for-vs-2008.aspx">Microsoft recently announced an XSLT profiler for Visual Studio 2008</a>. (I have used it briefly and it seems quite good.)</p>
<p><a href="http://www.onenaught.com/posts/54/php-53-gets-a-bit-more-object-oriented-and-more">PHP recently announced PHP 5.3 which will include an XSLT profiler</a> that can be invoked from within code. Current versions of PHP and the Microsoft one can invoke an XSLT profiler through the command line or against static XML/XSL files only, so being able to call it from within code is quite useful.</p>
<p>The run time invocation is really useful because if you are passing parameters into the XSLT or are generating the XML through DOM programmatically it is easier to profile. Otherwise, you need to capture the XML generated and save it, then invoke a profiler separately from the command line.</p>
<p>An example of calling it from within PHP is this (taken from a SitePoint article explaining the new features &#8212; see previous link):</p>
<p><span id="more-56"></span></p>
<pre><code>$doc = new DOMDocument();
$xsl = new XSLTProcessor();

$doc->load('./lib/collection.xsl');
$xsl->importStyleSheet($doc);

$doc->load('./lib/collection.xml');
$xsl->setProfiling("/tmp/xslt-profiling.txt");
echo $xsl->transformToXML($doc);

echo '&lt;h2&gt;Profile report&lt;/h2&gt;';
echo '&lt;pre&gt;' . file_get_contents( '/tmp/xslt-profiling.txt' ) . '&lt;/pre&gt;';
</code></pre>
<h3 id="toc-are-there-other-profilers-out-there-you-recommend">Are there other profilers out there you recommend?</h3>
<p>The profilers in <a href="http://www.oxygenxml.com/xslt_debugger.html">oXygen</a> and <a href="http://www.altova.com/products/xmlspy/xslt_profiler.html">XML Spy</a> look quite useful too (not used them, though heard about them).</p>
<p>I have not used XSLT profilers extensively. Just once in a blue moon. Some of the <a href="http://www.onenaught.com/posts/23/xslt-tips-for-cleaner-code-and-better-performance">XSLT performance tips</a> I have written earlier seems to have served me well, thus far, but I think more regular use of these profilers will be important.</p>
<p>Have you used other profilers for XSLT? What are they like?</p>
<p>Have you used other profilers that you can invoke from your code, rather than from an IDE or command line?</p>
<p>Do you find that to be useful or in the end is it just as easy to capture the XML and run the profiler in the IDE (which usually has a more powerful GUI to splice and dice the profile data)?</p>
<h3 id="toc-what-about-xslt-code-coverage">What about XSLT code coverage?</h3>
<p>Is anyone aware of any good XSLT code coverage tools?</p>
<p>The reason this is important is that as well as getting good performance, it is important to know if you are exercising all your XSLT code or not.</p>
<p>This would be particularly useful when integrated with unit-tested XSLTs (which I will be writing about shortly!).</p>
<h3 id="toc-image-credits">Image credits</h3>
<p>&#8220;Stopwatch&#8221; by <a href="http://www.flickr.com/photos/jamieriddell/">jamieriddell</a> from flickr. See the original image at <a href="http://www.flickr.com/photos/jamieriddell/2183060366/">http://www.flickr.com/photos/jamieriddell/2183060366/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/56/xslt-profilers/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP 5.3 Gets A Bit More Object Oriented And More</title>
		<link>http://www.onenaught.com/posts/54/php-53-gets-a-bit-more-object-oriented-and-more</link>
		<comments>http://www.onenaught.com/posts/54/php-53-gets-a-bit-more-object-oriented-and-more#comments</comments>
		<pubDate>Sat, 16 Feb 2008 14:54:16 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[OOP]]></category>

		<category><![CDATA[Server Side]]></category>

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/54/php-53-gets-a-bit-more-object-oriented-and-more</guid>
		<description><![CDATA[<img src='http://www.onenaught.com/wp-content/uploads/php.png' alt="" class="post-img" align="left" /> PHP 5 in general has been a good improvement over PHP 4, but those used to full blown object oriented program languages such as Java or C# may find some OO features still lacking in PHP 5.

PHP 5 has the usual things, such as classes, interfaces, abstract classes, inheritance, etc, but some useful programming constructs have been missing, though PHP 6, under development, aims to rectify that.

However, it seems that many of those features are going to be brought forward to the up-coming PHP 5.3 (which may make it more likely that it will get installed by web hosting companies sooner than they would likely go for PHP 6).

<a href="http://www.sitepoint.com/article/whats-new-php-5-3/2" title="What's new in PHP 5.3?, Sitepoint, February 13, 2008">Sitepoint has an excellent summary of the features</a>. The list of features include:]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.onenaught.com/wp-content/uploads/php.png' alt="" class="post-img" align="left" /> PHP 5 in general has been a good improvement over PHP 4, but those used to full blown object oriented program languages such as Java or C# may find some OO features still lacking in PHP 5.</p>
<p>PHP 5 has the usual things, such as classes, interfaces, abstract classes, inheritance, etc, but some useful programming constructs have been missing, though PHP 6, under development, aims to rectify that.</p>
<p>However, it seems that many of those features are going to be brought forward to the up-coming PHP 5.3 (which may make it more likely that it will get installed by web hosting companies sooner than they would likely go for PHP 6).</p>
<p><a href="http://www.sitepoint.com/article/whats-new-php-5-3/2" title="What's new in PHP 5.3?, Sitepoint, February 13, 2008">Sitepoint has an excellent summary of the features</a>. The list of features include:</p>
<p><span id="more-54"></span></p>
<ul>
<li>Namespaces</li>
<li>The <code>use</code> keyword to use namespaces!</li>
<li>Namespace aliases</li>
<li>Class constants</li>
<li>Namespaced functions</li>
<li>The Global namespace</li>
<li>Autoloading namespaced classes</li>
<li>Late static binding</li>
<li>Variable static calls</li>
<li>MySQL native driver</li>
<li>Additional OpenSSL functions</li>
<li>Improved command line parameter support</li>
<li>XSLT profiling</li>
<li>New Error Levels</li>
<li>and more&#8230;</li>
</ul>
<p>But visit the <a href="http://www.sitepoint.com/article/whats-new-php-5-3/2" title="What's new in PHP 5.3?, Sitepoint, February 13, 2008">sitepoint article</a> for more details.</p>
<p>If you want, there are <a href="http://snaps.php.net/">PHP snapshot builds of PHP 5.3 (and 6.0)</a>.</p>
<p>(Those of you that have never coded in PHP may be surprised to see some of these features only surface now, yet, PHP has still managed to drive some of the biggest web sites out there&#8230;! I have only used it for about a year myself, in spare time, but it seems quite powerful even without these things. Can&#8217;t knock it <em>too</em> much then, I guess <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>The native MySQL driver will be a good boost for performance, and I will be looking forward to the XSLT profiling in code, while namespaces will be an obvious winner too.</p>
<p>But a lot of PHP programmers are often using it for small scripts and may not often need or want the full power of an OO language. Personally, I prefer OO, so am looking forward to this. Do you use PHP? If so, do you prefer the OO approach and like what is coming?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/54/php-53-gets-a-bit-more-object-oriented-and-more/feed</wfw:commentRss>
		</item>
		<item>
		<title>IE8 - meta switch = IE7!?</title>
		<link>http://www.onenaught.com/posts/52/ie8-meta-switch-ie7</link>
		<comments>http://www.onenaught.com/posts/52/ie8-meta-switch-ie7#comments</comments>
		<pubDate>Sat, 09 Feb 2008 14:52:16 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[Browsers]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/52/ie8-meta-switch-ie7</guid>
		<description><![CDATA[<img class="post-img" align="left" src="/wp-content/uploads/ie8-preview-acid2-sad.png" alt="Microsoft's announcement of a switch for proper standards mode in IE8 makes that browser passing acid2 test less useful than initially seemed!" /> So Microsoft announced a way to support standards without "breaking the web."

The challenge they had was to find a way to “enable (and encourage) interoperable web development, but don’t force IE to break pages that work properly in IE today.”

They eventually settled for a &#60;meta&#62;-based “opt-in to the browser version I tested with” strategy.

What this means is that if you as a web developer want IE 8 to render according to their best implementation of standards then you opt in by adding a particular meta element into your HTML (or send down a similar HTTP header in the response).

In other words, for web developers trying to do the right thing they must pay a small "don't-break-the-IE-web tax!"

Many prominent web developers and designers have been highly critical of this. But, ironically, is this actually a positive thing in the long run?]]></description>
			<content:encoded><![CDATA[<p><img class="post-img" align="left" src="http://www.onenaught.com/wp-content/uploads/ie8-preview-acid2-sad.png" alt="Microsoft's announcement of a switch for proper standards mode in IE8 makes that browser passing acid2 test less useful than initially seemed!" /> So Microsoft announced a way to support standards without &#8220;breaking the web.&#8221;</p>
<p>The challenge they had was to find a way to “enable (and encourage) interoperable web development, but don’t force IE to break pages that work properly in IE today.”</p>
<p>They eventually settled for a <a href="http://blogs.msdn.com/ie/archive/2008/01/21/compatibility-and-ie8.aspx">&lt;meta&gt;-based “opt-in to the browser version I tested with” strategy</a>.</p>
<p>What this means is that if you as a web developer want IE 8 to render according to their best implementation of standards then you opt in by adding a particular meta element into your HTML (or send down a similar HTTP header in the response). This is explained in an <a href="http://alistapart.com/issues/251">article</a> in <cite>A List Apart</cite>.</p>
<p>In other words, for web developers trying to do the right thing they must pay a small &#8220;don&#8217;t-break-IE-web tax!&#8221;</p>
<p>Many prominent web developers and designers have been highly critical of this. But, ironically, will this actually be a positive thing in the long run?</p>
<p><span id="more-52"></span></p>
<h3 id="toc-dont-break-the-best-viewed-in-ie-web">Don&#8217;t break the Best-viewed-in-IE web</h3>
<p>The IE team described their attempt as a &#8220;don&#8217;t break the web&#8221; approach. Judging by many reactions, it feels they are actually breaking the principles of web development.</p>
<p>And, in their own words they don&#8217;t want to &#8220;force IE to break pages that work properly in IE today.&#8221; In effect they are asking web standards developers to help them out so they don&#8217;t have to go and fix all their problems resulting from the <a href="http://www.onenaught.com/posts/44/microsofts-internet-explorer-slows-down-web-development">IE-driven web which has slowed down web development and contributed to this current problem</a>. (That is probably a bit harsh, as I can certainly understand Microsoft would be unable to fix all the issues in the various places where IE is used! More on that below.)</p>
<p>The lead of the IE team, <a href="http://ejohn.org/blog/html5-shiv/#comment-296949">Chris Wilson, seems to admit this meta switch is a hack</a> but given a difficult situation for Microsoft, trying to support both standards and non-standards developers, this might be the best way to go about it.</p>
<p>So other browser vendors were encouraged to adopt this idea too. However, the guys working on WebKit (the rendering engine behind Safari) felt that,</p>
<blockquote cite="http://webkit.org/blog/155/versioning-compatibility-and-standards/"><p>
We don’t see a great need to implement version targeting in Safari. We think maintaining multiple versions of the engine would have many downsides for us and little upside. The IE team is, of course, under different constraints and free to make their own choices.</p>
<p class="source">&#8211; <cite>Maciej Stachowiak, <a href="http://webkit.org/blog/155/versioning-compatibility-and-standards/">Versioning, Compatibility and Standards</a>, January 22nd, 2008</cite></p>
</blockquote>
<p>John Resig (author of the excellent jQuery JavaScript framework and an employee of Mozilla), also takes issue with</p>
<blockquote cite="http://ejohn.org/blog/meta-madness/"><p>
having this be portrayed as a general-purpose solution for all browsers, when it&#8217;s really just a solution to Internet Explorer&#8217;s situation. That&#8217;s not necessarily a bad thing. I completely commiserate with [IE's] situation and don&#8217;t envy it at all. It may very well be that this new meta tag addition is the only viable solution - and that&#8217;s fine. However showing it as something that is a universal issue to all browsers is definitely not the case.</p>
<p class="source">&#8211; <cite>John Resig, <a href="http://ejohn.org/blog/meta-madness/">Meta Madness</a>, January 22nd, 2008</cite></p>
</blockquote>
<p>Resig also made an important point about how this decision was arrived at:</p>
<blockquote cite="http://ejohn.org/blog/meta-madness/"><p>
On a whole, I really wish that this process had been done more in the open than it was. I doubt that as many issues, that we&#8217;re seeing now, would&#8217;ve arrived. I absolutely don&#8217;t envy Internet Explorer&#8217;s situation in the matter so, for the sake of the web, let&#8217;s hope they come up with an acceptable solution.</p>
<p class="source">&#8211; <cite>John Resig, <a href="http://ejohn.org/blog/meta-madness/">Meta Madness</a>, January 22nd, 2008</cite></p>
</blockquote>
<p>Ian Hixie, lead member of the WHATWG (the guys that started defining HTML5), and Google employee, was concerned that browsers would have to implement it, like it or not:</p>
<blockquote cite="http://ln.hixie.ch/?start=1201080691&amp;count=1">
<p>If Web authors actually use this feature, and if IE doesn&#8217;t keep losing market share, then eventually this will cause serious problems for IE&#8217;s competitors — instead of just having to contend with reverse-engineering IE&#8217;s quirks mode and making the specs compatible with IE&#8217;s standards mode, the other browser vendors are going to have to reverse engineer every major IE browser version, and end up implementing these same bug modes themselves. It might actually be quite an effective way of dramatically increasing the costs of entering or competing in the browser market. (This is what we call &#8220;anti-competitive&#8221;, or &#8220;evil&#8221;.)</p>
<p>It will also increase the complexity of authoring by an order of magnitude. Big sites will become locked in to particular IE version numbers, unable to upgrade their content for fear of it breaking. Imagine in 18 years — only twice the current lifetime of the Web! — designers will not have to learn just HTML, they&#8217;ll have to learn 4, 5, maybe 10 different versions of HTML, DOM, CSS, and JS, just to be able to maintain the various different pages that people have written, as they move from job to job.</p>
<p class="source">&#8211; <cite>Ian Hixie, <a href="http://ln.hixie.ch/?start=1201080691&amp;count=1">Mistakes, Sadness, Regret</a>, January 23, 2008</cite></p>
</blockquote>
<p>Chris Heilmann, a lead web developer at Yahoo suggests that <a href="http://www.wait-till-i.com/2008/01/24/ie8-would-somebody-please-think-of-the-childrenthe-broken-web/">maybe now is the time to try and mend the broken web</a>; a large number of sites are now created by CMSs and now might be the time to explain, help, and contribute to fixes. &#8220;As most are built with frameworks and CMS and one of the main selling points of these was that the outcome can be easily changed in the future, how about proving that now?&#8221; A garganutan task it would seem!</p>
<p>(Heilmann also posted a link to this <a href="http://www.katemonkey.co.uk/article/48/x-ua-lemur-compatible">hilarious explanation of how this meta-switch problem has come about</a>.)</p>
<h3 id="toc-microsoft-is-in-a-difficult-situation">Microsoft is in a difficult situation</h3>
<p>Resig noted above Microsoft&#8217;s situation is not something to take lightly.</p>
<p>The following is perhaps one of the <a href="http://www.isolani.co.uk/blog/standards/InternetExplorerReality">best articles I have read trying to explain Microsoft&#8217;s predicament</a>. It is not by a Microsoft employee, but a lead web developer at Yahoo! (and way before the Microsoft buy-out bid!!). Here is a lengthy quote:</p>
<blockquote cite="http://www.isolani.co.uk/blog/standards/InternetExplorerReality"><p>
[Don't just consider webservers,] but &#8230; other forms of distributing HTML content. How easy is it going to be to configure a webserver, or add a meta tag to HTML documentation on CD? It&#8217;s not just a case of editing the HTML and reburning to the CD - what about making sure everyone who has the old CD now has the new one?</p>
<p>Compiled HTML is another source of grief - every <abbr title="Compiled HTML">chm</abbr> ebook ever published relies on an IE renderer library to display its content. That content is authored and then distributed to many people. Again, the HTML editing is simple, but the actual redistribution of the non-broken version is a massive problem.</p>
<p>Consider also the number of Windows applications that use the Internet Explorer rendering engine as a component of the application. All the content and logic for those applications would need to be updated, and the application would need to be re-shipped to all the users of that application.</p>
<p>The point here is that web&#8217;s solution is remarkably simple, it&#8217;s a case of fixing the problem in one place.</p>
<p>&#8230;</p>
<p>Sure, redistribution [for the non-web server-based products that use IE] is just a link to a website to download an update. But every software product, every ebook title, every software documentation would need that redistribution. It&#8217;s not a couple of web pages any more, it&#8217;s the entire Windows platform, the operating system and all applications (including third party software) that would need updating.</p>
<p>&#8230;</p>
<p>This points to a grievous mistake on Microsoft&#8217;s part: integrating the browser (well, the rendering engine) as part of the operating system.</p>
<p>A change in the rendering affects not only web pages, but local documentation, software applications, even so far as the file-system browser Windows Exploring. They all use the Internet Explorer renderer. The moment that renderer fails, or decides not, to render the content it used to render - that is a problem Microsoft want to avoid.</p>
<p class="source">&#8211; <cite>Mike Davies, <a href="http://www.isolani.co.uk/blog/standards/InternetExplorerReality">Internet Explorer Reality</a>, January 27, 2008</cite></p>
</blockquote>
<p>It may have indeed been a mistake of integrating the browser rendering engine, but I wonder if more fundamentally, Microsoft letting IE6 stagnate and not developing it into IE 7 until just a little while ago was a root problem. Maybe continuous, smaller and incremental updates could have let the pain be less than it is now? Hard to tell.</p>
<h3 id="toc-legal-concerns-if-microsoft-breaks-ie">Legal concerns if Microsoft breaks IE?</h3>
<p>It seems that occasionally legal concerns about breaking compatibility with new IE releases comes up as another reason for not being able to move as quickly on standards implementation as ideal. However, <a href="http://shaver.off.net/diary/2008/02/06/suing-and-blockading-for-compatibility/">Mike Shaver (from Mozilla) questions the legal concerns</a>, asking, &#8220;What would be the legal basis for a suit by a customer, given the provisions of typical EULAs which explicitly disclaim pretty much all warranty they can?&#8221;</p>
<p>Comments on Shaver&#8217;s post also notes that changes to their operating systems (XP to Vista for example) and application compatibility problems seem not to raise such solutions, by comparison, despite concerns raised by even the likes of the Korean government and their banks who had to tell their population to delay upgrading to IE7 (because they had developed to IE6).</p>
<p>Shaver is hinting that legal issues may not be a hindrance as much as made out to be (though other practical concerns might still be).</p>
<h3 id="toc-ie8-passing-the-acid2-css-test-wont-matter-for-most-sites">IE8 passing the Acid2 CSS test won&#8217;t matter for most sites</h3>
<p>A little while back, Microsoft announced that some development version of the <a href="http://www.onenaught.com/posts/46/microsofts-internet-explorer-8-to-speed-up-web-development">IE8 code was passing the Acid 2 CSS test</a>.</p>
<p>This led to a lot of praise in web development circles that maybe finally Microsoft was moving forward. But there were those expressing cautious optimism, too.</p>
<p>And the latter are justified; IE8 Acid 2 rendering won&#8217;t matter for the vast majority of sites that are likely not to even know about this new meta switch.</p>
<h3 id="toc-maybe-it-wont-be-too-bad-in-the-long-run">Maybe it won&#8217;t be too bad in the long run?</h3>
<p>Many have opined that maybe IE is getting less significant now and whatever it does won&#8217;t really impact the web that much; it seems to follow these days, rather than lead.</p>
<p>It may be that IE 7 is just about bearable enough that developers can get on with cool things on other browsers while giving half decent support to IE7 (and with the increasingly sophisticated JavaScript frameworks hiding away those IE deficiencies and limitations in most cases, this may make it even easier to bear with!).</p>
<p>On the other hand, Matt Wilcox, a developer who is also on the HTML 5 working group, had a really interesting perspective:</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/956/"><p>
I think the new default of &#8220;stay as IE7 when no meta tag found&#8221; will enhance the uptake of web standards. Because every ignorant developer on earth is now going to be permanently stuck with IE7 rendering and behaviour. They will never get to use any of the new-shiny [features] of IE8 and above if they don’t know to include that meta tag. They won&#8217;t know to include that meta tag until they go away and learn about web standards.</p>
<p class="source">&#8211; <cite>Matt Wilcox, <a href="http://mattwilcox.net/archive/entry/id/956/">Goodbye DOCTYPE switching, hello META targeting</a>, January 22, 2008</cite></p>
</blockquote>
<p>Maybe this particular tax will actually trickle down? Or will it really bad for standards-based web developers?</p>
<h3 id="toc-maybe-none-of-this-actually-matters">Maybe none of this actually matters?</h3>
<p>John Resig, in another post on the <a href="http://ejohn.org/blog/html5-doctype/">HTML 5 DocType</a> found out that IE will render unknown doc types (such as the HTML 5 DocType) in standards mode now.</p>
<p>The HTML 5 DocType is simply this:</p>
<pre><code>&lt;!DOCTYPE html&gt;</code></pre>
<p>This means authors could start using the HTML5 doc type now for their HTML 4 documents.</p>
<p>The W3C Validator would fail though (I think), which may be problematic for some.</p>
<p>So would it be better to pay that little tax, or go for this DocType now?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/52/ie8-meta-switch-ie7/feed</wfw:commentRss>
		</item>
		<item>
		<title>ASP.NET Is a Leaky Abstraction</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction</link>
		<comments>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comments</comments>
		<pubDate>Wed, 02 Jan 2008 18:41:44 +0000</pubDate>
		<dc:creator>Anup Shah</dc:creator>
		
		<category><![CDATA[General Web Development]]></category>

		<category><![CDATA[Server Side]]></category>

		<category><![CDATA[ASP.NET]]></category>

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

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

		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction</guid>
		<description><![CDATA[<img class="post-img" align="left" src="/wp-content/uploads/mona-unmasked.jpg" alt="A manipulation of the classic Mona Lisa shows her holding a mask revealing a smiling, ugly face." /> ASP.NET is a leaky abstraction because it tries to hide away some of the details of HTML markup generation for you when sometimes you need to know about the underlying markup.

In doing so, it is too easy to create ASP.NET sites that violate web accessibility guidelines and contain unnecessary markup bloat. In some cases, ASP.NET makes it really difficult to create the exact output you need. But there are a some options to address this problem.]]></description>
			<content:encoded><![CDATA[<p><img class="post-img" align="left" src="http://www.onenaught.com/wp-content/uploads/mona-unmasked.jpg" alt="A manipulation of the classic Mona Lisa shows her holding a mask revealing a smiling, ugly face." /> At work, we have been using .NET and C# since around 2002. Writing from a mid-tier development perspective, I have to admit I have liked it. However, writing as a web developer using <em>ASP</em>.NET (Microsoft&#8217;s attempt to abstract away the creation of HTML so that it can target non-web developers/mid-tier/VB-like developers to use their IDEs and platform) is another story!</p>
<p>ASP.NET has been problematic for many web developers/designers trying to do the &#8220;right thing&#8221;, such as</p>
<ul>
<li>Use web standards</li>
<li>Output semantically meaningful markup</li>
<li>Develop to standards, rather than browsers for cross-browser development</li>
<li>Use progressive enhancement concepts to cater for as many user preferences and technology limitations as possible</li>
<li>Create sites that are as accessible as possible without unnecessary trade-offs with the visual design</li>
<li>Create sites that are friendly for SEO</li>
<li>Create lean and optimal markup for quicker download</li>
<li>etc.</li>
</ul>
<p>(ASP.NET 1 was far worse, and version 2 allows many of the above to happen, but not all, and not always easily.)</p>
<p>Describing the problems caused by the poor quality and bloated markup and the weird/wonderful/complex/ugly/hacky ways to work around this seems to take ages. Some fans of ASP.NET don&#8217;t like to hear it when going into these details, and react defensively. And, to be fair, these problems are not unique to ASP.NET, either.</p>
<p>But recently, I rediscovered a summary explanation to help explain <em>why</em> ASP.NET is often problematic from a web developer&#8217;s perspective:</p>
<p><strong>ASP.NET is a <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">leaky abstraction</a></strong>:</p>
<p>That term, &#8220;leaky abstraction&#8221;, was coined some time ago (end of 2002) by Joel Spolsky, a prominent writer on software development and he was noting the problems with ASP.NET way back then.</p>
<blockquote cite="http://www.joelonsoftware.com/articles/LeakyAbstractions.html"><p>
In teaching someone about ASP.NET programming, it would be nice if I could just teach them that they can double-click on things and then write code that runs on the server when the user clicks on those things. Indeed ASP.NET abstracts away the difference between writing the HTML code to handle clicking on a hyperlink (&lt;a&gt;) and the code to handle clicking on a button. Problem: the ASP.NET designers needed to hide the fact that in HTML, there&#8217;s no way to submit a form from a hyperlink. They do this by generating a few lines of JavaScript and attaching an onclick handler to the hyperlink. The abstraction leaks, though. If the end-user has JavaScript disabled, the ASP.NET application doesn&#8217;t work correctly, and if the programmer doesn&#8217;t understand what ASP.NET was abstracting away, they simply won&#8217;t have any clue what is wrong.</p>
<p class="source">&#8211; <cite>Joel Spolsky, <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">The Law of Leaky Abstractions</a>, November 11, 2002</cite></p>
</blockquote>
<p>I think this is a decent summary description that can be useful for constructive discussion on what to do about it (if anything).</p>
<p><span id="more-42"></span></p>
<h3 id="toc-abstraction-without-understanding-problems">Abstraction without understanding = problems</h3>
<p>Of course, this is not just an ASP.NET issue, but a general problem in software development, as Spolsky added:</p>
<blockquote cite="http://www.joelonsoftware.com/articles/LeakyAbstractions.html"><p>
The law of leaky abstractions means that whenever somebody comes up with a wizzy new code-generation tool that is supposed to make us all ever-so-efficient, you hear a lot of people saying &#8220;learn how to do it manually first, then use the wizzy tool to save time.&#8221; Code generation tools which pretend to abstract out something, like all abstractions, leak, and the only way to deal with the leaks competently is to learn about how the abstractions work and what they are abstracting. So the abstractions save us time working, but they don&#8217;t save us time learning.</p>
<p>And all this means that paradoxically, even as we have higher and higher level programming tools with better and better abstractions, becoming a proficient programmer is getting harder and harder.</p>
<p class="source">&#8211; <cite>Joel Spolsky, <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">The Law of Leaky Abstractions</a>, November 11, 2002</cite></p>
</blockquote>
<p>This helps explain:</p>
<dl>
<dt>Why non-web developers or IE-only web developers like ASP.NET</dt>
<dd>It is an abstraction, so you don&#8217;t worry about it</dd>
<dt>Why web developers/designers despise ASP.NET</dt>
<dd>The abstraction leaks, horribly at times, and you <em>want</em> to worry about what is being abstracted</dd>
</dl>
<p>What is still interesting is that as a <em>software</em> developer (not necessarily a web specialist), Joel has understood some of the problems <em>web</em> developers and designers will have with .NET even though many Microsoft converts and ASP.NET fans do not!</p>
<p>Many software developers look down on web developers, thinking things like HTML and CSS are beneath them (its &#8220;just&#8221; the UI, or that JavaScript is not a real programming language, etc).</p>
<p>While those attitudes are generally changing, many software/mid-tier/non-web developers I come across still hold some of these views and don&#8217;t want to write anything in these languages, preferring the safety and familiarity of their IDE! (To be fair, some of these concerns are quite valid, too, and the principle for supporting the abstraction is actually often good; it is just that with web technology at the level it is at now, some of that abstract necessarily has to leak&#8230;)</p>
<h3 id="toc-negative-perception-of-ie-and-aspnet-for-web-developers">Negative perception of IE and ASP.NET for Web Developers</h3>
<p>It is interesting to note at various conferences like @media, @media AJAX, and on various blogs by noted web developers and designers, Microsoft gets a lot of stick for its IE web browser (as it is recognized as the poorest in quality of all the modern browsers, with the most bugs, biggest divergence from web standards and causing the most headaches for modern web development).</p>
<p>Indeed, since winning the &#8220;browser war&#8221; IE has stagnated and because of its dominance, web technologies have hardly changed in the last 10 years (we are still on HTML 4.01/XHTML 1.0, CSS 2.1 etc). As I posted earlier, <a href="http://www.onenaught.com/posts/44/microsofts-internet-explorer-slows-down-web-development">IE has slowed down web development progress</a> in recent years.</p>
<p>Combine that with the poor quality markup typically generated by ASP.NET, there has been a lot of criticism from the web development community aimed at Microsoft for either not caring about standards (or, as with ASP.NET 2 and <a href="http://www.onenaught.com/posts/46/microsofts-internet-explorer-8-to-speed-up-web-development">IE 8</a>) caring about it as an after thought or when threatened by rivals.</p>
<p>Here is quite a telling quote summarizing some of the implications:</p>
<blockquote cite="http://blogs.msdn.com/ie/archive/2007/11/30/the-first-year-of-ie7.aspx"><p>
I sympathize with your situation, but you desperately need to get your seniors and peers to understand what&#8217;s happening, and to assign your team way more resources.  IE is a first-impression MSFT product for most web developers, and yet you all continue to underestimate the dramatic spillover effect this poor developer experience has had and will continue to have on your other products and services.</p>
<p>Let me drive this point home. I am a front-end programmer and a co-founder of a start-up. I can tell you categorically that my team:</p>
<p>- Won&#8217;t download and play with Silverlight<br />
- Won&#8217;t build a Live widget<br />
- Won&#8217;t consider any MSFT search or ad products in the future</p>
<p>And the reason is because of IE - because MSFT disregards its most important relationship with us.  Until this relationship is repaired, nothing else stands a chance.</p>
<p>Please fight the good fight and drive this point home in your org.  Good luck.</p>
<p class="source">&#8211; <cite>Anonymous commenter to <a href="http://blogs.msdn.com/ie/archive/2007/11/30/the-first-year-of-ie7.aspx">The First Year of IE7</a>, November 30, 2007</cite></p>
</blockquote>
<p>It may be seem a bit harsh, as some developers and technical managers at Microsoft certainly seem to &#8220;get it&#8221;, but for whatever reason it has happened and left a sour taste in the mouths of many web designers and developers.</p>
<h3 id="toc-leaky-abstractions-lead-to-productivity-loss-and-unnecessary-trade-offs">Leaky abstractions lead to productivity loss and <em>unnecessary</em> trade-offs</h3>
<p>As I blogged earlier, <a href="http://www.onenaught.com/posts/4/should-web-developers-avoid-wysiwyg-editors">the WYSIWYG paradigm that Visual Studio and other such IDEs encourage, is often inappropriate for web development</a> as it encourages bad practice such as non-semantic markup.</p>
<p>The <em>perceived</em> productivity gains of such editors vanish when needing to deal with typical web related concerns (semantic markup, accessibility, progressive enhancement, SEO, etc). In fact, what often occurs is <em>unnecessary</em> trade-offs. E.g.</p>
<ul>
<li>A back-end developer uses an ASP.NET control that offers quick development with sophisticated capabilities just by dragging it onto a canvas and setting a few properties.</li>
<li>A web developer then claims that control is poor from all the web development perspectives and lists a number of things to change.</li>
<li>The back-end developer resists (especially if it comes from a &#8220;lowly&#8221; web developer!).</li>
<li>Trade-offs are then made (or not).</li>
<li>Reworking in full (if embraced at all) takes a long time.</li>
</ul>
<p>Even though ASP.NET 2.0 is far better than 1.x, the abstractions still leak; it is too easy to create sites that either</p>
<ul>
<li>Rely on JavaScript</li>
<li>Violate, or easily encourage ignoring, basic accessibility</li>
<li>Encourage further leaky abstractions because of the ease at which various ASP.NET controls can be created (the idea is good, but the fundamental leakage means that it will carry through to various controls).</li>
</ul>
<h3 id="toc-so-what-can-people-do">So what can people do?</h3>
<p>As an overall thought: <strong>by its nature, abstracting away HTML is almost guaranteed to result in a leaky abstraction</strong>.</p>
<p>Instead, it may be better to <strong>embrace the reasons for the leak, and provide cleaner separation while empowering people to work with the markup</strong>, given it is so crucial from so many perspective.</p>
<p>So here are some examples of a few ways to deal with the challenge, all with their merits for different purposes. Your mileage with each option will vary according to need. In addition, it is not a complete list; there may be other ways to achieve what you need:</p>
<h4 id="toc-strict-discipline-with-the-controls-you-choose-to-use">Strict discipline with the controls you choose to use</h4>
<p>The controls idea is certainly nice. ASP.NET and others (e.g. Java Server Faces) have put a lot of resources into this approach, and is certainly appealing from various perspectives (packaging components, reusability, productising components, etc).</p>
<p>Despite the problems, trying to stick with the <em>principle</em> of controls based abstraction may still be worth trying to pursue.</p>
<p>If so, I think it would require being VERY careful about third party controls you use, or purchase.</p>
<p>The other problem I see with this is in the case of medium/large teams; this strict discipline is unlikely to hold for too long, and eventually a developer with less experience on web development (or no inclination to do the web bit) will insist on using some poor quality controls that offer perceived productivity gains (&#8221;they can fix the problems you highlight to them!&#8221;, or &#8220;it looks okay&#8221;, or &#8220;people with accessibility needs don&#8217;t use the web, so it doesn&#8217;t matter!&#8221;).</p>
<p>Your mileage on this option will vary, depending on your team and project, etc.</p>
<h4 id="toc-inherit-and-override-problematic-controls">Inherit and override problematic controls</h4>
<p>Don&#8217;t like the way asp:label outputs its HTML? Override its Render() method. Same with any other control.</p>
<p>Sounds nice and easy enough, but this option is likely to run into trouble when someone invariably will want to use or integrate a composite, possibly third party, control written elsewhere that cannot be overridden (easily). So ASP.NET adaptors may be a better alternative than this one.</p>
<h4 id="toc-aspnet-control-adaptors">ASP.NET Control Adaptors</h4>
<p>Also known as CSS Adaptors (which reveals a fundamental misunderstanding; developers want semantic markup for all sorts of reasons, not just creating CSS-based layouts).</p>
<p>This approach tries to give developers the opportunity to clean up the HTML output by overriding the default implementation.</p>
<p>The kind of problems I see with this approach:</p>
<ul>
<li>Code examples I have seen that look awful &#8212; lots of string concatenations, obscure configuration settings, etc.</li>
<li>It may not always be easy to deploy a quick change after initial development (need to recompile a .NET Assembly, for example).</li>
</ul>
<p>Despite the potential problems, it may still be a useful option if there aren&#8217;t any other alternatives.</p>
<p>(Does this approach help prove the abstraction fails?)</p>
<h4 id="toc-do-nothing-wait-for-microsoft-to-fix-it">Do nothing (wait for Microsoft to fix it)</h4>
<p>It may seem odd to entertain an option of &#8220;do nothing&#8221;, but I often think this is an option that should be considered in many situations, if not just for completeness but because pondering on this may let you think out of the box, so to speak.</p>
<p>Why should this option be entertained for ASP.NET? Well, you could take the approach of:</p>
<ul>
<li>It&#8217;s not my problem; I just want to create cool apps</li>
<li>Microsoft will always fix it; we can just wait</li>
<li>If we get sued (accessibility compliance) or our bosses/managers complain, we can just blame Microsoft</li>
<li>The abstraction might be leaky now, but that doesn&#8217;t mean it always will &#8212; look at the improvement of ASP.NET 2 vs ASP.NET 1.x</li>
<li>I&#8217;m <em>so</em> fed up I have lost the will to live and do anything else other than just be assimilated <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>Problems? What problems? (Already assimilated a long time ago <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</li>
</ul>
<p>And so on.</p>
<p>Needless to say, I would disagree with many of these perspectives. For example,</p>
<ul>
<li>I feel as a web developer, it is out responsibility to use the tools available to create sites that are as accessible to as wide an audience as possible.</li>
<li>Claiming ignorance, or actively avoiding issues you know are there somehow does not feel right.</li>
<li>Microsoft may certainly fix these issues over time. Reading blogs and interviews of key people in ASP.NET and Internet Explorer teams certainly gives some hope for the future, but it depends on whether you think you can wait or not (and whether you have enough information on when they will release specific fixes that are important to you).</li>
<li>The controls paradigm might always be leaky regardless of what is done. I think it would still be important to know the output that is being created in order to fully understand the implications of what you are creating. If there are problems with the site, you are likely to have to sort it out, not Microsoft (or any other vendor/framework you go for).</li>
</ul>
<p>For many web developers who know exactly what they need, having a tool do it for you, and to a lower quality, will be infuriating. Knowing it can be done better (not just for one&#8217;s own ego, but because it is good for the user/customer) can be compelling enough to want to do something about it.</p>
<p>Indeed, a principle behind a number of open source frameworks has been to try and make the web better, and keep it open because it is felt that open standards and related principles will lead to greater choice, diversity and vibrancy of the web. (Indeed, a lot of &#8220;Web 2.0&#8243; and the social web has come about because of open source technologies and ideas.)</p>
<h4 id="toc-use-an-open-source-alternative">Use an open source alternative</h4>
<p>Those loyal to Microsoft will not like to hear this, but this is a decent option in many scenarios.</p>
<p>As Simon Willison, co-creator of the popular <a href="http://www.djangoproject.com/">Django web framework</a> said a few years ago, one of the key benefits of the open source approach is <a href="http://simonwillison.net/2005/Nov/1/destiny/">you are in charge of your own destiny</a>.</p>
<p>(I&#8217;m not going to debate the open vs closed source paradigms here; that is not the purpose of this blog. I will just say that I didn&#8217;t use to buy the arguments of open source in the past, but in the last 3 or 4 years I have come to respect it a LOT more &#8212; I have not regretted moving to Linux at home recently, one bit, for example, and looking at the types of projects flourishing is quite encouraging.)</p>
<h4 id="toc-dont-use-aspnet-but-dont-throw-the-baby-net-out-with-the-bath-water-aspnet">Don&#8217;t use ASP.NET, but don&#8217;t throw the baby (.NET) out with the bath water (ASP.NET)</h4>
<p>Okay, so for some scenarios, completely changing platforms may not be an option.</p>
<p>In addition, I have to admit, programming in .NET (C# 2, etc) is nice.</p>
<p>Although Microsoft may be losing credibility with web developers because of the poor quality Internet Explorer browser and because of the problems of ASP.NET from a web designer&#8217;s perspective, .NET more generally is actually quite good.</p>
<p>Unlike on the Internet Explorer side of things, the MSDN blogs seem to be more active regarding on-going developments on .NET. <a href="http://weblogs.asp.net/scottgu/">Scott Guthrie, for example, has an immensely useful and popular blog</a> on all things about Visual Studio, ASP.NET etc. (Scott Guthrie is General Manager of development teams that build the .NET CLR and the core .NET Base Class Libraries, ASP.NET, Silverlight, IIS 7.0, Visual Studio Tools for ASP.NET, WPF and Silverlight.)</p>
<p>For some projects we have successfully used .NET but by-passed the ASP.NET controls, using XSLT instead.</p>
<h4 id="toc-xslt-an-open-standard">XSLT &#8212; an open standard</h4>
<p>Using XSLT to generate the output can be one way to overcome limitations of proprietary frameworks where you lack control of the output (ASP.NET) or where other frameworks may be open source but you have to learn their templating conventions.</p>
<p>XSLT can also make the markup generation simpler to unit test as part of a developer’s daily work, which is not always the case (or not necessarily as simple) in other templating systems, because you don&#8217;t have to be dependent on a running web server and all the set up that would come with it (thus making unit tests quick to run as well, increasing the likelihood of them being used and maintained).</p>
<p>Being platform agnostic, XSLT can be an effective part of a View in an MVC framework and be applied to different frameworks and platforms, reducing up-skilling costs in the long term.</p>
<p>If you consult or contract for a number of customers/clients, it would be nice if there was one common skill that is portable across all these frameworks (just like HTML/CSS/JavaScript typically is on the client side). XSLT could be such a thing, potentially, all the while giving you full control of the markup that you need to be create.</p>
<p>In my experience, and those of some of my colleagues at work, using XSLT to by-pass .NET controls has actually been more productive from an overall development perspective because we save time that would otherwise be needed battling the controls trying to force or work alternative markup options, building accessibility, etc. (And we have architected/developed sites for one of the largest online retailers in the world, so the strategies are not merely wishful thinking, but reasonably proven).</p>
<p>XSLT may not always be appropriate in all cases, and many are certainly put off by its oddities or perceived limitations. But, perhaps XSLT deserves another look?</p>
<p>(Indeed, a follow-up post does just that, starting by looking at <a href="http://www.onenaught.com/posts/8/xslt-in-server-side-web-frameworks">XSLT in server side web frameworks</a>.)</p>
<p>Do you find these problems with ASP.NET for your sites? How do you overcome them, or do you just stick with it?</p>
<h3 id="toc-image-credits">Image credits</h3>
<p>&#8220;Mona Unmasked&#8221; reposted with kind permission from <a href="http://www.flickr.com/photos/gx9/">gravityx9</a> from flickr. See the original image at <a href="http://www.flickr.com/photos/gx9/354387041/">http://www.flickr.com/photos/gx9/354387041/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.832 seconds -->
<!-- Cached page served by WP-Cache -->
<!-- Compression = gzip -->