<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Blueprint Forge.]]></title>
  <link href="/atom.xml" rel="self"/>
  <link href="/"/>
  <updated>2012-01-10T10:35:36+00:00</updated>
  <id>https://blueprintforge.com/</id>
  <author>
    <name><![CDATA[Matt Cottingham]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Python: Injecting Mock Objects for Powerful Testing]]></title>
    <link href="/blog/2012/01/08/python-injecting-mock-objects-for-powerful-testing/"/>
    <updated>2012-01-08T11:10:00+00:00</updated>
    <id>https://blueprintforge.com/blog/2012/01/08/python-injecting-mock-objects-for-powerful-testing</id>
    <content type="html"><![CDATA[<p><em>The code discussed in this post can be <a href="https://github.com/MattCottingham/pyclientauth/">found in the github repository</a>.</em></p>

<p>While writing a module to handle Google ClientLogin recently, I wanted to test error handling by simulating error
responses from the server. A simple but powerful way of doing this is to use the
<a href="http://pypi.python.org/pypi/mock">patching ability</a> of the <code>mock</code> module.</p>

<p>The patching ability allows you to replace objects in scope with mocks so that different side effects or return values can be defined. Note that &#8216;object&#8217; is used here in the pythonic sense &#8211; referring to entities such as modules and functions as well as class instances.</p>

<p>This is best illustrated by a real example, so in this post we&#8217;re going to mock the <code>requests</code> module and generate
the exceptions described in the
<a href="http://docs.python-requests.org/en/latest/user/quickstart/#errors-and-exceptions">documentation</a> when a request is made.</p>

<p>Our example module sends credentials to Google&#8217;s ClientLogin service in order to receive an authentication token, required for accessing certain Google services (such as C2DM). If you are interested, you can read more about ClientLogin on the <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html">Google Code page</a>.</p>

<p>So, to request an authentication token from the ClientLogin service, you <code>POST</code> a set of parameters including email and password to the service endpoint. Here is a cut-down version of the code that initiates the authentication request:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="k">class</span> <span class="nc">Authenticator</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
</span><span class='line'>
</span><span class='line'>    <span class="nd">@staticmethod</span>
</span><span class='line'>    <span class="k">def</span> <span class="nf">generate_token</span><span class="p">(</span><span class="n">email</span><span class="p">,</span> <span class="n">password</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span>
</span><span class='line'>                       <span class="n">account_type</span><span class="o">=</span><span class="s">&#39;GOOGLE&#39;</span><span class="p">,</span> <span class="n">service</span><span class="o">=</span><span class="s">&#39;ac2dm&#39;</span><span class="p">):</span>
</span><span class='line'>
</span><span class='line'>        <span class="sd">&quot;&quot;&quot;Returns an auth token for the supplied service.&quot;&quot;&quot;</span>
</span><span class='line'>
</span><span class='line'>        <span class="n">base_url</span> <span class="o">=</span> <span class="s">&#39;https://www.google.com/accounts/ClientLogin&#39;</span>
</span><span class='line'>
</span><span class='line'>        <span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
</span><span class='line'>            <span class="s">&#39;content-type&#39;</span><span class="p">:</span> <span class="s">&#39;application/x-www-form-urlencoded&#39;</span><span class="p">,</span>
</span><span class='line'>        <span class="p">}</span>
</span><span class='line'>
</span><span class='line'>        <span class="n">payload</span> <span class="o">=</span> <span class="p">{</span>
</span><span class='line'>            <span class="s">&#39;Email&#39;</span><span class="p">:</span> <span class="n">email</span><span class="p">,</span>
</span><span class='line'>            <span class="s">&#39;Passwd&#39;</span><span class="p">:</span> <span class="n">password</span><span class="p">,</span>
</span><span class='line'>            <span class="s">&#39;source&#39;</span><span class="p">:</span> <span class="n">source</span><span class="p">,</span>
</span><span class='line'>            <span class="s">&#39;accountType&#39;</span><span class="p">:</span> <span class="n">account_type</span><span class="p">,</span>
</span><span class='line'>            <span class="s">&#39;service&#39;</span><span class="p">:</span> <span class="n">service</span><span class="p">,</span>
</span><span class='line'>        <span class="p">}</span>
</span><span class='line'>
</span><span class='line'>        <span class="k">try</span><span class="p">:</span>
</span><span class='line'>            <span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="n">base_url</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">payload</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">)</span>
</span><span class='line'>        <span class="k">except</span><span class="p">(</span><span class="n">RequestException</span><span class="p">):</span>
</span><span class='line'>            <span class="k">raise</span>
</span></code></pre></td></tr></table></div></figure>


<p>If the <code>requests.post</code> method throws an exception, we simply <code>raise</code> it to the caller rather than handling it immediately.
In the <code>requests</code> module, <code>RequestException</code> is the base class from which others (like <code>ConnectionError</code>) inherit. We could improve our approach to exception handling but it is sufficient for this example.</p>

<p>These exceptions will be thrown from our mocked class, which is patched into the above code using a context manager:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="kn">import</span> <span class="nn">unittest2</span> <span class="kn">as</span> <span class="nn">unittest</span>
</span><span class='line'><span class="kn">from</span> <span class="nn">requests.exceptions</span> <span class="kn">import</span> <span class="n">RequestException</span><span class="p">,</span> <span class="n">ConnectionError</span>
</span><span class='line'><span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span>
</span><span class='line'><span class="kn">from</span> <span class="nn">clientlogin</span> <span class="kn">import</span> <span class="n">Authenticator</span>
</span><span class='line'>
</span><span class='line'><span class="k">class</span> <span class="nc">AuthenticationTests</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">def</span> <span class="nf">test_connection_error</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>        <span class="k">with</span> <span class="n">patch</span><span class="o">.</span><span class="n">object</span><span class="p">(</span><span class="n">requests</span><span class="p">,</span> <span class="s">&#39;post&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">mock_method</span><span class="p">:</span>
</span><span class='line'>            <span class="n">mock_method</span><span class="o">.</span><span class="n">side_effect</span> <span class="o">=</span> <span class="n">ConnectionError</span>
</span><span class='line'>            <span class="n">Authenticator</span><span class="o">.</span><span class="n">generate_token</span><span class="p">(</span><span class="s">&#39;mail@example.com&#39;</span><span class="p">,</span><span class="s">&#39;password&#39;</span><span class="p">,</span><span class="s">&#39;tag&#39;</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>Here, we have patched the <code>post</code> method in the <code>requests</code> module to throw a <code>ConnectionError</code>. You can think of this like code injection, where <code>with</code> acts as the closure.</p>

<p>In the real test method, we assert the exception was raised with another context manager:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="k">def</span> <span class="nf">test_connection_error</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>    <span class="k">with</span> <span class="n">patch</span><span class="o">.</span><span class="n">object</span><span class="p">(</span><span class="n">requests</span><span class="p">,</span> <span class="s">&#39;post&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">mock_method</span><span class="p">:</span>
</span><span class='line'>        <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">RequestException</span><span class="p">):</span>
</span><span class='line'>            <span class="n">mock_method</span><span class="o">.</span><span class="n">side_effect</span> <span class="o">=</span> <span class="n">ConnectionError</span>
</span><span class='line'>            <span class="n">Authenticator</span><span class="o">.</span><span class="n">generate_token</span><span class="p">(</span><span class="s">&#39;mail@example.com&#39;</span><span class="p">,</span><span class="s">&#39;password&#39;</span><span class="p">,</span><span class="s">&#39;tag&#39;</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>Here, we assert that the <code>ConnectionError</code> exception is raised to the caller, but we could easily have asserted a different condition. We could, for instance, have verified some exception handling logic.</p>

<p>As we&#8217;ve seen, mocking objects and methods in this manner is a simple but powerful way of running your code under different simulated conditions, allowing thorough testing of error-handling logic.</p>

<p>You can see the full module including tests and usage instructions at the <a href="https://github.com/MattCottingham/pyclientauth/">github repository</a>. For more information on the <code>mock</code> module, the <a href="http://www.voidspace.org.uk/python/mock/">full documentation</a> is available.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Short Explanation of Hypermedia Controls in RESTful services]]></title>
    <link href="/blog/2012/01/01/a-short-explanation-of-hypermedia-controls-in-restful-services/"/>
    <updated>2012-01-01T16:07:00+00:00</updated>
    <id>https://blueprintforge.com/blog/2012/01/01/a-short-explanation-of-hypermedia-controls-in-restful-services</id>
    <content type="html"><![CDATA[<p>This article roughly follows on from my <a href="/blog/2011/12/13/some-thoughts-on-rest/">previous post</a> on REST, which discusses some points relating to the first two levels of the Richardson Maturity Model. Since we&#8217;re only going to discuss the top level of the model in this post (shown below), the other levels are greyed out.</p>

<p><img src="/images/rmmlevel3.png" alt="Diagram of the Richardson Maturity Model showing three elements of RESTful services: resources, http verbs and hypermedia controls" /></p>

<p><strong>Introducing Hypermedia Controls</strong></p>

<p><em>Hypermedia as the Engine of Application State</em> (HATEOAS) is an element of the REST architectural style, which describes how a consumer can control a given web application using <em>hypermedia controls</em>.</p>

<p>Let&#8217;s cut straight to the chase: what do we mean by hypermedia controls?</p>

<blockquote><p>When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions&#8230; Hypertext does not need to be HTML on a browser. Machines can follow links when they understand the data format and relationship types.
&#8211;<a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven#comment-718">Roy Fielding</a></p></blockquote>

<p>This explanation, from Roy Fielding&#8217;s widely cited blog post <a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">REST APIs must be Hypertext driven</a> mentions the &#8220;simultaneous presentation of information and controls&#8221;. To simplify, we can imagine a hyperlink that our consumer is able to understand and manipulate.</p>

<p>So that&#8217;s the first word of HATEOAS. What does &#8220;Engine of Application State&#8221; mean? Quite literally, it means that the hyperlinks mentioned above can be used to control (drive) the web application. If you haven&#8217;t already drawn a state machine for your application, now&#8217;s the time!</p>

<p>Take, for instance, a RESTful webservice that allows virtual machines to be controlled. The <a href="http://kenai.com/projects/suncloudapis/pages/CloudAPIVMRequests#Control_VM">Sun Cloud API</a> is one example of such a service &#8211; the examples below are based loosely on the format it uses. If a given virtual machine is stopped, it be may started. Or, if a machine is already running, it may be stopped.</p>

<p>Example request for a machine representation:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>GET /machines/1/
</span><span class='line'>Host: example.com
</span><span class='line'>Accept: application/xml</span></code></pre></td></tr></table></div></figure>


<p>Example response:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>HTTP/1.1 200 OK
</span><span class='line'>Content-Type: application/xml
</span><span class='line'>&lt;status&gt;stopped&lt;/status&gt;
</span><span class='line'>&lt;link rel="start" method="post" href="machines/2?op=start" /&gt;</span></code></pre></td></tr></table></div></figure>


<p>Note the <code>link</code> tag. This is a hypermedia control which tells the consumer how it could start the VM by POSTing to <code>machines/{id}?op=start</code>. (For simplicity I&#8217;ve omitted necessary details such as Content-Length and xml schema declaration.)</p>

<p>If the requested VM is running, the response would be:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>HTTP/1.1 200 OK
</span><span class='line'>Content-Type: application/xml
</span><span class='line'>&lt;status&gt;running&lt;/status&gt;
</span><span class='line'>&lt;link rel="stop" method="post" href="machines/2?op=stop" /&gt;</span></code></pre></td></tr></table></div></figure>


<p>When our VM is running, the resource at <code>machines/1/</code> contains a <code>rel</code> link to stop it. Both methods would probably return <code>201 Accepted</code> in the case of success, as it is unlikely they would run synchronously.</p>

<p>In a nutshell, this is the concept of HATEOAS &#8211; these hypermedia resources allow us to control application state.</p>

<p>Note that the operation type in the query parameter could also have been a separate resource (such as <code>machines/1/stop</code>). There are arguments for either approach but it isn&#8217;t necessary to delve into this to understand the concept of HATEOAS.</p>

<p><strong>Why Hypermedia Controls are Important</strong></p>

<p>In the example above, the representation of a resource also gives us a way to manipulate the resource. In this way, HATEOAS allows certain aspects of the application to be self-describing, fostering loose coupling between service and consumer. If we consider that a service may evolve over time, then this loose coupling could allow the client to evolve with fewer issues than if all controls were hard-coded.</p>

<p>A useful resource that covers this in more detail is Wayne Lee&#8217;s presentation <a href="http://www.slideshare.net/trilancer/why-hateoas-1547275"><em>Why HATEOAS</em></a>. Craig McClanahan also <a href="http://blogs.oracle.com/craigmcc/entry/why_hateoas">discusses</a> the benefits of HATEOAS for service discovery and integration.</p>

<p>This post has necessarily glossed over many details of how HATEOAS is implemented, but has hopefully served as a useful introduction to the notion. I recommend <a href="http://www.amazon.co.uk/gp/product/0596805829/ref=as_li_ss_tl?ie=UTF8&amp;tag=blueprintforg-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0596805829">REST in Practice</a> as a resource for going into the subject in more detail. Additionally, the <a href="http://www.amazon.co.uk/gp/product/0596801688/ref=as_li_ss_tl?ie=UTF8&amp;tag=blueprintforg-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0596801688">RESTful Services Cookbook</a> contains details on implementation.</p>

<p>Further sources:</p>

<ol>
<li><a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">Roy Fielding: Rest APIs must be Hypermedia Driven</a></li>
<li><a href="http://blog.ianbicking.org/2008/10/24/hypertext-driven-urls/">Ian Bicking on Hypertext Driven URLs</a></li>
<li><a href="http://blog.steveklabnik.com/2011/08/07/some-people-understand-rest-and-http.html">REST and HATEOAS</a></li>
<li><a href="http://stackoverflow.com/questions/1164154/is-that-rest-api-really-rpc-roy-fielding-seems-to-think-so">Interesting Stack Overflow discussion</a></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Some Thoughts on REST]]></title>
    <link href="/blog/2011/12/13/some-thoughts-on-rest/"/>
    <updated>2011-12-13T12:41:00+00:00</updated>
    <id>https://blueprintforge.com/blog/2011/12/13/some-thoughts-on-rest</id>
    <content type="html"><![CDATA[<p>This article is in two parts. It started with the wish to talk mostly about hypermedia controls, but I decided it would be better to do a preceding post covering some more foundational notes on building a RESTful service.</p>

<p>Recently there&#8217;s been plenty of discussion about service platforms &#8211; Steve Yegge&#8217;s <a href="https://plus.google.com/110981030061712822816/posts/AaygmbzVeRq">accidental post</a> on Google Plus springs most prominently to mind. This article is partly motivated by these discussions, but it&#8217;s also a product of my own experience designing, implementing, and consuming services. I&#8217;ll include resources I&#8217;ve found useful when working on RESTful services.</p>

<p>I&#8217;m going to assume basic familiarity with REST, so you may find <a href="http://www.infoq.com/articles/rest-introduction">this introduction</a> helpful if you need a place to start.</p>

<p><strong>Using the Richardson Maturity Model as a Guide</strong></p>

<p>The Richardson Maturity Model is a layered approach to REST. Aside from sounding like a psychological evaluation, it&#8217;s a helpful way of envisioning the different elements that will comprise your service, and how they are composed.</p>

<p>In essence, the model can be described as follows:</p>

<ul>
<li>The first level concerns implementing URIs for each resource (like /pizzas/1).</li>
<li>The second level details how to interact with resources through HTTP methods (GET, POST, PUT, DELETE&#8230;). You can think of this like CRUD operations for resources, though we&#8217;ll discuss later how that doesn&#8217;t quite suffice.</li>
<li>Finally, the slightly mysterious &#8220;hypermedia controls&#8221; level. I&#8217;ll cover this in a second article, which is why it is greyed out in the diagram.</li>
</ul>


<p><img src="/images/rmmlevel2.png" alt="Diagram of the Richardson Maturity Model showing three elements of RESTful services: resources, http verbs and hypermedia controls" /></p>

<p>I highly recommend you read Martin Fowler&#8217;s <a href="http://martinfowler.com/articles/richardsonMaturityModel.html">full article</a> on the Richardson Maturity Model if you haven&#8217;t already. You&#8217;ll notice I&#8217;ve left out quite a bit of detail for simplicity (including the entirety of the lowest level!)</p>

<p><strong>Exploring REST and CRUD Further</strong></p>

<p>It&#8217;s worth looking at HTTP verbs (level 2 in our diagram), and how they map to operations on your resources, in more detail. A common approach is to map the following HTTP verbs like so:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>GET    # Read a resource
</span><span class='line'>POST   # Create a new resource
</span><span class='line'>PUT    # Update a resource
</span><span class='line'>DELETE # You guessed it...</span></code></pre></td></tr></table></div></figure>


<p>If I want to retrieve a pizza representation, I just GET /pizzas/{id}. If I want to create a new pizza, I POST my representation to /pizzas. Change the topping on a pizza? PUT the updated representation to /pizzas/{id}.</p>

<p>Using HTTP verbs in this way is a good approach for many applications. But it can, in some cases, lead to lack of good separation between model and controller. Take an example: composite representations. The representation of a news story may include headlines of related stories, user comments, and author metadata. Combining data in this manner is common for e.g. mobile clients where the trade off between composing representations (and increasing response size) and the increased latency of multiple requests is deemed necessary.</p>

<p>If the service was designed as a CRUD layer over some database models with no additional composition ability, then implementing these representations can lead to unexpected complexity. It pays to think about resources that don&#8217;t map directly to business objects and the way in which a controller will handle this.
See Subbu Allamaraju&#8217;s excellent <a href="http://www.amazon.co.uk/gp/product/0596801688/ref=as_li_tf_tl?ie=UTF8&amp;tag=blueprintforg-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0596801688">cookbook recipes (pp. 30-37)</a></p>

<p>This is something that is worth bearing in mind when choosing a framework on which to build your RESTful service. In a number of frameworks, the tendency is to derive controllers directly from models. How would you express the above representation in such a framework? Would it save time to use something with greater flexibility?</p>

<p>A final point, which leads on from the notion of generating representations directly from models, is <em>versioning</em>. If your representations are strongly coupled to business objects, changing your database schema implies change to your service. Templating representations helps dissociate the representation from the model, forcing potentially client-breaking to be acknowledged by explicitly modifying a template.</p>

<p>There are a couple of different ways to ask a webservice for a specific version of a resource. Some architects prefer the version to be passed as a header, but there is also a camp that supports having the version in the URL. Ian Robinson&#8217;s <a href="http://www.slideshare.net/guilhermecaelum/rest-in-practice">presentation (slide 20)</a> covers this well.</p>

<p><strong>Conclusion</strong></p>

<p>We&#8217;ve covered the lower two levels of the Richardson Maturity Model with some expansion on mapping resources to business objects. There are many other subjects to cover &#8211; caching, error-handling patterns, content negotiation, but hopefully the above has provided some useful points to consider when designing a RESTful service and choosing a framework.</p>

<p>In my own work, I have found <a href="http://www.amazon.co.uk/gp/product/0596805829/ref=as_li_ss_tl?ie=UTF8&tag=blueprintforg-21&linkCode=as2&camp=1634&creative=19450&creativeASIN=0596805829"><em>REST in Practice</em></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=blueprintforg-21&l=as2&o=2&a=0596805829" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> by Jim Webber, Savas Parastatidis and Ian Robinson a good resource.</p>

<p><a href="http://www.amazon.co.uk/gp/product/0596805829/ref=as_li_ss_il?ie=UTF8&tag=blueprintforg-21&linkCode=as2&camp=1634&creative=19450&creativeASIN=0596805829"><img border="0" src="http://ws.assoc-amazon.co.uk/widgets/q?_encoding=UTF8&Format=_SL160_&ASIN=0596805829&MarketPlace=GB&ID=AsinImage&WS=1&tag=blueprintforg-21&ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=blueprintforg-21&l=as2&o=2&a=0596805829" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>

<p>In the next article I&#8217;ll talk about the final tier of the Richardson Maturity Model: hypermedia controls.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Sales Driven Development]]></title>
    <link href="/blog/2011/12/06/sales-driven-development/"/>
    <updated>2011-12-06T08:57:00+00:00</updated>
    <id>https://blueprintforge.com/blog/2011/12/06/sales-driven-development</id>
    <content type="html"><![CDATA[<blockquote><p>Customers don&#8217;t know what they want. Stop expecting customers to know what they want.
&#8211;<a href="http://www.joelonsoftware.com/articles/fog0000000356.html" title="The Iceberg Secret, Revealed -- Joel Spolsky">Joel Spolsky</a></p></blockquote>

<p>A couple of months ago I attended a <a href="http://www.slideshare.net/HuddleHQ/the-science-of-selling-9334276" title="The Science of Selling -- Neil Ryland">presentation</a> by the Head of EMEA Sales at Huddle, Neil Ryland. In describing the sales process, one of the most interesting points raised was how feedback from the sales force is incorporated into the development lifecycle.</p>

<p>Huddle&#8217;s products are aimed at the enterprise segment. As part of the sales process, there are likely to be multiple conversations between the sales representative and the customer. This direct contact with the client is so valuable that it can be used in planning the next iteration of the product. The process goes something like this:</p>

<ol>
<li>Analyze the failed sales. Could the sale have been closed by offering a slightly different feature set?</li>
<li>Analyze the successful sales. Which features of the product were most influential in the customer&#8217;s decision?</li>
<li>Highlight the most compelling points to the product manager and development team at planning meetings.</li>
</ol>


<p>Note that this is my interpretation of what was stated &#8211; I&#8217;m not acquainted with Huddle&#8217;s internal processes, so don&#8217;t assume this accurately reflects the process. Yet the important point is this: <em>sales has a direct line to product development</em>.</p>

<p>Clearly, this only one of the different factors that should be considered when a backlog is written or prioritised. But it is an important one that should not be overlooked.</p>

<p>Out of this process grows the phrase <em>Sales Driven Development</em>. I&#8217;m fairly reluctant to use it, since it implies a complete development methodology. It&#8217;s not necessarily a driver of product iteration, but behaves more akin to a regulation mechanism.</p>

<p>An interesting facet to this approach is how it interacts with site-specific customisation, practiced by many software firms targeting the enterprise. Of course, with a cloud-based product such as Huddle&#8217;s, site-specific customisation makes little sense. Instead of customisation, a feature may be built into the next release. And, of course, these two practices certainly aren&#8217;t mutually exclusive approaches.</p>

<p>Returning to the introductory quotes, what we&#8217;ve covered so far is certainly no counterpoint. I strongly agree with the notion that it is not the customer&#8217;s job to know what they want. But it is interesting to explore how an iteration cycle can incorporate what customers <em>say</em> they want, particularly when they have already encountered the product.</p>

<p>In this sense, software companies with a sales force may well be at an advantage. Why? Because of the dialogue a sales representative can engage in with a lead. In terms of customer interaction, it clearly outstrips a feedback form. But this is a fairly obvious point.</p>

<p>A more interesting question is this: <em>how do we derive frank feedback, and to whom should we listen?</em></p>

<p>One method is to focus on the sales successes. With many people in an enterprise using your product, their experience of the product is likely to be wider than an individual might achieve. There may be even internal factors that drive how the product is used. Understanding the initial success and following up on how the product is used internally can provide this.</p>

<p>Another approach is to look at the unsuccessful cases that included a trial of the product. This provides the grounding that the potential customer was willing to invest time to assess the product and discover why it wasn&#8217;t right for them.</p>

<p>It&#8217;s interesting to think how this approach might factor into a different revenue model, such as freemium. But since this is essentially a separate discussion, I will attempt to cover it in a future article. In any case, we&#8217;ve covered the main point of this article: examining a case where sales feedback is given a direct line to product iteration.</p>
]]></content>
  </entry>
  
</feed>
