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

<channel>
	<title>Ten Tonne Baby &#187; Development</title>
	<atom:link href="http://www.tentonnebaby.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tentonnebaby.com</link>
	<description>Discussion on Web Technologies, Design and London</description>
	<lastBuildDate>Wed, 07 Jul 2010 20:58:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nibbling on HTML5</title>
		<link>http://www.tentonnebaby.com/2010/07/07/nibbling-on-html5/</link>
		<comments>http://www.tentonnebaby.com/2010/07/07/nibbling-on-html5/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 20:58:59 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[xbox]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/07/07/nibbling-on-html5/</guid>
		<description><![CDATA[After reading the smallest technical book I’ve come across, I’ve switched to the HTML5 Doctype on my first site today. It looks like pretty much everything is backwards compatible and will degrade nicely, so we’re going to be reworking our markup to make use of a bunch of the additional semantic elements.
The most useful thing [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://books.alistapart.com/product/html5-for-web-designers">the smallest technical book I’ve come across</a>, I’ve switched to the HTML5 Doctype on my first site today. It looks like pretty much everything is backwards compatible and will degrade nicely, so we’re going to be reworking our markup to make use of a bunch of the additional semantic elements.</p>
<p>The most useful thing so far is having a valid way of stashing information in the DOM so it is available to client-side script via the <strong>data-</strong> attributes. An example would be storing an attribute like <strong>data-zoomimageurl=”http://blah”</strong> for use by an image zoom plugin.</p>
<p>Anyway, I’m off to shoot my friends now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/07/07/nibbling-on-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating acceptance tests with BDD</title>
		<link>http://www.tentonnebaby.com/2010/06/19/automating-acceptance-tests-with-bdd/</link>
		<comments>http://www.tentonnebaby.com/2010/06/19/automating-acceptance-tests-with-bdd/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 11:22:37 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[specflow]]></category>
		<category><![CDATA[tekpub]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/06/19/automating-acceptance-tests-with-bdd/</guid>
		<description><![CDATA[I think we’re now running a pretty well-structured agile process, but one area that I’m interested in tightening up is how to express acceptance tests for user stories, and ideally how to automate the tests. A lot of the agile reading material talks in passing about acceptance tests without any real definition of the vocabulary [...]]]></description>
			<content:encoded><![CDATA[<p>I think we’re now running a pretty well-structured agile process, but one area that I’m interested in tightening up is how to express acceptance tests for user stories, and ideally how to automate the tests. A lot of the agile reading material talks in passing about acceptance tests without any real definition of the vocabulary or approach to use in expressing, organising and executing tests.</p>
<p>This fits in very nicely with some of the ideas in Behaviour Driven Design, which is like the next iteration of thinking around TDD. The idea is to express acceptance tests using a simple DSL vocabulary working in plain English, then hook up each acceptance test scenario to some automated tests which prove the scenario works as expected.</p>
<p>A simple example would be…</p>
<p><strong>+Title: Customer withdraws cash+     <br /></strong><em>As a</em> customer,    <br /><em>I want</em> to withdraw cash from an ATM,    <br /><em>so that</em> I don’t have to wait in line at the bank.</p>
<p>In BDD, an acceptance test would be along the lines of…</p>
<p><strong>+Scenario 1: Account is in credit+     <br /></strong><em>Given</em> the account is in credit    <br /><em>And</em> the card is valid    <br /><em>And</em> the dispenser contains cash    <br /><em>When</em> the customer requests cash    <br /><em>Then</em> ensure the account is debited    <br /><em>And</em> ensure cash is dispensed    <br /><em>And</em> ensure the card is returned</p>
<p>I’ve lifted the example here from the <a href="http://blog.dannorth.net/introducing-bdd/">key article published on BDD from Dan North</a> – if you’re interested so far then you should stop reading now and go and check out the article.</p>
<p>BDD frameworks will then map each step expressed in the text above through to a method in a test class, so you have a great balance between expressing the acceptance tests in simple language, but having the ability to execute the tests.</p>
<p>I found the best way to learn about this so far was a TekPub video – you’ll need a subscription, but the video is under the ‘Concepts’ section &gt; <a href="http://tekpub.com/view/concepts/5">Concepts:5 Behaviour-driven Design with Specflow</a>.</p>
<p>Overall it seems like a more natural way to approach proving the application behaviour, and makes it much easier for testers and analysts to work alongside you in defining acceptance tests. I’m quite keen to roll this into our day-to-day process.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/06/19/automating-acceptance-tests-with-bdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session cookies not expiring when Firefox closes</title>
		<link>http://www.tentonnebaby.com/2010/05/21/session-cookies-not-expiring-when-firefox-closes/</link>
		<comments>http://www.tentonnebaby.com/2010/05/21/session-cookies-not-expiring-when-firefox-closes/#comments</comments>
		<pubDate>Fri, 21 May 2010 13:52:24 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/05/21/session-cookies-not-expiring-when-firefox-closes/</guid>
		<description><![CDATA[I’ve just been looking into a slightly strange issue where closing Firefox and opening again didn’t clear out session cookies. It looks like in the latest version of Firefox this behaviour is by design if you have certain preferences set.
They have introduced a feature where closing the browser can remember the tabs you had open, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve just been looking into a slightly strange issue where closing Firefox and opening again didn’t clear out session cookies. It looks like in the latest version of Firefox this behaviour is by design if you have certain preferences set.</p>
<p>They have introduced a feature where closing the browser can remember the tabs you had open, and rehydrates these again when you start Firefox. This feature is controlled in the Settings &gt; General &gt; Startup section. If you have this set to <em>Show my windows and tabs from last time</em>, Firefox will no longer expire session cookies when the browser is closed.</p>
<p>This seems to be a pretty big security concern, as you are prompted to switch this setting on the first time you try to close the browser, so the majority of users would have this set-up. I’m not entirely sure how it decides when a session cookie should expire under these conditions, any ideas?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/05/21/session-cookies-not-expiring-when-firefox-closes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic image endpoints &#8211; think about conditional GETs</title>
		<link>http://www.tentonnebaby.com/2010/02/26/dynamic-image-endpoints-think-about-conditional-gets/</link>
		<comments>http://www.tentonnebaby.com/2010/02/26/dynamic-image-endpoints-think-about-conditional-gets/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 10:35:51 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/02/26/dynamic-image-endpoints-think-about-conditional-gets/</guid>
		<description><![CDATA[I’ve been looking at an issue recently on a site where there is a dynamic endpoint that serves up an image that is stored in a SQL database. The endpoint added the Cache-control: public header, so on the face of it looked like it had added client-side caching support.
By default if you don’t send either [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been looking at an issue recently on a site where there is a dynamic endpoint that serves up an image that is stored in a SQL database. The endpoint added the Cache-control: public header, so on the face of it looked like it had added client-side caching support.</p>
<p>By default if you don’t send either Cache-Control: max-age, or Expires headers then the user agent has been told that the resource can be cached, but has no way to know whether it has changed on the server. Based on this the user agent will send a conditional GET request to the server to find out if the resource has changed, or if it can be served directly from the local cache (this would look like a 304 response).</p>
<p>A conditional GET will compare versions of a resource based on either the Last-Modified header, or the ETag header. Generally these would have been sent in the original response for a resource. The client will then send either the If-None-Match, or If-Modified-Since headers in the GET request to indicate the resource should ONLY be sent by the server if it has changed.</p>
<p>In this case the dynamic endpoint had not been coded to support conditional GETs, so the images were getting fully downloaded on each request as a 200 response.</p>
<p>The simplest solution is to send Cache-control: max-age in order to allow the user agent to serve the resource directly from the cache without bothering with a conditional GET. Alternatively the endpoint has to check for conditional GET requests and change it’s behaviour to support sending a 304 response if the image hasn’t changed.</p>
<p>The best diagnostic tool to see what is going on is the Net tab in Firebug. This will allow you to check the request and response headers, the response codes, and user agent caching behaviour.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/02/26/dynamic-image-endpoints-think-about-conditional-gets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not sure I like CSS3 transitions</title>
		<link>http://www.tentonnebaby.com/2010/02/12/not-sure-i-like-css3-transitions/</link>
		<comments>http://www.tentonnebaby.com/2010/02/12/not-sure-i-like-css3-transitions/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 11:27:35 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/02/12/not-sure-i-like-css3-transitions/</guid>
		<description><![CDATA[One of the modules put forward in the proposed CSS3 specification is the transitions module. This adds a bunch of new CSS attributes which control the animation of property values over time, including everything you would expect (such as easing functions, speed, delays, repetition etc).
I know there are many grey areas where it’s hard to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the modules put forward in the proposed CSS3 specification is the <a href="http://www.w3.org/TR/css3-transitions/">transitions module</a>. This adds a bunch of new CSS attributes which control the animation of property values over time, including everything you would expect (such as easing functions, speed, delays, repetition etc).</p>
<p>I know there are many grey areas where it’s hard to decide if something is really behavioural (so should be covered via javascript) or presentational (in CSS). I can’t help feeling that this is taking CSS too far into trying to accommodate behaviour. After all, mostly what we do with javascript is about changing the state of the DOM, which causes the browser to re-render with the change applied.</p>
<p>There are many problems that would need to be solved well in order for this to be viable, which are currently very simple to achieve in javascript using a decent library. These include…</p>
<ul>
<li>Managing multiple independent animations on an element</li>
<li>Animating multiple elements simultaneously</li>
<li>Cancelling all active animations on an element</li>
<li>Transitioning either from the current value of a property, or from an absolute value</li>
<li>Chaining animations (so when animation X finishes, trigger animation Y)</li>
</ul>
<p>I think my other objection is simply that all of this is currently achievable in quite a simple way using existing web standards, and libraries built on top of those standards. I think deciding how to change a property over time is behavioural, not presentational and should stay in the realms of javascript. Given this, the only thing to consider is whether to extend the core DOM specification to standardise some of the behaviour that is currently provided by javascript libraries.</p>
<p>Personally I don’t quite see how this progresses anything – it will just add another way to achieve something we can do already and add inconsistency and confusion around how to approach animation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/02/12/not-sure-i-like-css3-transitions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML 5 data- attributes</title>
		<link>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/</link>
		<comments>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:28:11 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/</guid>
		<description><![CDATA[One welcome addition to the proposed HTML5 specification is to allow any attribute prefixed with data- to be treated as a storage area for private data. This makes it possible to associate private data with different DOM elements when a page is generated and sent from the server while still validating against an HTML validator.
Previously [...]]]></description>
			<content:encoded><![CDATA[<p>One welcome addition to the proposed HTML5 specification is to allow any attribute prefixed with <strong>data-</strong> to be treated as a storage area for private data. This makes it possible to associate private data with different DOM elements when a page is generated and sent from the server while still validating against an HTML validator.</p>
<p>Previously it has been possible to temporarily store state information in custom properties against an element via javascript, however embedding state information in a page when generated server-side (and getting a page to validate) always required workarounds. I’ve often resorted to using hidden input elements to expose state information to client-side script, but this should not (and won’t any longer) be necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aftermath of DDD8</title>
		<link>http://www.tentonnebaby.com/2010/02/01/aftermath-of-ddd8/</link>
		<comments>http://www.tentonnebaby.com/2010/02/01/aftermath-of-ddd8/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 09:47:56 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/02/01/aftermath-of-ddd8/</guid>
		<description><![CDATA[I went along to DDD8 at the weekend, a free community event hosted at Microsoft in Reading. It was the first time I’d attended the event, and would really recommend it (if you manage to sign up in the first 12 minutes after registration opens). I think the highlights for me were Hello Document Databases [...]]]></description>
			<content:encoded><![CDATA[<p>I went along to <a href="http://www.developerdeveloperdeveloper.com/ddd8/">DDD8</a> at the weekend, a free community event hosted at Microsoft in Reading. It was the first time I’d attended the event, and would really recommend it (if you manage to sign up in the first 12 minutes after registration opens). I think the highlights for me were <a href="http://www.developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=378">Hello Document Databases</a> by Neil Robbins, and <a href="http://www.developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=400">C#4</a> by Jon Skeet. </p>
<p>I had heard a little about document databases being an alternative to relational databases (a slightly alien idea) but hadn’t got around to much research. In particular the session was looking at how to use <a href="http://couchdb.apache.org/">CouchDB</a>. The design goals are more based around assuming that individual nodes will fail, and having a lightweight, multiple-master setup with changes replicating across nodes.</p>
<p>From <a href="http://couchdb.apache.org/docs/intro.html">the introduction</a> (which I recommend you read)… A CouchDB document is an object that consists of named fields. Field values may be strings, numbers, dates, or even ordered lists and associative maps. A CouchDB database is a flat collection of these documents. Each document is identified by a unique ID.</p>
<p>Unfortunately the session didn’t really cover how to apply this concept to a real-world scenario and how to perform useful queries against the data. However it was definately enough to encourage some reading around the subject – I think it’s important to understand the kind of problems where this could be a viable and better solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/02/01/aftermath-of-ddd8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DDD8</title>
		<link>http://www.tentonnebaby.com/2010/01/29/ddd8/</link>
		<comments>http://www.tentonnebaby.com/2010/01/29/ddd8/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:30:43 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[tvp]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/01/29/ddd8/</guid>
		<description><![CDATA[I’ll be going along to the DDD event at TVP tomorrow for the first time, quite interested to see what it’s like. Thinking about going to the following sessions…

Mixing functional and object oriented approaches to programming in C#
Hello Document Databases
C# 4
Microsoft Surface
A developer&#8217;s guide to encryption

]]></description>
			<content:encoded><![CDATA[<p>I’ll be going along to the <a href="http://developerdeveloperdeveloper.com/ddd8">DDD</a> event at TVP tomorrow for the first time, quite interested to see what it’s like. Thinking about going to the following sessions…</p>
<ul>
<li><a href="http://developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=405">Mixing functional and object oriented approaches to programming in C#</a></li>
<li><a href="http://developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=378">Hello Document Databases</a></li>
<li><a href="http://developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=400">C# 4</a></li>
<li><a href="http://developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=388">Microsoft Surface</a></li>
<li><a href="http://developerdeveloperdeveloper.com/ddd8/ViewSession.aspx?SessionID=331">A developer&#8217;s guide to encryption</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/01/29/ddd8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Previews of implemented CSS3 functionality</title>
		<link>http://www.tentonnebaby.com/2009/12/17/previews-of-implemented-css3-functionality/</link>
		<comments>http://www.tentonnebaby.com/2009/12/17/previews-of-implemented-css3-functionality/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 14:21:59 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/12/17/previews-of-implemented-css3-functionality/</guid>
		<description><![CDATA[Although still a work in progress, I hadn’t realised how many of the proposed CSS3 features actually already have some kind of basic implementation in the latest set of browsers. Check out this page which provides live demonstrations of some of the more exciting proposals.
I think the major things I’m looking forward to are…

Ability to [...]]]></description>
			<content:encoded><![CDATA[<p>Although still a work in progress, I hadn’t realised how many of the proposed CSS3 features actually already have some kind of basic implementation in the latest set of browsers. <a href="http://www.css3.info/preview/">Check out this page</a> which provides live demonstrations of some of the more exciting proposals.</p>
<p>I think the major things I’m looking forward to are…</p>
<ul>
<li>Ability to specify multiple background images on the same element – so no need to add superfluous elements as styling hooks</li>
<li>Multi-column layout – allowing text from a single element to visually flow into multiple columns, much like a newspaper layout</li>
<li>Decent support for RGBA – so being able to specify the alpha channel when setting a background colour. This avoids having to cut PNG images in order to achieve a semi-transparent background.</li>
<li>Support for specifying colours in terms of Hue, Saturation and Lightness. Although I’m not quite sure how I’ll use this yet, I can imagine this would make animation of colours more intuitive – for example, using javascript to animate the amount of light applied to an element.</li>
</ul>
<p>The live examples are really worth looking at, and give a much better feel for what is coming up compared with reading a specification.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/12/17/previews-of-implemented-css3-functionality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Problems having a simple, self-contained script with dependencies</title>
		<link>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/</link>
		<comments>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:37:50 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typekit]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/</guid>
		<description><![CDATA[A while back I was working on a javascript based video solution, and I wanted to make it as simple as possible to include a video widget into a page. This would be roughly along the lines of…


   1: &#60;script type=&#34;text/javascript&#34; src=&#34;blah.js&#34;&#62;&#60;/script&#62;    
   2:&#160; 
   3: [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I was working on a javascript based video solution, and I wanted to make it as simple as possible to include a video widget into a page. This would be roughly along the lines of…</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> &lt;script type=<span style="color: #006080">&quot;text/javascript&quot;</span> src=<span style="color: #006080">&quot;blah.js&quot;</span>&gt;&lt;/script&gt;    </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span>&#160; </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> &lt;script type=<span style="color: #006080">&quot;text/javascript&quot;</span>&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>     mycompany.video.addVideoWidget({</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>         siteId: <span style="color: #006080">&quot;Heat&quot;</span>,</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>         keywords: <span style="color: #006080">&quot;Britney Spears&quot;</span>,</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span>         parent: <span style="color: #006080">&quot;Id of the container&quot;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span>     });</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span>     </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span> &lt;/script&gt;</pre>
</div>
</div>
<p>When authoring a script like this, it needs to be entirely self-contained as you have no knowledge of what other scripts have been included on the host page, or what versions etc.</p>
<p>The issue is how to offer this script when you have a dependency. In this case I wanted to use swfoject as a reliable way to add a flash movie to a page. Another common scenario would be writing script on top of jquery. An example is <a href="http://www.typekit.com">Typekit</a> who end up packaging up and distributing jquery as part of the code they require you to download – <a href="http://www.gsfn.us/typekit/topics/include_only_typekit_js_library_and_not_typekit_jquery">discussed here</a>.</p>
<p>Given that you have no working knowledge of the host page, the only possible option is to package up the dependency, avoid naming conflicts, and include it with your script logic. However this seems quite wasteful given that the host page may also include the same library.</p>
<p>We are so used to using libraries now to make javascript a pleasurable activity, the idea of writing <em>raw</em> script, while possible, is really not an enjoyable prospect.</p>
<p>I don’t have a good answer to the problem – I ended up going down the same route that Typekit have gone. The only other option is to provide a flavour which requires the host page to implement the dependency, but then you lose the simplicity and are open to tricky issues around versioning.</p>
<p>Still, I guess life is short and bandwidth is cheap.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
