<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Matthew Butt</title>
	<atom:link href="http://blog.matthewbutt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.matthewbutt.com</link>
	<description>Web, Music and comment from a corner of W12</description>
	<lastBuildDate>Mon, 21 May 2012 08:33:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.matthewbutt.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Matthew Butt</title>
		<link>http://blog.matthewbutt.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.matthewbutt.com/osd.xml" title="Matthew Butt" />
	<atom:link rel='hub' href='http://blog.matthewbutt.com/?pushpress=hub'/>
		<item>
		<title>Should the HSE investigate deaths of cyclists?</title>
		<link>http://blog.matthewbutt.com/2012/05/07/should-the-hse-investigate-deaths-of-cyclists/</link>
		<comments>http://blog.matthewbutt.com/2012/05/07/should-the-hse-investigate-deaths-of-cyclists/#comments</comments>
		<pubDate>Mon, 07 May 2012 12:45:29 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[cycling]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=468</guid>
		<description><![CDATA[I have just read a shocking post by Mark (@AsEasyAsRiding) which lists the cyclists who have been killed or seriously injured by lorries directly connected with the construction of the Shard in London Bridge and asks whether the hopelessly inflexible management of this building project has led to the (literal) cutting of too many corners. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=468&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have just read a shocking post by Mark (<a href="http://twitter.com/#!/AsEasyAsRiding">@AsEasyAsRiding</a>) which lists the <a href="http://aseasyasridingabike.wordpress.com/2012/05/07/the-race-to-construct-the-shard/">cyclists who have been killed or seriously injured by lorries directly connected with the construction of the Shard</a> in London Bridge and asks whether the hopelessly inflexible management of this building project has led to the (literal) cutting of too many corners.</p>
<p>We recently also heard the result of the inquest into the death of Svitlana Tereschenko, who was killed on Bow roundabout by a lorry driver on his way to the Olympic site, who was talking on his phone (hands free, so technically legally), and had failed to indicate before cutting across her. This verdict is reported by The Cycling Lawyer, and prompts a very interesting observation in the comments, that <a href="http://thecyclingsilk.blogspot.co.uk/2012/05/inquest-into-death-of-svitlana.html?showComment=1336079432993#c2812656368407884942">had Svitlana been killed on the Olympic site, the HSE would have taken immediate action, but that because her death took place off site, responsibility fell to the CPS</a>, who are consistently shite at following up traffic crimes.</p>
<p>This leads me to wonder whether we should be campaigning for the remit of the HSE to be extended to cover commercial vehicles no matter where they are. Ideally we would have a prosecution service that actually took the carnage on our roads seriously, but perhaps the involvement of the HSE would at least offer a chance of civil redress, and force these companies to take cyclists’ lives seriously.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/468/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=468&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2012/05/07/should-the-hse-investigate-deaths-of-cyclists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>Addison Lee and Licensing</title>
		<link>http://blog.matthewbutt.com/2012/04/23/addison-lee-and-licensing/</link>
		<comments>http://blog.matthewbutt.com/2012/04/23/addison-lee-and-licensing/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 21:40:19 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[cycling]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[Addison Lee]]></category>

		<guid isPermaLink="false">https://matthewbutt.wordpress.com/?p=465</guid>
		<description><![CDATA[At this evening’s die-in at the Addison Lee offices, the ever entertaining predictable John Griffin deigned to address us the broadcast media, only to rehash his previous comments about cyclists needing licences. Now, Addison Lee has a licence as a private hire operator, yet that doesn’t stop Griffin inciting his staff franchisees to break the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=465&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At this evening’s die-in at the Addison Lee offices, the ever <del>entertaining</del> predictable John Griffin deigned to address <del>us</del> the broadcast media, only to rehash his previous comments about cyclists needing licences. </p>
<p>Now, Addison Lee has a licence as a private hire operator, yet that doesn’t stop Griffin inciting his <del>staff</del> franchisees to break the law. </p>
<p>Addison Lee drivers have driving licences, but that doesn’t stop their constant infringement of traffic regulations. </p>
<p>Griffin and his company are a prime example of the ineffectiveness of licensing. </p>
<p>So why the buggery does he hold so much stock by the idea?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/465/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=465&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2012/04/23/addison-lee-and-licensing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>The State Pattern, explored through the medium of cake!</title>
		<link>http://blog.matthewbutt.com/2012/03/28/the-state-pattern-explored-through-the-medium-of-cake/</link>
		<comments>http://blog.matthewbutt.com/2012/03/28/the-state-pattern-explored-through-the-medium-of-cake/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 09:50:44 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=445</guid>
		<description><![CDATA[At 7digital, we are running a weekly discussion group on design patterns, and I have been creating some small projects to exlore the issues raised in these discussions. The other week my colleague Emily presented the State Pattern, and it soon became clear that this is one of the more controversial patterns, as it seems [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=445&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At 7digital, we are running a weekly discussion group on design patterns, and I have been creating some small projects to exlore the issues raised in these discussions. The other week my colleague Emily presented the State Pattern, and it soon became clear that this is one of the more controversial patterns, as it seems to ride roughshod over the SOLID principles.</p>
<p>In this post I will give a bit of background, and then discuss the various approaches illustrated in my project.</p>
<h2>The State Pattern</h2>
<p>The classic case for the State Pattern is when an object’s behaviour changes according to the state it is in. A vending machine can only sell when it contains products, a shopping basket can only be checked out when it has products in it, a person can only get divorced if they are already married.</p>
<p>This pattern is implemented as an extension of the Strategy Pattern: the context object (vending machine, shopping basket, person) has a dependency on a state object, which in turn implements the behaviour (sell, check out, divorce) in an appropriate manner. Unlike cardinal examples of the Strategy Pattern, in which the strategy is set once and left alone, the State Pattern lets the strategy change during execution — often as the result of a method call on the state itself (if the vending machine sells the last product, it then becomes empty; if the only item is removed from the basket, it cannot be checked out; if the person gets divorced, they are no longer married).</p>
<h2>Smelly</h2>
<p>An immediate criticism of the State Pattern is that it leads to a system that is fairly tightly coupled. Not only is the context coupled to the state in order to make method calls, but a mechanism is then needed for updating the state, and a classical implementation of this is for the state to be coupled back to the context — a two-way coupling that is already a code smell.</p>
<p>Other implementations are possible: the context can update its own state after each state method call, or the state method can give the successor state as a return value; however, putting this question aside, it is the State Pattern’s lack of SOLIDity that makes it most problematic.</p>
<h2>VAPID</h2>
<p>Consider a context object that exposes several methods and has several states. Now consider that only some of these methods will be appropriate for any given state of the object (just as in the examples given above). Under the classic State Pattern, each concrete state must implement a method for every delegated method of the context object, even if it is not appropriate for it to do so (often implemented by throwing an exception).</p>
<p>First, this is a violation of the Single Responsibility Principle, as each concrete state now has responsibilities that it is designed to shirk. If we consider the ‘reason to change’ criterion, each concrete state can change because a) it changes the implementation of the stuff it does do, and b) it changes the implementation of failing to do the stuff it does not do.</p>
<p>More graphically, this is a violation of the Liskov Substitution Principle. This principle requires interchangeable objects (eg, those with the same interface) to behave in the same way, ie, given the same input conditions, they produce the same output conditions. The problem with the State Pattern is that it requires each concrete state to have different behaviour from its peers: violation of the LSP is seemingly baked into this pattern.</p>
<p>Finally, this pattern can lead to a violation of the Interface Segregation principle, insofar as a multiplicity of methods on the context class (which may be justified as being appropriate to that object) can then delegate to a a multiplicity of methods on the state interface, which, given their state-dependence, will no longer form a coherent collection.</p>
<h2>Sharlotka</h2>
<p>Let’s take a break from theory here, and look at my implementation.</p>
<p>I considered the stereotypical State Pattern examples, but let’s be honest: there are quite enough vending machines and shopping baskets in the world, and discussion of design patterns is not the context to be locking horns with Cardinal O’Brien.</p>
<p>So I thought I would use a culinary example instead.</p>
<p><a href="http://smittenkitchen.com/2012/01/apple-sharlotka/">Sharlotka </a>(шарлотка) is a Russian apple cake. It is made by filling a cake tin with chopped apples, then pouring an eggy batter over the apples and baking in a warm oven till the batter has set. It is served dusted with sugar and cinnamon, and is really rather lovely.</p>
<p>It also makes a good, simple example of the State Pattern: each stage of cooking must be carried out in sequence, but there’s a nice loop in the middle, where you have to keep checking the cake until it’s cooked through before turning it out.</p>
<h2>Classic Implementation</h2>
<p>My first implementation follows the <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/tree/master/Classic">classic pattern</a>.</p>
<p>You can see that there is one <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/blob/master/Classic/Classic.Implementation/States/ISharlotkaState.cs"><code>ISharlotkaState</code> interface</a>, which contains a method for each of calls that the <code>Sharlotka</code> context object delegates to its state. Each of these methods takes a reference to the <code>Sharlotka</code> as a parameter, so it can alter its state if need be. (The <code>Sharlotka</code> is passed with the interface <code>IHasState&lt;ISharlotkaState&gt;</code> to avoid making the <code>State</code> part of the public interface of the <code>Sharlotka</code> class itself.)</p>
<p>If you look at any of the concrete states (eg, <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/blob/master/Classic/Classic.Implementation/States/ReadyToAddApplesState.cs"><code>ReadyToAddApplesState</code></a>), you will see that most of the methods are left throwing a <code>WrongStateException</code>, as well as the mechanism for updating the context’s state. The <code>_successor</code> state is injected in the constructor, as this makes it possible to leave the mechanics of wiring everything together to the <abbr title="Inversion of Control">IoC</abbr> container, rather than having to new up states within other states. In a small way this is reminiscent of the Chain of Resposibility Pattern, and does something to alleviate the tight coupling smell.</p>
<p>If you want to unit test one of the concrete states (eg, <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/blob/master/Classic/Classic.Unit.Tests/States/ReadyToAddApplesStateTests.cs"><code>ReadyToAddApplesStateTests</code></a>) then you are again left with a lot of boilerplate code.</p>
<p>This implementation highlights some of the deficiencies of the classic State Pattern implementation; however, it does still work, and may be appropriate for cases where it is not so much the behaviour of the context that is dependent on state, but rather its internal implementation.</p>
<h2>Segregating the Interfaces</h2>
<p><a href="http://elegantcode.com/2010/03/19/dont-give-up-on-the-state-pattern-just-yet/">A more parsimonious approach has been suggested by Jan van Ryswyck</a>, and I have implemented a version of this as the <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/tree/master/SmallInterface">Small Interface project</a>.</p>
<p>The key difference here is that rather than having a single, monolithic interface for all the states, the individual behaviours are broken into their own interfaces. When the context comes to call each state method, it first checks whether it can cast the state to the appropriate interface, and only then makes the call.</p>
<p>This implementation makes no further efforts to remedy the tight coupling, but does makes some improvements to the SOLID violations:</p>
<p>The Single Responsibility Principle is better supported, as each state is now only responsible for implementing the interfaces that are actually appropriate; we no longer have states also taking responsibility for throwing <code>WrongStateException</code>s, as this is done by the context object.</p>
<p>The Liskov Substitution Principle is better supported, as we no longer have sets of defective implementations of interface methods; instead we have used the Interface Segregation Principle to split out a set of atomic interfaces, each of which can more easily support the LSP. There are still opportunities for violation of the LSP, as it is entirely possible to implement the same interface in several states, and for each implementation to be different, but this problem is no longer inherent in the implementation.</p>
<p>This implementation makes good steps towards SOLIDity, but still has a major flaw, which is intrinsic to the state pattern: you can call methods on the stateful object that are simply not appropriate to its state; to continue the sharlotka example, you can call <code>Serve</code> before you have called <code>Bake</code>. Whilst doing this will throw an exception, it should arguably not be possible to do so in the first place.</p>
<h2>A Fluent Implementation</h2>
<p>A third possibility came up in our discussion — I think it was <a href="http://www.sochanik.com/wordpress/">Greg </a>who raised it —: you can implement your stateful class with a fluent interface.  You can see my version of this in the <a href="https://github.com/bnathyuw/Sharlotka-State-Pattern/tree/master/Fluent">Fluent project</a>.</p>
<p>Like the Small Interface implementation, this uses several atomic interfaces instead of one monolithic one; unlike that implementation however the interfaces are directly implemented by the Sharlotka class, rather than being delegated to a state object, and at any point in its lifecycle the <code>Sharlotka</code> is only considered as an implementation of the interface that is appropriate to its current state, ie, you never have access to methods that are not currently supported.</p>
<p>The trick in implementing this is in the fluent idiom: rather than calling</p>
<pre>sharlotka.AddApples();
sharlotka.AddBatter();
sharlotka.Bake();</pre>
<p>we want to chain the methods like this:</p>
<pre>sharlotka.AddApples()
	.AddBatter()
	.Bake();</pre>
<p>We can do this by making each method return this, but with a return type of the appropriate next interface.</p>
<p>For example, <code>TurnOut</code> is implemented like this:</p>
<pre>ICanDustWithSugar ICanTurnOut.TurnOut() {
	return this;
}</pre>
<p>which means that the next call must be a method of <code>ICanDustWithSugar</code>.</p>
<p>This implementation does away with the smelly tight coupling of the State-Pattern examples, as state is represented by the return type interface of each method, rather than as a property of the <code>Sharlotka</code> object. The application of the Single Responsibility Principle is rather less clear in this example, as the methods are stubbed out, rather than being implemented in any meaningful way. It is quite likely that in a real system the implementation of each method would be delegated to another object in order to honour this principle; this would look rather similar to the Small Interface implementation, with the crucial distinction that <em>the implementation would not be responsible for updating the <code>Sharlotka’</code>s state</em>.  The Liskov Substitution Principle ceases to be a question here, as we have moved to small interfaces with single implementations, and this fact also supports the Interface Segregation Principle.</p>
<p>Where this implementation is not so suitable is in cases where the state of the object after a method call is not clearly determined. For instance, withdrawing money from a bank account can leave the account in credit <em>or</em> overdrawn; in such a case the trick of returning a particular interface is not sufficient. A small example of this in my implementation is the Bake loop, and I have overcome the problem in this particular case by checking the return type until it is not null. However, this technique is already a significant departure from the fluent idiom, as it relies on runtime checking to make sure that the code actually works.</p>
<p>There is another danger with this implementation, in that it relies on the consumer knowing to use it fluently. There is no protection against storing the return value of any method in a variable, and calling the same method more than once (indeed, this is what is done during the Bake loop), and any person coding with this interface needs to know that methods must be chained. However, the fluent idiom is fairly commonplace now, and neither of these considerations is one of code quality.</p>
<h2>&amp; Messe it Forth</h2>
<p>These three implementations illustrate different approaches to the same problem. The Classic implementation is unlikely to be the best in most circumstances because of its tendency to produce Liskov-violating defective methods; the Small Interface implementation overcomes these problems, and is probably most suitable for situations where the state of the object does no change in easily predictable ways; the Fluent implementation is handy when a particular sequence of methods should be called, but less idiomatic when the sequence can branch at runtime.</p>
<p>There are also tantalising prospects for implementing this type of system with monads, but I’m going to leave that for another day.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/445/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/445/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/445/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=445&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2012/03/28/the-state-pattern-explored-through-the-medium-of-cake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>Response to Islington’s consultation on Bunhill Row</title>
		<link>http://blog.matthewbutt.com/2012/02/25/response-to-islingtons-consultation-on-bunhill-row/</link>
		<comments>http://blog.matthewbutt.com/2012/02/25/response-to-islingtons-consultation-on-bunhill-row/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 21:20:35 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[cycling]]></category>
		<category><![CDATA[infrastructure]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=442</guid>
		<description><![CDATA[Islington are consulting on continuing the cycle contraflow down the whole length of Bunhill Row. This is a road I use frequently, so I have given my response: I live in Shepherd&#8217;s Bush and work on Scrutton Street in Shoreditch, just over the border in Hackney. I commute to and from work by bike, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=442&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Islington are consulting on continuing the cycle contraflow down the whole length of Bunhill Row. This is a road I use frequently, so I have given my response:</p>
<blockquote><p>I live in Shepherd&#8217;s Bush and work on Scrutton Street in Shoreditch, just over the border in Hackney.</p>
<p>I commute to and from work by bike, and really appreciate the good cycle route along Skinner and Lever Streets, which I always use when I approach Shoreditch from Bloomsbury, and its continuation to the top of Bunhill Row, which means I can avoid the unpleasant gyratory at Old Street roundabout.</p>
<p>A southbound continuation of the route along Bunhill Row would provide an invaluable missing link, letting cyclists approach the city without having to negotiate Finsbury Square and Moorgate, which are poorly laid out for cyclists at the best of times, and really nasty at the moment, thanks to the Crossrail works. Moorgate was the site of a the recent death of a highly experienced cycle courier, which says something about the hazards of this particular stretch of road; a convenient back-street cycle route would help mitigate the poor infrastructure on these trunk roads.</p>
<p>Your proposals look excellent, and I wholeheartedly support them.</p>
<p>Yours,</p>
<p>Matthew</p>
<p>PS, while I am commenting on infrastructure in this area, could I voice my dislike of the cycle-pedestrian crossing of City Road between Featherstone Street and Leonard Street. Cyclists are expected to wait for the lights on the pavement, and then cross the road simultaneously with pedestrians, while moving diagonally across their path; this means that the crossing is unpleasant for both cyclists and pedestrians to use, as no one is clear who is moving in which direction. I would strongly suggest you look into altering this crossing — separating cyclists from pedestrians either physically or in time — to reduce this conflict.</p></blockquote>
<p>If you use this road, please <a href="http://www.surveymonkey.com/s/BunhillRowCycle">respond to their consultation</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/442/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=442&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2012/02/25/response-to-islingtons-consultation-on-bunhill-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>ActionInvoker method sequence</title>
		<link>http://blog.matthewbutt.com/2011/10/26/actioninvoker-method-sequence/</link>
		<comments>http://blog.matthewbutt.com/2011/10/26/actioninvoker-method-sequence/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 20:45:54 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[mvc3]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=437</guid>
		<description><![CDATA[In one of the projects I&#8217;m playing with, I&#8217;m doing a bit of a hack over .NET MVC 3. I&#8217;m providing my own implementation of IActionInvoker, currently by extending ControllerActionInvoker, and as part of this work, I&#8217;ve done a quick audit of the methods of this class, and the order they are called in. I&#8217;m [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=437&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In <a href="https://github.com/bnathyuw/Restful-Simple-MVC/">one of the projects I&#8217;m playing with</a>, I&#8217;m doing a bit of a hack over .NET MVC 3.</p>
<p>I&#8217;m providing my own implementation of IActionInvoker, currently by extending ControllerActionInvoker, and as part of this work, I&#8217;ve done a quick audit of the methods of this class, and the order they are called in.</p>
<p>I&#8217;m reproducing them here, in case it&#8217;s useful to anyone else:</p>
<ul>
<li>InvokeAction</li>
<li>GetControllerAction</li>
<li>FindAction</li>
<li>GetFilters</li>
<li>InvokeAuthorizationFilters</li>
<li>GetParameterValues</li>
<li>InvokeActionMethodWithFilters</li>
<li>InvokeActionMethod</li>
<li>CreateActionResult</li>
<li>InvokeActionResultWithFilters</li>
<li>InvokeActionResult</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/437/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=437&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/10/26/actioninvoker-method-sequence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>Concerto for Two Double Reeds in detail: IV — Rondo</title>
		<link>http://blog.matthewbutt.com/2011/10/04/concerto-for-two-double-reeds-in-detail-iv-rondo/</link>
		<comments>http://blog.matthewbutt.com/2011/10/04/concerto-for-two-double-reeds-in-detail-iv-rondo/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 22:43:39 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[bassoon]]></category>
		<category><![CDATA[composition]]></category>
		<category><![CDATA[oboe]]></category>
		<category><![CDATA[orchestral]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=356</guid>
		<description><![CDATA[This is the fourth in a series of post-performance analyses of my Concerto for Two Double Reeds. You can also read about I — Tessellations, II — Meta-Canon and III — Loops. Click here to read the full score of movement IV — Rondo or listen to the live recording. The fourth movement is an old-fashioned rondo with lots of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=356&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the fourth in a series of post-performance analyses of my Concerto for Two Double Reeds. You can also read about <a href="http://blog.matthewbutt.com/2011/08/03/concerto-for-two-double-reeds-in-detail-i-tessellations/">I — Tessellations</a>, <a href="http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-ii-meta-canon/">II — Meta-Canon</a> and<a title="Concerto for Two Double Reeds in detail: III — Loops" href="http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-iii-loops/"> III — Loops</a>. Click here to <a href="http://media.matthewbutt.com/concerto-for-two-double-reeds/IV.pdf">read the full score of movement IV — Rondo</a> or <a href="http://soundcloud.com/bnathyuw/concerto-for-two-double">listen to the live recording</a>.</p>
<p>The fourth movement is an old-fashioned rondo with lots of tunes; however, the original idea was rhythmical rather than melodic, and these rhythmic concerns recur throughout the movement.</p>
<p>Perhaps the decisive moment for me in writing this movement was when I noticed a rhythmic parallel between a Latin poem and an Italian canzonetta.</p>
<p><a href="http://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A1999.02.0003%3Apoem%3D63">Catullus 63</a> treats of a subject that wouldn&#8217;t be out of place in an Almodóvar film: a young man, Attis, a devotee of the cult of Cybele, enters a trance and emasculates himself:</p>
<blockquote lang="la"><p>Super alta vectus Attis celeri rate maria<br />
Phrygium ut nemus citato cupide pede tetigit<br />
adiitque opaca silvis redimita loca deae,<br />
stimulatus ibi furenti rabie, vagus animis<br />
devolvit ili acuto sibi pondera silice.</p></blockquote>
<p>Aside from its rather provocative theme, what marks this poem out is its driving rhythm:</p>
<blockquote><p>⏑⏑–⏑–⏑––||⏑⏑–⏑⏑⏑⏑×</p></blockquote>
<p>This rhythm is known as the <a href="http://en.wikipedia.org/wiki/Galliambic">Galliambic</a>, and the first half (before the caesura — marked &#8216;||&#8217;) is also known as the <a href="http://en.wikipedia.org/wiki/Anacreontic">Anacreontic</a>. The Anacreontic rhythm can be considered as the result of anaclasis (inversion) of the middle two syllables of an Ionic dimeter:</p>
<blockquote><p>⏑⏑––|⏑⏑–– becomes<span class="Apple-style-span" style="font-family:Consolas, Monaco, monospace;font-size:12px;line-height:18px;white-space:pre;"> <span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;line-height:19px;white-space:normal;">⏑⏑–⏑|–⏑––</span></span></p></blockquote>
<p>Now, if you go back and read <a href="http://blog.matthewbutt.com/2011/03/01/oboe-concerto-teaser-i/">my old teaser post</a> for this concerto, you&#8217;ll see I discuss the patterns of bell ringing, which are based on swapping values in a series. The transformation from the Ionic dimeter to the Anacreontic follows the same technique (albeit in a fairly limited fashion).</p>
<p>The second source is the canzonetta <a href="http://open.spotify.com/track/1Ny6ZGALaX68rKCM8frfXT"><q>Vi ricorda o boschi ombrosi</q></a>  from <a href="http://imslp.org/wiki/L%27Orfeo,_favola_in_musica,_SV_318_(Monteverdi,_Claudio)">Monteverdi&#8217;s <cite>L&#8217;Orfeo</cite></a>:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-04-at-22-09-39.png"><img class="alignnone size-full wp-image-363" title="Monteverdi L'Orfeo" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-04-at-22-09-39.png?w=720&h=361" alt="Musical example illustrating the Anacreontic rhythm in 'Vi ricorda o boschi ombrosi' from Monteverdi's L'Orfeo" width="720" height="361" /></a></p>
<p>Here is the same passage in modern notation:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-20-53-09.png"><img class="alignnone size-full wp-image-365" title="Monteverdi L'Orfeo (modern notation)" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-20-53-09.png?w=720&h=249" alt="The same excerpt in modern notation" width="720" height="249" /></a></p>
<p>The pervasive rhythm of this passage is again the Anacreontic:</p>
<blockquote><p> ⏑⏑–⏑–⏑––</p></blockquote>
<p>I had been keen for a while to play with classical rhythms, and this observation prompted me to start playing with the technique of anaclasis.</p>
<p>The opening passage of this movement doesn&#8217;t apply this technique to the Ionic dimiter, but rather to an Anapaestic rhythm:</p>
<blockquote><p>⏑⏑–|⏑⏑–</p></blockquote>
<p>After anaclasis, this becomes the following rhythm:</p>
<blockquote><p>⏑⏑⏑–⏑–</p></blockquote>
<p>Join the two rhythms, and you get this:</p>
<blockquote><p>⏑⏑–|⏑⏑–|⏑⏑⏑–⏑–</p></blockquote>
<p>This is the rhythm of the opening phrase of the Final of my concerto:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-04-10.png"><img class="alignnone size-full wp-image-366" title="Concerto for Two Double Reeds IV. Finale opening oboe theme" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-04-10.png?w=720" alt="Opening oboe theme, illustrating the anaclastic anapaestic rhythm"   /></a></p>
<p>In addition to introducing an important rhythmic technique, this opening passage also sets out two other important aspects of the movement:</p>
<ol>
<li>The anaclastic rhythm cuts across the barline (the A♯ quavers tied from b.3 to b.4) giving a syncopated accent;</li>
<li>The melodic material is derived from triads on C and F♯, which lie a tritone apart.</li>
</ol>
<p>The entire first phrase shows how these three ideas are developed:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-13-07.png"><img class="alignnone size-full wp-image-367" title="Concerto for Two Double Reeds IV. Final entire first oboe phrase" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-13-07.png?w=720" alt="The entire first phrase. The two-bar syncopated rhythm is repeated slightly lower, and then finished with a falling anapaestic rhythm"   /></a></p>
<p>This brief opening fanfare is played in the oboe and bassoon, and leads into the rondo theme at [A]:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-17-39.png"><img class="alignnone size-full wp-image-368" title="Concerto for Two Double Reeds IV. Rondo: rondo theme" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-17-39.png?w=720" alt="The rondo theme: two phrases is straight/anaclastic anapaestic dimeter, then a phrase in straight/anaclastic ionic dimeter"   /></a></p>
<p>The first eight bars of this theme are based around the Anapaestic dimeter rhythm already explained, but with a small variation in the second foot. The following four bars, in 3/4, oppose a straight Ionic dimeter with its Anacreontic variant. This material maintains the polytonal nature of the opening: the strings play a vamp rhythm alternative between C and F♯ chords every two beats — even after the change to 3/4 —, and the thematic material meanders between these two tonal centres:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-26-43.png"><img class="alignnone size-full wp-image-369" title="Concerto for Two Double Reeds IV. Rondo: rondo theme with accompaniment" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-26-43.png?w=720" alt="The rondo theme with accompaniment"   /></a></p>
<p>This material is interrupted with a harsh outburst in the strings, again varying the Anacreontic rhythm across an interval of a major 7th, which is then picked up by the oboe in the inversion of that interval: an minor 2nd, leading back into the rondo theme, which is rounded off with a descending variant of the broken chords that opened the movement.</p>
<p>Episode I at [E] takes the ideas of the rondo theme and explores them in a different context. The alternating chords are each moved by a semitone, from C and F♯ to C♯ and F. The vamp bass remains, but the upper strings now play counterpoint above it, rather than pizzicato, and the solo material is a duet between oboe and bassoon. The technique of anaclasis appears again, this time transforming a dactylic dimeter (which is not explicitly heard):</p>
<blockquote><p>–⏑⏑|–⏑⏑ becomes –⏑–⏑⏑⏑</p></blockquote>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-20-at-23-19-31.png"><img class="alignnone size-full wp-image-406" title="Concerto for Two Double Reeds IV: Rondo, first episode" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-20-at-23-19-31.png?w=720" alt="Concerto for Two Double Reeds IV: Rondo, first episode"   /></a></p>
<p>This episode leads straight back into the rondo theme at [F], which is this time finished with arpeggi in the low strings, which recall the solo material at [E].</p>
<p>Episode II leaves behind anaclastic meters, and explores Aeolic rhythms instead.</p>
<p>The core rhythm of Aeolic meter is the choriamb:</p>
<blockquote><p>–⏑⏑–</p></blockquote>
<p>This basic unit is extended by the addition of syllables before and after. The syllables before are anceps (either long or short), while those after tend to alter breve, longum. For instance, the rhythmic colon known as the Hipponactean looks like this:</p>
<blockquote><p>⏓⏓ –⏑⏑– ⏑–×</p></blockquote>
<p>In this episode, I decided to work freely with the principles of Aeolic rhythm, rather than adopting a preexisting verse form. Here is the resulting rhythm:</p>
<blockquote><p>–– –⏑⏑– ⏑–⏑–<br />
–– –⏑⏑– ⏑–⏑–<br />
–– –⏑⏑– ⏑–<br />
⏑⏑ –⏑⏑– ⏑––</p></blockquote>
<p>In each of these lines the central Choriamb can be seen clearly.</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-09-09.png"><img class="alignnone size-full wp-image-419" title="Concerto for Two Double Reeds IV Rondo: Episode II theme" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-09-09.png?w=720" alt="The Episode II theme in the bassoon (and violin) at [G]"   /></a></p>
<p>This is the first episode in which the bassoon is the only soloist, and the first to move away from tonality. Rather than diatonic scales, the melodic and harmonic material is drawn from a scale that Messiaen would have described as the <a href="http://en.wikipedia.org/wiki/Modes_of_limited_transposition">2nd Mode of Limited Transposition</a>, and which is also known as the octatonic. This is made of alternating tones and semitones.</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-15-22.png"><img class="alignnone size-full wp-image-420" title="Octatonic scale on C" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-15-22.png?w=720" alt="Octatonic scale on C"   /></a></p>
<p>The bassoon explores this scale, while the upper strings play diminished triads — the chord that forms if you take alternate notes from this scale. As in the rondo theme, there is an ambiguity between 2/4 and 3/4 meter, but this time it is the string figurations that change:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-18-56.png"><img class="alignnone size-full wp-image-421" title="Concerto for Two Double Reeds IV Rondo: Episode II string writing" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-18-56.png?w=720" alt="The rhythm shows two 3/4 bars, one 2/4 bar; two 3/4 bars, one 2/4 bar; two 3/4 bars with a hemiola; two 2/4 bars; one 3/4 bar "   /></a></p>
<p>The material of this episode is played three times:</p>
<ol>
<li>Bassoon solo with upper string triad accompaniment;</li>
<li>Oboe solo, bassoon counterpoint in diminished arpeggi, upper string accompaniment with cello bassline;</li>
<li>Oboe and bassoon have the melody, the upper string triads are spaced by octaves, the double bass joins the bassline.</li>
</ol>
<p>The material then dissolves until only stratospheric violin and abyssal double bass are left. At this point a solo violinist picks up with the material first heard in the interruption to the initial rondo theme, which then leads into a statement of this theme in solo violin and pizzicato viola at [J]:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-22-13-28.png"><img class="alignnone size-full wp-image-370" title="Concerto for Two Double Reeds IV. Rondo: rondo theme in violin and viola" src="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-22-13-28.png?w=720" alt="Rondo theme in solo violin and viola"   /></a></p>
<p>With the soloist played at such a high pitch, and no harmonic accompaniment, this material sounds very different from its initial statement. The material is then picked up in both violin parts (tutti), with accompaniment from all the lower strings, but still no harmony, and we then then move into the next episode at [L].</p>
<p>The rhythm of Episode III is again Aeolian. A feature of Aeolian rhythms is that the central Choriamb can be expanded, either by full repetition or with Anapaests (which are equivalent to a Choriamb with the first syllable missing). This passage uses Choriambic expansion, moving between <em>Glyconics</em>:</p>
<blockquote><p>–⏑ –⏑⏑– ⏑–</p></blockquote>
<p>And their expanded equivalent, the<em> Asclepiad</em>:</p>
<blockquote><p>–⏑ –⏑⏑– –⏑⏑– ⏑–</p></blockquote>
<p>The combination <em>Glyconic</em>, <em>Asclepiad</em>, <em>Glyconic</em>, <em>Asclepiad</em> is known as the <em>Fourth Asclepiad</em>, and is used by Horace in his Ode 3.9:</p>
<blockquote><p>–⏓ –⏑⏑– ⏑×<br />
–⏓ –⏑⏑– –⏑⏑– ⏑×<br />
–⏓ –⏑⏑– ⏑×<br />
–⏓ –⏑⏑– –⏑⏑– ⏑×</p>
<p lang="la">Donec gratus eram tibi<br />
nec quisquam potior bracchia candidae<br />
ceruici iuuenis dabat,<br />
Persarum uigui rege beatior.</p>
</blockquote>
<p>The rhythm I use for this section is slightly different, being composed of <em>two</em> Glyconics followed by an Asclepiad:</p>
<blockquote><p>–⏑ –⏑⏑– ⏑–<br />
–⏑ –⏑⏑– ⏑–<br />
–⏑ –⏑⏑– –⏑⏑– ⏑–</p></blockquote>
<p>Also, unlike Horace&#8217;s practice, I chose to use a short value on the second value of each line, and to keep the final value long; this keeps each line absolutely symmetrical, which adds to the character of this episode.</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-23-13.png"><img class="alignnone size-full wp-image-422" title="Concerto for Two Double Reeds IV Rondo: Episode III oboe theme" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-23-13.png?w=720" alt="Oboe theme of Episode III"   /></a></p>
<p>The melodic material for this episode is based entirely on whole-tone scales, alternating each bar between the two possible transpositions of this scale. The solo material makes a lot of the major 3rd that emerges from this scale, while the accompaniment, spaced in major 3rds, traces consecutive notes.</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-25-04.png"><img class="alignnone size-full wp-image-423" title="Concerto for Two Double Reeds IV Rondo: Episode III accompanying figuration" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-25-04.png?w=720" alt="Accompanying figuration in Violin I"   /></a></p>
<p>This episode falls into four sections:</p>
<ol>
<li>Melody in the oboe, scales in violins;</li>
<li>Melody in the bassoon, scales in viola and cello;</li>
<li>Melody in violin II and viola, harmonics in cello and double bass, scales in oboe and bassoon;</li>
<li>Scales in oboe, bassoon and upper strings, harmonics in cello and double bass, then inverting roles with the upper strings playing very high notes and the cello and bass playing scales.</li>
</ol>
<p>After these discursions into non-diatonic territory, we return at [N] to the final statements of the rondo theme. This time it is stated in the bassoon,  and is fully harmonised.The interruption from the first statement reappears here, with the oboe&#8217;s lead-in slightly altered, and then the theme reappears in counterpoint at [P], first in the bassoon with bar-spaced oboe arpeggi, then at b.297 in the oboe with constant bassoon arpeggi. These arpeggi take over at b.305 in both soloists and upper string, leading into the final statement of the theme at [Q], in both oboe and bassoon, with the string pizzicati replaced with arpeggi:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-30-23.png"><img class="alignnone size-full wp-image-424" title="Concerto for Two Double Reeds IV Rondo: Final statement of theme" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-30-23.png?w=720" alt="Rondo theme plus C/F# arpeggi"   /></a></p>
<p>At b. 321 the soloists abandon the rondo theme, picking up the movement&#8217;s opening material, and are joined by the entire orchestra playing this fanfare at b.329, before the movement closes with exact material that opened it, but across the whole ensemble:</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-33-39.png"><img class="alignnone size-full wp-image-425" title="Concerto for Two Double Reeds IV Rondo: Coda" src="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-33-39.png?w=720" alt="Opening theme brought back tutti as the coda."   /></a></p>
<p>I have to confess to feeling slightly ambivalent about this movement. It is unquestionably a crowd-pleaser, and I have a feeling it&#8217;s good fun to play, but its very richness in tunes and compelling rhythms raise nagging feelings that it&#8217;s rather superficial and <em>not serious music</em>. Perhaps the analysis on this page is something of an <em>apologia</em> for it: an attempt to show that there are actually plenty of <em>clever</em> ideas behind its appealing tunefulness and vampish character. Or perhaps I should just relax and enjoy it!</p>
<p>(*Please read my note on <a title="Copyright" href="http://blog.matthewbutt.com/copyright/">copyright</a>.)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/356/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=356&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/10/04/concerto-for-two-double-reeds-in-detail-iv-rondo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-04-at-22-09-39.png" medium="image">
			<media:title type="html">Monteverdi L&#039;Orfeo</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-20-53-09.png" medium="image">
			<media:title type="html">Monteverdi L&#039;Orfeo (modern notation)</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-04-10.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV. Finale opening oboe theme</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-13-07.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV. Final entire first oboe phrase</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-17-39.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV. Rondo: rondo theme</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-21-26-43.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV. Rondo: rondo theme with accompaniment</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-20-at-23-19-31.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV: Rondo, first episode</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-09-09.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Episode II theme</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-15-22.png" medium="image">
			<media:title type="html">Octatonic scale on C</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-18-56.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Episode II string writing</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/screen-shot-2011-09-05-at-22-13-28.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV. Rondo: rondo theme in violin and viola</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-23-13.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Episode III oboe theme</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-25-04.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Episode III accompanying figuration</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-30-23.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Final statement of theme</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/10/screen-shot-2011-10-04-at-23-33-39.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds IV Rondo: Coda</media:title>
		</media:content>
	</item>
		<item>
		<title>Dodecaphony and JavaScript</title>
		<link>http://blog.matthewbutt.com/2011/10/04/dodecaphony-and-javascript/</link>
		<comments>http://blog.matthewbutt.com/2011/10/04/dodecaphony-and-javascript/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 21:34:08 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=409</guid>
		<description><![CDATA[Serial technique is highly algorithmic way of generating musical ideas, and lends itself well to programming. In this post I&#8217;m going to sketch out a few bits of JavaScript I&#8217;ve been using to explore some of the possibilities of this technique. (For those unfamiliar with serialism, and the 12-tone technique in particular, it is a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=409&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Serial technique is highly algorithmic way of generating musical ideas, and lends itself well to programming. In this post I&#8217;m going to sketch out a few bits of JavaScript I&#8217;ve been using to explore some of the possibilities of this technique.</p>
<p>(For those unfamiliar with serialism, and the 12-tone technique in particular, it is a method for producing musical — typically pitch — material by taking a list of values as a starting point. Various transformations can then be applied to generate new sequences. The multiplicity of different sequences provides variation, whilst their relationships back to the original series can give a sense of repetition and unity in the resulting music.)</p>
<p>Let&#8217;s consider 12-tone serialism.</p>
<p>A prime row can be considered as a mapping function P from a <em>position</em> to a <em>pitch</em>.</p>
<p>If we have a row [0, 3, 5, 8, 11, 1, 6, 10, 4, 9, 2, 7], then we can define P as follows:</p>
<pre>P(0) =&gt; 0 
P(1) =&gt; 3 
P(2) =&gt; 5 
P(3) =&gt; 8 
P(4) =&gt; 11 
P(5) =&gt; 1 
P(6) =&gt; 6 
P(7) =&gt; 10 
P(8) =&gt; 4 
P(9) =&gt; 9 
P(10) =&gt; 2 
P(11) =&gt; 7</pre>
<p>On this basis, we can write a JavaScript function <code>prime</code> which will take an argument <em>n</em> and return the appropriate pitch class name. (You can play along by pasting the code samples into the JS console in your browser).</p>
<pre>var prime = (function () {
  var p = [0, 3, 5, 8, 11, 1, 6, 10, 4, 9, 2, 7];
  return function(n) {
    return p[n % 12]; // if a value of 12 or above is given, start from 0 again
  };
}());
prime(1); // =&gt; 3

prime(4); // =&gt; 11</pre>
<p>(I&#8217;ve used a module pattern here to instantiate the variable <code>p</code> just once, and keep it hidden from the external scope.)</p>
<p>I can also write another function <code>getPitches</code> which will take a mapping function and apply it to an array [0..11]:</p>
<pre>var getPitches = (function () {
  var d = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
  return function (callback) {
    return d.map(function(n) {
      return callback(n) % 12; // if the result is 12 or above, transpose down an octave
    });
  };
}()); 

getPitches(prime); 
// =&gt; [0, 3, 5, 8, 11, 1, 6, 10, 4, 9, 2, 7]
// or
getPitches(function(n) { return prime(n); }); 
// =&gt; [0, 3, 5, 8, 11, 1, 6, 10, 4, 9, 2, 7]</pre>
<p>We can now retrieve transformations of the row.</p>
<p>To get transpositions, re feed in <code>prime(n) + <em>x</em></code>:</p>
<pre>getPitches(function(n) { return prime(n) + 1; }); 
// =&gt; [1, 4, 6, 9, 0, 2, 7, 11, 5, 10, 3, 8]

getPitches(function(n) { return prime(n) + 4; }); 
// =&gt; [4, 7, 9, 0, 3, 5, 10, 2, 8, 1, 6, 11]</pre>
<p>To get the Inversion row, we use <code>12 - prime(n)</code>:</p>
<pre>getPitches(function(n) { return 12 - prime(n); }); 
// =&gt; [0, 9, 7, 4, 1, 11, 6, 2, 8, 3, 10, 5]

getPitches(function(n) { return 12 - prime(n) + 3; }); 
// =&gt; [3, 0, 10, 7, 4, 2, 9, 5, 11, 6, 1, 8]</pre>
<p>To form the Retrograde we use <code>prime(11 - n)</code>:</p>
<pre>getPitches(function(n) { return prime(11 - n); }); 
// =&gt; [7, 2, 9, 4, 10, 6, 1, 11, 8, 5, 3, 0]

getPitches(function(n) { return prime(11 - n) + 3; }); 
// =&gt; [10, 5, 0, 7, 1, 9, 4, 2, 11, 8, 6, 3]</pre>
<p>(The discrepancy between subtracting from <em>12</em> for the Inversion and <em>11</em> for the Retrograde is because we expect the Inversion to start on the same pitch, while the Retrograde moves the starting pitch to the end.)</p>
<p>And of course we can get the Retrograde Inversion with <code>12 - prime(11 - n)</code>:</p>
<pre>getPitches(function(n) { return 12 - prime(11 - n); }); 
// =&gt; [5, 10, 3, 8, 2, 6, 11, 1, 4, 7, 9, 0]

getPitches(function(n) { return 12 - prime(11 - n) + 3; }); 
// =&gt; [8, 1, 6, 11, 5, 9, 2, 4, 7, 10, 0, 3]</pre>
<p>In addition to these transformations, we can rotate the row (so, for instance, we start with the third value in the series):</p>
<pre>getPitches(function(n) { return prime(n + 2); });
// =&gt; [5, 8, 11, 1, 6, 10, 4, 9, 2, 7, 0, 3]</pre>
<p>And we can also experiment with multiplication:</p>
<p>Multiplying the argument passed into <code>prime</code> <em>viz</em> <code>prime(n * <em>x</em></code> will jumpt between elements in the original series. If the multiplier is a factor of 12, then we will get a result that repeats a subsequence of the original; if it&#8217;s not a factor, then we will get a reordering:</p>
<pre>getPitches(function(n) { return prime(n * 2); });
// =&gt; [0, 5, 11, 6, 4, 2, 0, 5, 11, 6, 4, 2]

getPitches(function(n) { return prime(n * 3); });
// =&gt; [0, 8, 6, 9, 0, 8, 6, 9, 0, 8, 6, 9]

getPitches(function(n) { return prime(n * 4); });
// =&gt; [0, 11, 4, 0, 11, 4, 0, 11, 4, 0, 11, 4]

getPitches(function(n) { return prime(n * 5); });
// =&gt; [0, 1, 2, 8, 4, 3, 6, 7, 11, 9, 5, 10]

getPitches(function(n) { return prime(n * 6); });
// =&gt; [0, 6, 0, 6, 0, 6, 0, 6, 0, 6, 0, 6]

getPitches(function(n) { return prime(n * 7); });
// =&gt; [0, 10, 5, 9, 11, 7, 6, 3, 4, 8, 2, 1]

getPitches(function(n) { return prime(n * 8); });
// =&gt; [0, 4, 11, 0, 4, 11, 0, 4, 11, 0, 4, 11]

getPitches(function(n) { return prime(n * 9); });
// =&gt; [0, 9, 6, 8, 0, 9, 6, 8, 0, 9, 6, 8]

getPitches(function(n) { return prime(n * 10); });
// =&gt; [0, 2, 4, 6, 11, 5, 0, 2, 4, 6, 11, 5]

getPitches(function(n) { return prime(n * 11); });
// =&gt; [0, 7, 2, 9, 4, 10, 6, 1, 11, 8, 5, 3]

getPitches(function(n) { return prime(n * 12); });
// =&gt; [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</pre>
<p>Note the following properties of these series:</p>
<ol start="2">
<li>Maps to 6 pitches, repeated twice</li>
<li>Maps to 4 pitches, repeated thrice</li>
<li>Maps to 3 pitches, repeated four times</li>
<li>Remaps all pitches</li>
<li>Maps to 2 pitches (the fact that they are 0 and 6 is a propert of the Prime row, rather than this ordering)</li>
<li>Remaps all pitches, 0-based Retrograde of 5</li>
<li>Maps to 3 pitches, 0-based Retrograde of 4</li>
<li>Maps to 4 pitches, 0-based Retrograde of 3</li>
<li>Maps to 6 pitches, 0-based Retrograde of 2</li>
<li>0-based Retrograde of Prime</li>
<li>Degenerate case: maps to just one pitch</li>
</ol>
<p>Feeding in <code>prime(n) * <em>x</em></code> remaps the pitches, rather than their ordering:</p>
<pre>getPitches(function(n) { return prime(n) * 2; });
// =&gt; [0, 6, 10, 4, 10, 2, 0, 8, 8, 6, 4, 2]

getPitches(function(n) { return prime(n) * 3; });
// =&gt; [0, 9, 3, 0, 9, 3, 6, 6, 0, 3, 6, 9]

getPitches(function(n) { return prime(n) * 4; });
// =&gt; [0, 0, 8, 8, 8, 4, 0, 4, 4, 0, 8, 4]

getPitches(function(n) { return prime(n) * 5; });
// =&gt; [0, 3, 1, 4, 7, 5, 6, 2, 8, 9, 10, 11]

getPitches(function(n) { return prime(n) * 6; });
// =&gt; [0, 6, 6, 0, 6, 6, 0, 0, 0, 6, 0, 6]

getPitches(function(n) { return prime(n) * 7; });
// =&gt; [0, 9, 11, 8, 5, 7, 6, 10, 4, 3, 2, 1]

getPitches(function(n) { return prime(n) * 8; });
// =&gt; [0, 0, 4, 4, 4, 8, 0, 8, 8, 0, 4, 8]

getPitches(function(n) { return prime(n) * 9; });
// =&gt; [0, 3, 9, 0, 3, 9, 6, 6, 0, 9, 6, 3]

getPitches(function(n) { return prime(n) * 10; });
// =&gt; [0, 6, 2, 8, 2, 10, 0, 4, 4, 6, 8, 10]

getPitches(function(n) { return prime(n) * 11; });
// =&gt; [0, 9, 7, 4, 1, 11, 6, 2, 8, 3, 10, 5]

getPitches(function(n) { return prime(n) * 12; });
// =&gt; [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</pre>
<p>Note the pitch-sets that these values of <em>x</em> map to:</p>
<ol start="2">
<li>Whole-tone scale</li>
<li>Diminished 7th</li>
<li>Augmented triad</li>
<li>Full chromatic remapping</li>
<li>Tritone</li>
<li>Full chromatic remapping, Inversion of 5</li>
<li>Augmented triad, Inversion of 4</li>
<li>Diminished 7th, Inversion of 3</li>
<li>Whole-tone scale, Inversion of 2</li>
<li>Chromatic scale, Inversion of Prime</li>
<li>Degenerate case: unison</li>
</ol>
<p>From these two multiplicative transformations, we have new ways to define Inversion and Retrogression, and also a realm of other possible transformations. We can write something like this:</p>
<pre>getPitches(function(n) { return prime(n * 5 + 8) * 7 + 4; });
// =&gt; [8, 1, 10, 5, 9, 7, 3, 2, 4, 11, 6, 0]</pre>
<p>and know that the material is still explicitly derived from the original series.</p>
<p>These examples are just a few first examples of the generative power of a few simple lines of JavaScript. Next time I want to investigate what happens when you reflect the position/pitch axis, and introduce a way to deal with negative numbers, but this is enough for one evening!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/409/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=409&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/10/04/dodecaphony-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>HATEOAS Console: the beginning</title>
		<link>http://blog.matthewbutt.com/2011/09/18/hateoas-console-the-beginning/</link>
		<comments>http://blog.matthewbutt.com/2011/09/18/hateoas-console-the-beginning/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 14:35:03 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[hateoas]]></category>
		<category><![CDATA[hateoas-console]]></category>
		<category><![CDATA[innovation]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=375</guid>
		<description><![CDATA[At 7digital we have 2 days&#8217; innovation time every month. During this time we can work on our own pet projects. This post is about my current project. You can find the source of this project at https://github.com/bnathyuw/Hateoas-Console Introduction RESTful web architecture is becoming increasingly influential in the design of both web services and web sites, but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=375&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://www.7digital.com/">7digital</a> we have 2 days&#8217; <strong>innovation time </strong>every month. During this time we can work on our own pet projects. This post is about my current project.</p>
<p>You can find the source of this project at <a href="https://github.com/bnathyuw/Hateoas-Console">https://github.com/bnathyuw/Hateoas-Console</a></p>
<h2>Introduction</h2>
<p>RESTful web architecture is becoming increasingly influential in the design of both web services and web sites, but it is still very easy to produce half-hearted implementations of it, and the tools that exist don&#8217;t always help.</p>
<p>In this project, I want to address this problem by building a new REST console that will:</p>
<ul>
<li>Reward good implementations by making it easy to take advantage of all their RESTful features;</li>
<li>Help improve less good implementations by exposing their shortcomings.</li>
</ul>
<h3>Basic principles of a RESTful interface</h3>
<p>Richardson and Ruby (2007 pp. 79 ff.) present a good analysis of RESTful interface design. Drawing on Fielding (2000 s. 5), but with a focus on actual practice, they identify four key principles or Resource-Oriented Architecture:</p>
<ol>
<li>Addressability;</li>
<li>Statelessness;</li>
<li>Connectedness;</li>
<li>Uniform Interface.</li>
</ol>
<p><strong>Addressability </strong>means that any resource in the application that a consumer could want to know about has at least one URI. This criterion is fairly coextensive with Fielding&#8217;s <em>Identification of Resources</em> requirement.</p>
<p><strong>Statelessness </strong>means that every request should contain all the information needed for its processing. This overlaps with Fielding&#8217;s requirement that messages be <em>self-descriptive</em>, and that <em>hypermedia be the representation of application state</em>.</p>
<p><strong>Connectedness </strong>means that each resource representation should give addresses of all related resources. The most effective way to ensure connectedness will often be to produce an entry-point resource, from which it is possible to navigate to all other resources. This furnishes the other part of Fielding&#8217;s requirement for <em>hypermedia as the engine of application state</em>.</p>
<p><strong>Uniform Interface</strong> means that all resources can be manipulated in the same way. For web services, this almost invariably means using the HTTP verbs, viz <code>DELETE</code>, <code>HEAD</code>, <code>GET</code>, <code>OPTIONS</code>, <code>POST</code>, <code>PUT</code> &amp;c. This principle supports Fielding&#8217;s <em>self-description</em> criterion, and specifies the means of <em>manipulation of resources.</em></p>
<p>Most REST consoles are fairly successful in accommodating principles 1, 2 and 4, but fail significantly in accommodating principle 3. Under Fielding&#8217;s terminology, existing REST consoles give little support for <em>hypermedia as the engine of application state </em>(HATEOAS).</p>
<h3>Existing REST consoles</h3>
<p>There exist several good consoles for manually consuming RESTful services. These include:</p>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/fhjcajmcbmldlhcimfajhfbgofnpcjmb">Simple REST Client</a> for Chrome;</li>
<li><a href="https://github.com/chao/RESTClient">REST Client for Firefox</a>;</li>
<li><a href="http://apigee.com/">apigee</a>.</li>
</ul>
<figure><a href="http://matthewbutt.files.wordpress.com/2011/09/simple-rest-client-for-chrome.png"><img class="alignnone size-medium wp-image-385" title="Simple REST Client for Chrome" src="http://matthewbutt.files.wordpress.com/2011/09/simple-rest-client-for-chrome.png?w=300&h=280" alt="Screenshot: Simple REST Client for Chrome" width="300" height="280" /></a><br />
<figcaption>Simple REST Client for Chrome</figcaption>
</figure>
<figure><a href="http://matthewbutt.files.wordpress.com/2011/09/rest-client-for-firefox.png"><img class="alignnone size-medium wp-image-384" title="REST Client for Firefox" src="http://matthewbutt.files.wordpress.com/2011/09/rest-client-for-firefox.png?w=300&h=209" alt="Screen shot of REST Client for Firefox" width="300" height="209" /></a><br />
<figcaption>REST Client for Firefox</figcaption>
</figure>
<figure><a href="http://matthewbutt.files.wordpress.com/2011/09/apigee.png"><img class="alignnone size-medium wp-image-386" title="apigee" src="http://matthewbutt.files.wordpress.com/2011/09/apigee.png?w=300&h=280" alt="Screenshot: apigee" width="300" height="280" /></a></p>
<figcaption>apigee</figcaption>
</figure>
<p>All of these clients work on a similar model: you enter a URI in the address box, choose an HTTP verb and click a button to send the request. You also have the option of adding headers and a request body. The headers and content of the response are then displayed on screen for the user to inspect.</p>
<h3>How these consoles support the REST principles</h3>
<h4>Addressability</h4>
<p>Addressability is a core notion in these consoles: the address box is a primary part of the UI, and you have to enter something here in order to make a request.</p>
<h4>Statelessness</h4>
<p>Statelessness is perhaps the easiest of the four principles to achieve, as the consoles operate on a request-response model.</p>
<p>In fact, what is useful in a console is the very opposite of statelessness: the console should be able to remember your preferences so that you do not have to enter them for each request.</p>
<p>With a significant exception discussed below, all three consoles do a fair job of remembering your choice of headers from one request to another, which takes some of the burden off the user. Apigee and REST Client for Firefox are also able handle OAuth authentication, which is a nice feature.</p>
<h4>Connectedness</h4>
<p>None of the consoles deals successfully with connectedness. If you want to follow a link from the response, you have to copy the resource URI into the address box and submit another request.</p>
<p>Apigee differs from the other two consoles in having a side panel which lists the principle URI schemata for the service under test. This initially seems like a helpful feature, but has several unfortunate consequences:</p>
<ul>
<li>Apigee uses WADL to create its directory of links. This encourages a return to the RPC-stle of service architecture, which thinks of a web service as being made up of a limited set of discrete endpoints, each with a particular purpose, rather than an unlimited network of interconnected resources which can be manipulated through a uniform interface.</li>
<li>As the endpoints are listed in the directory panel, it is less obvious when a resource does not contain links to related resources.</li>
<li>Apigee has no way of filling in variable parts of a URI. If, for instance, you click <code>me/favourites/track_id (PUT)</code>, it enters <code>https://api.soundcloud.com/me/favorites/{track_id}.json</code> in the address box. You then have to replace <code>{track_id}</code> with the specific track ID you are interested in. This is of course no help if you don&#8217;t know which track you want to add to your favourites!</li>
<li>Each endpoint is listed with a <code>.json</code> suffix, no matter what format you have just requested. Also, any request headers you have filled in are forgotten when you click on a new endpoint.</li>
</ul>
<p>These shortcomings not only make the console frustrating to use, but also encourage non-connected, RPC-style architectural decisions.</p>
<h4>Uniform Interface</h4>
<p>As with Addressability, the Uniform Interface is at the core of these consoles. The HTTP verb selector is prominent in each UI, and it is easy to switch from one to another.</p>
<p>Apigee supports <code>GET</code>, <code>POST</code>, <code>DELETE</code> and <code>PUT</code>, Simple <code>REST</code> Client for Chrome adds support for <code>HEAD</code> and <code>OPTIONS</code>, and REST Client for Firefox adds support for <code>TRACE</code>, as well as several more obscure verbs.</p>
<p>What none of these consoles does is make any attempt to figure out what representation of a resource should be submitted in a <code>POST</code> or <code>PUT</code> request body. This is particularly surprising in Apigee, as this information should be available in the API WADL document.</p>
<h3>Conclusion</h3>
<p>There are close points of comparison between a REST console and a web browser: each is designed to make requests from a particular URI using one of a small number of HTTP verbs, and then display a representation of that resource to the user. What makes a web browser so powerful — and indeed was one of the founding principles of the internet — is that the user can click on links to get from one page to another. When you the primacy of the clickable link to the success of browsers it becomes all the more puzzling that REST consoles do not implement this functionality.</p>
<h2>The Project</h2>
<h3>Basic principles</h3>
<p>The purpose of this project is to attempt to address some of the shortcomings of the currently available REST consoles, while retaining their good features:</p>
<ul>
<li>The basic format of the existing consoles is successful: an address box, and verb chooser, and a send button;</li>
<li>Rendering all details of the response is also vital; REST Client for Firefox gives you choice of viewing raw and rendered data, which is a nice additional feature;</li>
<li>The client should support as wide as possible a range of HTTP verbs, encompassing at least <code>GET</code>, <code>POST</code>, <code>PUT</code>, <code>DELETE</code>, <code>OPTIONS</code>, <code>HEAD</code>;</li>
<li>The ability to remember headers is very useful and should be kept, especially when clicking on a link;</li>
<li>OAuth integration is a nice feature and worth implementing if possible;</li>
<li>It would be very useful for the console to make a reasonable attempt at figuring out the response body format for <code>PUT</code> and <code>POST</code> requests;</li>
<li>Reliance on a WADL document encourages unRESTful thinking and should be avoided.</li>
<li>All appropriate links in the response body should be identified, and it should be simple to make further requests and to explore the API by clicking on them.</li>
</ul>
<h3>Implementation decisions</h3>
<p>I decided to implement this project in HTML and JavaScript, as this seemed the most portable platform. I am working on the assumption that the finished product will be a chrome extension, as this lets me make some simplifying assumptions about the capabilities of the browser environment, and may also help solve some security issues.</p>
<h2>References</h2>
<ul>
<li>Fielding, Roy Thomas (2000). <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm"><cite>Architectural Styles and the Design of Network-based Software Architectures</cite></a>. Doctoral dissertation, University of California, Irvine.</li>
<li>Richardson, Leonard; Ruby, Sam (2007). <cite>RESTful Web Services</cite>. O&#8217;Reilly Media.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=375&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/09/18/hateoas-console-the-beginning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/simple-rest-client-for-chrome.png?w=300" medium="image">
			<media:title type="html">Simple REST Client for Chrome</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/rest-client-for-firefox.png?w=300" medium="image">
			<media:title type="html">REST Client for Firefox</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/09/apigee.png?w=300" medium="image">
			<media:title type="html">apigee</media:title>
		</media:content>
	</item>
		<item>
		<title>Site scans: a RESTful case study</title>
		<link>http://blog.matthewbutt.com/2011/09/18/site-scans-a-restful-case-study/</link>
		<comments>http://blog.matthewbutt.com/2011/09/18/site-scans-a-restful-case-study/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 11:31:10 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[addressability]]></category>
		<category><![CDATA[case studies]]></category>
		<category><![CDATA[findability]]></category>
		<category><![CDATA[resource design]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=391</guid>
		<description><![CDATA[I&#8217;ve been thinking a lot recently about REST, resource design and addressability, so I was interested to read an article by Troy Hunt on the particular challenges of creating URLs that refer to other URLs. Scenario The scenario Troy describes is for a site that will perform a security scan of your website, and then [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=391&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking a lot recently about REST, resource design and addressability, so I was interested to read an <a href="http://www.troyhunt.com/2011/09/to-route-or-not-to-route-that-is.html">article by Troy Hunt on the particular challenges of creating URLs that refer to other URLs</a>.</p>
<h2>Scenario</h2>
<p>The scenario Troy describes is for a site that will perform a security scan of your website, and then show a report of the result. Addressability is an important concern, as once you have the results of the scan, you may want to forward them to other people.</p>
<p>Troy discusses two methods for including the URL to scan:</p>
<ol>
<li>Include it in the <em>hierarchical part</em> of the URL (ie, the part after <code>http:</code> and before <code>?</code>, eg <code>http://asafaweb.com/scan/<em>troyhunt.com/Search</em></code>)</li>
<li>Include it in the query string, eg <code>http://asafaweb.com/scan?url=<em>troyhunt.com/Search.</em></code></li>
</ol>
<p>He favours the second approach for practical reasons.</p>
<h2>A RESTful approach</h2>
<p>Troy&#8217;s article approaches this question from the point of view of addressability, rather than resource design, and makes a sensible recommendation given the basic premisses; however, the scenario he outlines presents a good opportunity to do a bit of resource design analysis, which can lead us to an even better answer.</p>
<p>First then, let&#8217;s think about the type of resource we&#8217;re dealing with.</p>
<p>I think it is fair to make a few assumptions about the <em>scan</em> resource and the application that generates it:</p>
<ul>
<li>It will take some time to perform the scan;</li>
<li>It will take a fair amount of computing resources to perform the scan;</li>
<li>The scan will be accurate for the point in time at which it was created; a subsequent scan of the same URL may generate a different result;</li>
<li>It may be interesting to compare scans over time.</li>
</ul>
<p>From these assumptions we can draw a few conclusions:</p>
<ul>
<li>A <em>scan</em> is an expensive resource to create, and will have a series of different statuses over its lifetime; this means we are looking at a transactional resource model here;</li>
<li>As a URL can be scanned more than once, it is not on its own a sufficient identifier of any scan.</li>
</ul>
<p>If we follow these conclusions, we can make a sketch of the process of performing a scan:</p>
<h3>1. Trigger the scan</h3>
<p>We make a <code>POST</code> request with the details of the scan we want:</p>
<pre>POST http://asafaweb.com/scans
{ "url": "http://troyhunt.com/Search", "options": {…} }</pre>
<p>Note that we are <code>POST</code>ing to <code>/scans</code>; this request will create resource subordinate to that collection. Also, as we are making a <code>POST</code> request, we can include further information about the scan we want, perhaps indicating which criteria we are interested in and what level of detail we require; I have indicated this possibility by including an <code>options</code> parameter.</p>
<p>The server responds not by showing us the results of the scan — they haven&#8217;t been produced yet —, but by telling us where to look for the results:</p>
<pre>201 Created

http://asafaweb.com/scans/<em>{xyz}</em></pre>
<h3>2. Check the scan URL</h3>
<p>We can go and check this URL straight away by performing a <code>GET</code>:</p>
<pre>GET http://asafaweb.com/scans/<em>{xyz}</em></pre>
<p>As the scan is still running, we don&#8217;t see the results, but rather a representation of a scan that is still in progress:</p>
<pre>200 OK 
{ "scan": {
  "status": "in progress", 
  "url": "http://troyhunt.com/Search", 
  "created": "2011-09-18 11:57:00.000", 
  "options": {…} 
} }</pre>
<p>Indeed, if there are a large requests for scans, Troy may have to implement a queueing system, and our scan may have a <code>status</code> of <code>"queued"</code> until it can be processed; we could even cancel a scan by <code>PUT</code>ting a representation with a <code>status</code> of <code>"cancelled"</code> to its URL, or perhaps simply by issuing a <code>DELETE</code> request.</p>
<h3>3. Retrieve the scan</h3>
<p>A little while later, the scan has completed. Perhaps we keep performing a <code>GET</code> on its URL until it&#8217;s done; perhaps we have submitted an email address in the initial <code>POST</code>, and have now received email notification that it is ready.</p>
<p>We perform another GET to see the results:</p>
<pre>GET http://asafaweb.com/scans/<em>{xyz}</em></pre>
<p>And the server responds:</p>
<pre>200 OK 
{ "scan": {
  "status": "complete", 
  "url": "http://troyhunt.com/Search", 
  "created": "2011-09-18 11:57:00.000", 
  "options": {…}, 
  "results": {…} 
} }</pre>
<p>We can now send the URL <code>http://asafaweb.com/scans/<em>{xyz} </em></code>to  other people, and they will see the same results. The server doesn&#8217;t have to rescan the site, so retrieving these results can be a quick, inexpensive operation.</p>
<h3>4. Search for scans</h3>
<p>Throughout this example, I have used <code><em>{xyz}</em></code> to indicate the unique identifier of the scan. I have deliberately not given details of what this identifier might be. However, as I said earlier, the URL to scan is not a sufficient identifier, as we want to allow the possibility of scanning the same URL more than once. This identifier <em>could</em> include the URL, but this may not be the ideal solution, both for the technical reasons that Troy indicates in his article, and because this will produce very long identifiers, where we could probably make do with short strings of characters.</p>
<p>The result of this is that we have a system that is eminently addressable, but which uses identifiers that bear an opaque relationship to the scanned URL, and fails the findability criterion. I can easily send a URL like <code>http://asafaweb.com/scans/f72bw8</code> to a friend, but if they do not have that address, they have no way of guessing that this is the address of a scan of my site.</p>
<p>To remedy this, we can implement a search interface. We already have an address for the entire collection of scans, viz <code>/scans</code>, so  now we can just refine the response to a request of this URL with a query parameter:</p>
<pre>GET http://asafaweb.com/scans?url=http://troyhunt.com/Search</pre>
<p>The server can then respond with a listing of all the scans that meet these criteria:</p>
<pre>200 OK
{ "scans": {
  "url": "http://troyhunt.com/Search",
  "results": [
    {
      "status": "complete",
      "created": "2011-09-18 11:57:00.000",
      "link": {
        href: "http://asafaweb.com/scans/f72bw8"
      }
    }, 
    {
      "status": "complete",
      "created": "2011-08-28 17:36:24.023",
      "link": {
        href: "http://asafaweb.com/scans/89ew2p"
      }
    }, 
  ]
} }</pre>
<p>Each result has a link to its location, so all results can be retrieved at any time.</p>
<p>By recognising that our scans are resources that can be searched, and by providing a means to perform that search, we have restored findability to our interface. Also, the fact that our search criterion is a refinement of a more general request, and thus appears in the query string, means that we arrive at a very similar conclusion the one Troy reaches in his article, but this time for reasons based on resource design, rather than practicality.</p>
<h2>Applicability to web sites</h2>
<p>I have given all my examples in JSON, as it offers a concise and easy-to-read format for technical discussions. However, all of this discussion would work equally well with HTML web pages:</p>
<ol>
<li>The user fills in and submits a form to request a scan, and is redirected to the scan page;</li>
<li>The scan page shows a message telling the user the scan is in progress;</li>
<li>After a while a page refresh reveals the results of the scan, and the user can send the page URL to their contacts;</li>
<li>The <code>/scans</code> page offers a search form into which the user can enter their URL and retrieve a list of all the dated scans for that location.</li>
</ol>
<p>A couple of the implementation details will differ, because of the limited number of HTTP verbs and status codes that browsers can deal with, but the principles are exactly the same.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=391&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/09/18/site-scans-a-restful-case-study/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>
	</item>
		<item>
		<title>Concerto for Two Double Reeds in detail: III — Loops</title>
		<link>http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-iii-loops/</link>
		<comments>http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-iii-loops/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 15:38:16 +0000</pubDate>
		<dc:creator>bnathyuw</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[bassoon]]></category>
		<category><![CDATA[composition]]></category>
		<category><![CDATA[oboe]]></category>

		<guid isPermaLink="false">http://blog.matthewbutt.com/?p=351</guid>
		<description><![CDATA[This is the third in a series of post-performance analyses of my Concerto for Two Double Reeds. You can also read about I — Tessellations and II — Meta-Canon. The structure of this movement is fairly simple, building up a contrapuntal structure over a double-bass ostinato. Click here to have a look at the score or listen [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=351&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the third in a series of post-performance analyses of my Concerto for Two Double Reeds. You can also read about <a href="http://blog.matthewbutt.com/2011/08/03/concerto-for-two-double-reeds-in-detail-i-tessellations/">I — Tessellations</a> and <a href="http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-ii-meta-canon/">II — Meta-Canon</a>.</p>
<p>The structure of this movement is fairly simple, building up a contrapuntal structure over a double-bass ostinato. Click here to <a href="http://media.matthewbutt.com/concerto-for-two-double-reeds/III.pdf">have a look at the score</a> or <a href="http://soundcloud.com/bnathyuw/concerto-for-two-double">listen to the live recording</a>*.</p>
<p>The ostinato itself is made of two 4-bar phrases, each repeated. Each phrase has 12 notes: each of the notes of the pentatonic scale, although the sequence is not used as a row. The rhythm alternates between 3-quaver and 2-quaver beats to give a distinctive rhythmic identity to the whole movement.</p>
<p><a href="http://matthewbutt.files.wordpress.com/2011/08/screen-shot-2011-08-07-at-16-01-24.png"><img class="alignnone size-full wp-image-352" title="Concerto for Two Double Reeds : III — Loops ; bassline" src="http://matthewbutt.files.wordpress.com/2011/08/screen-shot-2011-08-07-at-16-01-24.png?w=720" alt="Bassline. Two 4-bar phrases repeated"   /></a></p>
<p>Over this ostinato, the bassoon and orchestra conduct a dialogue which builds up a contrapuntal texture. High in my mind at the time of writing this were <a href="http://www.kerryandrew.net/">Kerry Andrew</a>&#8216;s wonderful performances of folk songs, delivered live with just a loop console for accompaniment. I love the textures she can create by laying down one part over another, and the way the piece slowly comes together, and wanted to explore this idea with an ensemble, acoustic piece. Another image that springs into my mind with this music is that of a 3D printer, which can create a solid artefact by laying down layer upon layer of 2-dimensional material.</p>
<p>The movement is divided into 16-bar sections. In each, the bassoon plays two 4-bar phrases, each of which is then repeated immediately in the strings. In the following section, the string part that has already been layed down is played again, and the new material is played by the next part up. This means that the cellos repeat their material 4 times, whereas the first violins only get one exposition.</p>
<p>This cumulative structure is repeated twice, with different material. In the first, the material of the ostinato is performed first, and played by the cellos (as well as continuing in the double bass); in the second part, this material is saved for the last entry, and appears in the first violins. As each section builds up, the dynamic increases; at the end of Section 1 we drop back to 16 bars of ostinato played pianissimo in the double bass; at the end of Section 2 we hear the ostinato played in octaves by all the performers, crescendo to fortississimo, and which point the movement stops dead.</p>
<p>The material is fairly straightforward. Some phrases are derived from the ostinato, and others play with chains of intervals. My intention was that there should be a range of different syncopations, so as to achieve a rhythmic counterpoint alongside the melodic counterpoint. I made no attempt to inject any harmonic meaning into the parts, but made sure there was a good range of tessitura so as to keep the identities of the parts fairly distinct.</p>
<p><strong>Note:</strong> if you would like to listen to a recording of this performance, please get in touch and I can send you a link.</p>
<p>(*Please read my note on <a title="Copyright" href="http://blog.matthewbutt.com/copyright/">copyright</a>.)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/matthewbutt.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/matthewbutt.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/matthewbutt.wordpress.com/351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.matthewbutt.com&#038;blog=10497976&#038;post=351&#038;subd=matthewbutt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.matthewbutt.com/2011/08/07/concerto-for-two-double-reeds-in-detail-iii-loops/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88d2c6c3a67a4f904d6c01e113abcf54?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bnathyuw</media:title>
		</media:content>

		<media:content url="http://matthewbutt.files.wordpress.com/2011/08/screen-shot-2011-08-07-at-16-01-24.png" medium="image">
			<media:title type="html">Concerto for Two Double Reeds : III — Loops ; bassline</media:title>
		</media:content>
	</item>
	</channel>
</rss>
