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

  <title><![CDATA[Stefan Tilkov's Random Stuff]]></title>
  <link href="http://www.innoq.com/blog/st/atom.xml" rel="self"/>
  <link href="http://www.innoq.com/blog/st/"/>
  <updated>2012-04-04T19:29:34+02:00</updated>
  <id>http://www.innoq.com/blog/st/</id>
  <author>
    <name><![CDATA[Stefan Tilkov]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Waterfall sucks, always. Duh.]]></title>
    <link href="http://www.innoq.com/blog/st/2012/04/waterfall-sucks/"/>
    <updated>2012-04-04T14:17:00+02:00</updated>
    <id>http://www.innoq.com/blog/st/2012/04/waterfall-sucks</id>
    <content type="html"><![CDATA[<p>Today, I had an interesting discussion over Twitter related to project
organization in restricted environments. (<em>Update</em>: I&#8217;ve removed all
references to the actual discussion because the person I interacted
with felt mis-quoted, and I don&#8217;t think that it was actually that
important with regards to what I actually wanted to get across.)  This
prompted me to take a break from my usual topics and elaborate a bit
on my thoughts with more than 140 characters. All this assumes you&#8217;re
in the role of not only having to actually deliver a piece of
software, but also to get the necessary funding &#8211; regardless of
whether you&#8217;re part of an internal organization that requires approval
from top management or you&#8217;re an external partner that needs to sell
to its customer. That said, I&#8217;ll focus on the second scenario as that
is my primary focus at <a href='http://www.innoq.com/blog/st/'>innoQ</a>.</p>

<p>First of all, in an ideal world, the customer understands all of the
reasons that led to the Agile movement, e.g. accepts that an upfront
specification that&#8217;s 100% correct is an unattainable pipe dream,
agrees to participate in the actual development process, and most
importantly, understands that what needs to be built will only become
clear during the actual development project. We do have some customers
who understand this very clearly, and they agree to our favorite
pricing model: We offer a sprint/iteration for a fixed price or on a
T&amp;M basis, and after each sprint the customer can decide to continue
or to stop (which will require one final short wrap-up phase). This
reduces the customer&#8217;s risk, which is often seen as a benefit big
enough to outweigh the perceived disadvantage of not knowing what the
overall cost will be. It&#8217;s great to be able to work in an environment
where everybody&#8217;s goals are perfectly aligned, and this is the case in
this model.</p>

<p>Unfortunately, this ideal model is not always an option. Of course one
way for a development organization to ensure that all projects are
done this way is to simply refuse doing it in any other
fashion. That&#8217;s a good option, but whether it&#8217;s actually doable
strongly depends on internal power distribution or external market
forces.</p>

<p>But what do you do when you have to accept a different set of
restrictions? For example, the customer/stakeholder might require a
fixed-scope, fixed-time, fixed-price offer. My guess is we can all
agree that this is bad idea for everyone involved. But how do you
approach things if you just have to do things this way? What do you do
if, as an additional downside, the developers assigned to the project
are not as skilled as you&#8217;d like the to be?</p>

<p>As possible answer might be to use a classical waterfall approach, but
I think this is <em>never</em> a good choice. At the very least, go with an
iterative approach, even if that means you have to game the system to
do that.</p>

<p>Of course you have to put up some effort into an initial up-front
analysis. You&#8217;ll be aware that much of what you find out may actually
turn out to be wrong, but it&#8217;s still better to make a slightly more
informed estimate up front as opposed to a totally bogus one,
especially if you&#8217;re an external partner that&#8217;s supposed to provide a
fixed-price quote. Then, make sure that you grow the system in
increments &#8211; i.e., build a first working system, using a number of
interesting use cases; then add functionality in the next iteration,
and continue until done.</p>

<p>Typically, this will resemble something like an agile process &#8211; but
with slightly larger iterations (e.g. maybe 6 weeks instead of two),
and with the added amount of documentation required to fulfill the
typical waterfall requirements. (If this reminds you of a <a
href='http://www.methodsandtools.com/archive/archive.php?id=32'>Unified Process</a> kind of thing, that&#8217;s no coincidence.)</p>

<p>In the end, you&#8217;ll have created all of the documents and other
artefacts required, but simply not in the order they were supposed to
be generated (first analysis, then design, then implementation, then
test), but with the trimmed-down focus of each iteration.</p>

<p>Is this perfect? Not even remotely. But in my experience, you have a
far greater chance to meet your goals than with actually following the
waterfall approach, and even more importantly, management is likely to
accept it (partially because it&#8217;s obvious, partially because you don&#8217;t
tell them about it).</p>

<p>If you can&#8217;t get away with that, you&#8217;re really out of luck, and it&#8217;s
as they say: You need to change the company, and if you can&#8217;t, change
companies.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Announcing "ROCA"]]></title>
    <link href="http://www.innoq.com/blog/st/2012/03/announcing-roca/"/>
    <updated>2012-03-06T19:46:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/03/announcing-roca</id>
    <content type="html"><![CDATA[<p>In the past few days, we finally managed to write down a few ideas on
Web frontend design, basically a set of rules to apply if the goal is
to come up with a Web app that is actually <em>on</em> the Web as opposed to
be <em>tunnelled through</em> the Web. We tried to come up with a catchy
name, and finally arrived at &#8221;<a href='http://roca-style.org'>ROCA</a>&#8221;, a
conveniently pronouncable acronym for &#8220;Resource-oriented
client architecture&#8221;.</p>

<p>I am aware that for many folks, specifically those who are interested
in REST and thus likely to read this, a common reaction might be
&#8220;Duh&#8221;. And one of the main things I&#8217;d like to stress is that we have
not invented a single thing, but rather collected a certain set of
rules that we found many people liked, but couldn&#8217;t name.</p>

<p>Since we started discussing this, we&#8217;ve found strong support, as well
as violent opposition. Which is exactly what we were looking for,
because in only very very few cases, people didn&#8217;t understand what we
described, and that&#8217;s the whole point of the effort: Give a name to a
certain cohesive set of practices so that they may used as a reference
both when you agree with them, want to build a system that adheres to
them or criticize them because you disagree.</p>

<p>I&#8217;m looking forward to comments over at the <a
href='http://roca-style.org/discussion.html'>discussion page</a>. If
you believe we should make changes, please <a
href='https://github.com/innoq/ROCA'>fork the GitHub repo</a> and
create a pull request.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[REST vs. Websockets, oh my]]></title>
    <link href="http://www.innoq.com/blog/st/2012/02/rest-vs-websockets/"/>
    <updated>2012-02-28T19:31:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/02/rest-vs-websockets</id>
    <content type="html"><![CDATA[<p>There is an entirely absurd discussion going on about &#8220;REST
vs. Websockets&#8221;, predictably claiming that in the long term, REST will
be succeeded by Websockets. This is stupid on many levels. I&#8217;ll try
to be brief:</p>

<ul>
<li>To be pedantic, REST vs. &#8230; almost never makes sense, as people are
rarely talking about REST (the architectural style) in comparison to
another architectural style. But never mind, let&#8217;s assume that what
was meant was actually &#8220;RESTful HTTP&#8221; vs. &#8220;Websockets&#8221;, then &#8230;</li>
<li>Websockets is not something &#8220;more&#8221;, it doesn&#8217;t add something, it&#8217;s
not dynamic, or interactive, or in any way &#8220;good&#8221; &#8211; unless you make
the same claim about TCP. Websockets essentially allows you build
your own proprietary protocols that may or may not be great, with
all the typical advantages and disadvantages these end up having:
possibly better performance, possibly better suited to the specific
task at hand, less standardized, not widely implemented, etc. It&#8217;s
not a case of one being better than the other, it&#8217;s about being
different.</li>
<li>In the long run, HTTP (used in a way aligned with its architectural
goals) will continue to have benefits for loosely coupling
systems. If that&#8217;s what you want, it makes the most sense. If you&#8217;re
after the most efficient communication possible, and are willing to
sacrifice some of the loose coupling &#8211; fine, go ahead, use
Websockets. But it&#8217;s not as if one will supersede the other.</li>
<li>Does this mean I claim that HTTP is perfect? Of course not, it most
definitely could be improved. But if this improvement comes, it&#8217;s
definitely going to introduce more, not less constraints.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[PATCHing Rails]]></title>
    <link href="http://www.innoq.com/blog/st/2012/02/patching-rails/"/>
    <updated>2012-02-26T11:09:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/02/patching-rails</id>
    <content type="html"><![CDATA[<p>As mentioned on the Ruby on Rails weblog, Rails 4.0 will include
(optional) support for <a href='http://weblog.rubyonrails.org/2012/2/26/edge-rails-patch-is-the-new-primary-http-method-for-updates'>partial updates via PATCH</a>, a change included to better comply to the HTTP spec and the REST architectural style. As you can guess, I really like
this motivation, even though I think it&#8217;s insufficient to justify
major changes &#8211; being &#8220;RESTful&#8221; should not be the goal, building a
better system should be. It seems the Rails team has found a good way
to do this, as the change is made in a backwards-compatible fashion
(so if you don&#8217;t care, you can simply ignore it). But it highlights
one of the things I really, really like about Rails: It tries to make
it a lot easier to build something that&#8217;s RESTful than something that
isn&#8217;t, and its reach means many more people will be exposed to this
as the way it&#8217;s being done.</p>

<p>So what about the change itself? When should you use PUT, POST, PATCH?
First of all, these are the truths I base my views on:</p>

<ul>
<li>POST can mean anything; its most common use is to create something
under a location determined by the server; it&#8217;s neither safe nor
idempotent nor cachable; it should be used whenever using any of the
other methods violates one of their guarantees.</li>
<li>PUT can mean creation or update; it affects the resource to which it
is applied; it&#8217;s idempotent; it contains a full representation of
the resource (as far as the client is responsible for it). Most
importantly, by using PUT the client asks the server to <em>store</em> (in
the widest possible sense) the representation under the location
provided.</li>
<li>PATCH, a relatively new verb (at least in it&#8217;s <a
href='http://tools.ietf.org/html/rfc5789'>standardized form</a>) is
intended to address partial updates, i.e. it updates only parts of
the resource it&#8217;s being applied to; it&#8217;s not idempotent; the client
asks the server to change parts of a resource.</li>
</ul>


<p>If you&#8217;re a server developer and want to enable your clients to update
only parts of a resource &#8211; say, a customer&#8217;s address &#8211;, you basically have three options:</p>

<ul>
<li>POST the new address to the resource and have the server decide what
to do &#8211; in this case, process the address change only &#8211; based on
the content</li>
<li>Expose each part you want to be changeable individually as a
resource in its own right and use PUT, i.e. make address a resource
http://&#8230;/customer/:id/address that you can PUT to</li>
<li>Use PATCH to put information about the intended change to the
resource itself, using an appropriate format understood by the
server</li>
</ul>


<p>Using POST is OK, but only because it essentially means nothing. The
PUT option is perfectly fine, but requires you to explicitly create
resources for this purpose. This is actually the best option in many
cases, especially if the resources you create in the process turn out
to be meaningful in their own right, support other methods (GET in
particular). It often ends up feeling a bit contrived, though, so it&#8217;s
nice to have the third option: Using PATCH means you are being very
clear about the purpose of the request, and don&#8217;t need to create new
and possibly otherwise unnecessary resources. It&#8217;s still fully RESTful
because PATCH is an extremely generic method.</p>

<p>Note that while using POST for partial updates is OK, using PUT (as
Rails does) is not, because it violates the behavior as defined by the
spec. So changing it is a very good idea, and the only two options are POST
and PATCH.</p>

<p>Even though PATCH is clearly useful, and has <a href='http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post#comment-965'>the ultimate REST authority&#8217;s blessing</a>, my recommendation in the past has been to avoid it because you can&#8217;t count on anyone (or anything)
supporting it, and go with PUT or POST instead. With Rails&#8217; influence,
I see this changing &#8211; and I very much look forward to being able to
include PATCH in my RESTful designs in the future. Add PATCH (in
addition to PUT and DELETE) to HTML 5, and I&#8217;ll be more than happy &#8230;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Blog update]]></title>
    <link href="http://www.innoq.com/blog/st/2012/02/blog-update/"/>
    <updated>2012-02-05T20:41:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/02/blog-update</id>
    <content type="html"><![CDATA[<p>I took the opportunity of a 10-hour flight to finally re-import all of
my blog&#8217;s old entries into Octopress, fiddling around with a
semi-automated process of Ruby and shell scripts and some creative
Emacs macros (check out <a href='http://www.innoq.com/blog/st/blog/st/archives/'>the archives</a>
if you care, even though I have no idea why you would). So if this
worked, all of the old stuff should be preserved, even though most of
it now only has historic value (and prevents Google searches to hit a
404). I&#8217;ve also taken the risk of moving the whole stuff back <a
href='http://www.innoq.com/blog/st/blog/st/'>to its old location</a>, and will redirect the
temporary one back once I&#8217;m sure everything works. One less excuse to
not take up blogging again &#8230;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[XPath and XML]]></title>
    <link href="http://www.innoq.com/blog/st/2012/01/xpath/"/>
    <updated>2012-01-14T17:45:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/01/xpath</id>
    <content type="html"><![CDATA[<p>Aristotle Pagaltzis has written <a
href='http://plasmasturm.org/log/xpath101/'>a very nice and concise XPath intro</a>.
 Of all the various standards in the XML ecosystem, I
like XPath best, most of all because it enables interaction with an
XML document or message in a way that matches <a
href='http://en.wikipedia.org/wiki/Robustness_principle'>Postel&#8217;s law</a>: It&#8217;s a great way to implement code that doesn&#8217;t break each
time a minor change is made to an XML format. In fact I&#8217;d say it&#8217;s one
the few very good reasons to stick with XML instead of adopting JSON
&#8211; even though there are things like <a
href='http://goessner.net/articles/JsonPath/'>JSONPath</a>, they don&#8217;t
have the tool support and standardization you get from XPath.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Media Types in RESTful HTTP]]></title>
    <link href="http://www.innoq.com/blog/st/2011/12/media-types/"/>
    <updated>2011-12-03T11:15:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2011/12/media-types</id>
    <content type="html"><![CDATA[<p>A topic that comes up again and again in discussions about RESTful
design is what kinds of media type to use. I&#8217;ve changed my mind about
this a few times, often enough so that I believe it makes sense to write
a bit about my current thinking on this. (A &#8220;media type&#8221;, should you
happen to wonder what I&#8217;m talking about, is a specific format with a
well-defined name, in this context represented in the form of a media
type identifier such as <code>application/xml</code> or <code>text/html</code> or
<code>application/json</code>. [That&#8217;s not 100% correct, but that doesn&#8217;t really
matter here.] A &#8220;hypermedia format&#8221; is one that includes links or other
hypermedia controls.)</p>

<p>There are a number of different ways to deal with media types when
designing a RESTful HTTP system. One school of thought advises to
stick with hypermedia formats/media types that are well-defined and
widely understood, such as HTML or Atom. In other words: Whatever it
is you&#8217;re trying to send around as part of an HTTP message, use an
existing format, such as HTML, the main reason being that there are
many processors that are able to understand it. Use the appropriate
MIME identifier (such as <code>text/html</code>) in Content-type headers. One can
make a strong case for this option: Hypermedia formats are
hard to design, so you should avoid inventing your own.</p>

<p>But let&#8217;s assume you&#8217;ve decided to define your own hypermedia format,
<a href='http://www.amundsen.com/blog/archives/1101'>mike
amundsen-style</a>, whether by designing a completely new XML
vocabulary, your own JSON structure, or some other approach: What MIME
type do you use?</p>

<p>You can send content labeling it with the generic identifier, say
<code>application/xml</code>. In this case, the MIME identifier will signal the
technical format being used, while the semantics are only known to
clients who either have some out-of-band knowledge or interpret the
content itself. The rationale for this approach is that unless your
home-grown hypermedia format is likely to be widely adopted, you&#8217;d
better stick with a media type that is well-known, even though it
doesn&#8217;t convey specific semantics. <a href='http://duncan-cragg.org/blog/post/minting-media-types-usually-less-restful-using-raw/'>Duncan Cragg wrote a nice post</a> on this a while back.</p>

<p>The second option is to invent your own MIME type, say
<code>application/vnd.mycompany-myformat</code>, the argument being that you need
to convey the semantics of the content to ensure a client, server or
intermediary can actually know whether it&#8217;s able to process it.</p>

<p>This begs the question of how many different MIME types you&#8217;ll end up
with. Instead of creating a new identifier for each type of content,
(e.g. a customer, a list of customers, a list of orders), I&#8217;ve found
that a good approach is to think of a specific context &#8211; a <em>domain</em>, if
you prefer &#8211; that your format covers. I like the similarity of this
approach to other hypermedia formats, e.g. HTML or Atom/AtomPub, where
you actually end up describing something that applies to a set of
collaborating participants, instead of some server-side interface. In
my favorite example domain (order processing), you might end up with a
MIME type of <code>application/vnd.mycompany-ordermanagement</code>, relate this
to a particular XML namespace and define a few different XML root
elements (order, order confirmation, cancellation, etc.). The
assumption would be that processors can be reasonably expected to able
to understand all of the elements in this context, not just one of
them. (Of course the same reasoning applies when using JSON or
something else, minus the namespace benefits/troubles, depending on
your view of XML.)</p>

<p>One final approach that I find very interesting was mentioned by <a
href='http://algermissen.blogspot.com/'>Jan Algermissen</a> a while
ago: If your format is based on an existing one, e.g. HTML or XML,
your server can actually send the same content with different MIME
types, depending on the client&#8217;s capabilities. A client that only
included <code>application/json</code> in its Accept header would then get the
content labeled <code>application/json</code>, while one that includes the
specific MIME type <code>application/vnd.whatever</code> would get the same
content with this label applied.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Fresh Start ... Again]]></title>
    <link href="http://www.innoq.com/blog/st/2011/12/a-fresh-start/"/>
    <updated>2011-12-02T18:54:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2011/12/a-fresh-start</id>
    <content type="html"><![CDATA[<p>Google Reader&#8217;s extremely weird behavior after a first attempt to move
<a href='http://www.innoq.com/blog/st/'>my blog</a> to a new location has made me try
yet another different blog setup. This time, there should be
nothing at all left from the old installation, no redirects, different
URIs for everything, a new blog system &#8211; clearly, there&#8217;s no way for
Google Reader to mess things up this time. Let that be the last thing
said about this mess; even though it&#8217;s very sad to see all of those
blog followers go who only occasionally drop by whenever something new
appears in their Google Reader subscription, many of them may not have
been following anymore, anyway. Who knows. It&#8217;s been a long time since
I spent some serious time blogging.</p>

<p>Which doesn&#8217;t mean one can&#8217;t restart, right? We&#8217;ll see. For now, this
is the one and only blog I&#8217;ll maintain. It has zero moving parts,
i.e. it&#8217;s a static site, (currently) generated using
<a href="http://octopress.org/">Octopress</a>. If everything works as expected,
you&#8217;ll be able to subcribe to the
<a href="http://www.innoq.com/blog/stilkov/atom.xml">an Atom</a> feed that should
actually be working for a change.</p>

<p>I&#8217;m somewhat undecided with regards to comments and the Twitter
integration (both in the sidebar as well as in the bottom of each
post). I&#8217;ve toyed with the idea of doing away with comments
altogether, but I have to say that <a href="http://disqus.com/">Disqus</a> seems
quite smart.</p>
]]></content>
  </entry>
  
</feed>

