<?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>2013-02-11T15:42:57+01: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[REST in Depth: Training in Frankfurt]]></title>
    <link href="http://www.innoq.com/blog/st/2013/01/rest-in-depth-training-in-frankfurt/"/>
    <updated>2013-01-28T18:37:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2013/01/rest-in-depth-training-in-frankfurt</id>
    <content type="html"><![CDATA[<p>After some recent discussions, I&#8217;ve decided to offer a full-day REST
training in English, and set the location so that it&#8217;s easily
reachable for me and for potential attendees (<a
href='http://www.frankfurt-airport.com/content/frankfurt_airport/en/business_location/airport_conferencecenter.html'>Frankfurt Airport&#8217;s conference center</a>). The date is 18 June 2013. Here&#8217;s the content
description:</p>

<blockquote>
  <p><p>In this full-day workshop, you&#8217;ll learn the theory, practical applications, and support for advanced scenarios of REST, the architectural style of the Web.</p>

<p>While we&#8217;ll start with a solid theoretical foundation first, we&#8217;ll do so without boring everyone (including the instructor) to death. Based on the general concepts, we&#8217;ll dive into their implementation in the actual architecture of web protocols in theory and practice.</p>

<p>In the second part, we&#8217;ll apply the architectural model to real world scenarios, for RESTful web services scenarios, applications intended for human consumption via a browser, and combinations of both. We&#8217;ll cover these for both the enterprise-internal as well as Internet use cases.</p>

<p>Finally, we&#8217;ll address common pitfalls, patterns and antipatterns, and advanced topics that come up when adopting RESTful HTTP in the real world.</p>

<p>A siginificant chunk of the workshop will be reserved for Q&amp;A and discussions of use cases brought up by the attendees, as well as some re-engineering of well-known web APIs.</p>

<p>Topics covered will include:</p>

<ul>
<li>How to make sense of the basic principles - and when to ignore them</li>
<li>Basic and advanced caching concepts</li>
<li>Choosing the right representation format</li>
<li>Using Hypermedia in real life</li>
<li>How to document APIs and why you may not want to</li>
<li>What to look for in implementation tool kits</li>
<li>Security aspects in RESTful HTTP</li>
<li>Advanced HTTP 1.x usage, SPDY and HTTP 2.0</li>
</ul>


<p>The workshop is aimed at experienced developers and architects,
with some knowledge of distributed systems design and/or web
development. Prior knowledge of REST basics is useful, but not
absolutely required.</p>

</blockquote>


<p>If you speak German, the easiest way to register is <a
href='http://www.innoq.com/de/trainings/rest-in-depth/registrations/new'>through
our website</a>.</p>

<p>You can also register via this form:</p>

<script type="text/javascript" src="https://de.amiando.com/resources/js/amiandoExport.js"></script>


<iframe src="https://de.amiando.com/rest-in-depth.html?viewType=iframe&distributionChannel=CHANNEL_IFRAME&panelId=1860639&useDefaults=false&resizeIFrame=true" frameborder="0" width="650px" height="450px" name="_amiandoIFrame1860639V9wuPhon" id="_amiandoIFrame1860639V9wuPhon"><p>Diese Seite benötigt die Unterstützung von Frames durch Ihren Browser. Bitte nutzen Sie einen Browser, der die Darstellung von Frames unterstützt, damit das amiando Ticketvorverkauf Widget angezeigt werden kann.</p><p>Probieren Sie die amiando <a href="http://de.amiando.com/features.html">online Registrierung</a> noch heute aus.</p></iframe>


<p>Drop me <a href='mailto:stefan.tilkov@innoq.com'>a quick email</a> if you have any questions. Oh yes, we&#8217;ve priced it at 790 EUR + VAT, and the number of
seats is limited to 20.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Why I like Schemaless Data Structures]]></title>
    <link href="http://www.innoq.com/blog/st/2013/01/why-i-like-schemaless-data-structures/"/>
    <updated>2013-01-07T23:00:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2013/01/why-i-like-schemaless-data-structures</id>
    <content type="html"><![CDATA[<p>Martin Fowler has written an infodeck (which is actually a nice format for these kinds of things) <a href='http://martinfowler.com/articles/schemaless/'>on schemaless databases and in-memory structures</a>. I agree with most of it, at least as far as database design is concerned. But I believe there are two important concerns missing, and that&#8217;s the reason why I don&#8217;t agree with the conclusion. Note that my concern is not really with the database part, but with the extrapolation to in-memory data structures, so you should read the following with this in mind:</p>

<p>First, a major effect of using &#8220;schemaless&#8221;, simple data structures is loose(r) coupling between pieces of logic (functions) operating on them. If I pass a map to a piece of code, that code will extract what it&#8217;s interested in, possibly transforming the data in the process (ideally into a new data structure using efficient copy strategies). It will thus only depend on what it actually uses. Take the following Clojure code as an example (this would be doable similarly in Python, Ruby, Perl, Scala and even Java, although with way more boilerplate in it).</p>

<pre><code>;; "projects" is a Clojure set containing three maps
(def projects #{
                {:id "1",
                 :kind :time-material,
                 :description "Consulting for BigCo",
                 :budget 25000,
                 :team [:joe, :chuck, :james]}
                {:id "2",
                 :kind :fixed-price,
                 :description "Development for Startup",
                 :budget 100000,
                 :team [:john, :chuck, :james, :bill]}
                {:id "3",
                 :kind :fixed-price,
                 :description "Clojure Training",
                 :budget 3000,
                 :team [:joe, :john]}})

;; all-members returns all team members in all projects
(defn all-members
  [projects]
  (reduce conj #{} (flatten (map :team projects))))

;; yields #{:chuck :joe :james :john :bill}
</code></pre>

<p>The code and the data structure are coupled just by one map key (<code>:team</code> in the example); I can add other data elements without problems as long as I maintain that contract. In languages such as Clojure, a huge library of useful functions to manipulate data rely on this fact (<code>conj</code>, <code>flatten</code>, <code>map</code> and <code>reduce</code> in this case.)</p>

<p>More importantly, it&#8217;s possible (and actually quite common) to use generic data structures at boundaries, such as between modules/namespaces. At their interfaces, these modules accept simple data structures, not complex object graphs. In fact this makes it a lot easier to evolve a single-process program into a distributed one: The kinds of interfaces you use internally resemble what you&#8217;d be using remotely (in fact there&#8217;s a very nice mapping between a nested Clojure, Ruby or Python data structure and e.g. JSON.)</p>

<p>Some languages, such as Clojure, take this to an extreme: Almost everywhere you&#8217;d create a new class in an OO language, you&#8217;d just use a simple data structure, such as map, a vector, set or list. In a statically typed limited OO language such as Java, you will almost always end up creating new classes. Of course you can use Map in Java, too, but it would not be idiomatic (and the reverse is true for Clojure as well, which enables you to create &#8220;normal&#8221; Java classes, too.) Some languages are somewhere in the middle, as shown by the Ruby code in Martin&#8217;s example. But I find it not very useful to favor one style over the other by default, unless you consider the language you&#8217;re using.</p>

<p>Secondly, the use of custom-built data structures &#8211; and that&#8217;s what a schema boils down to if viewed from a programming language standpoint &#8211; always means additional code. You might consider this irrelevant, but it&#8217;s nicely shown in interfaces such as those of WSGI, Rack or Ring when you compare them to their equivalent in Java: A simple map containing a method or response code, headers and a body vs. different concrete classes for requests with tons of specific attributes (and bonus getters and setters). Restricting the use of schemaless design to the cases where you actually need dynamic variability misses this advantage.</p>

<p>In summary, I think of Martin&#8217;s points are valid, and he definitely spent more time on articulating his conclusion than I did in writing this comment. But I think those two aspects &#8211; coupling and verbosity &#8211; are worth considering when you need to decide which approach to use.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[New languages]]></title>
    <link href="http://www.innoq.com/blog/st/2012/12/new-languages/"/>
    <updated>2012-12-22T15:00:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/12/new-languages</id>
    <content type="html"><![CDATA[<p>Being a programming language geek, I typically try to use the
Christmas vacation to learn (or rather, play with) a programming
language I don&#8217;t know. This year, I find this very hard, as there are
so many interesting languages one could spend time with. Some I have
considered are:</p>

<ul>
<li>Go: I was thoroughly unimpressed with this language when it came
out, and I still fail to see a lot of interesting stuff in it. But
I&#8217;ve heard many people I respect say only good things about their
experience with it, so maybe I should reconsider.</li>
<li>Rust: At first glance, this seems to be a very nicely designed
language (and it has a really excellent tutorial). Even though its
language features are very advanced, it seems to be intended for
low-level use cases (that I mostly don&#8217;t have).</li>
<li>Fantom: Seems to be  interesting, too; I remember I looked at it
a long time ago, but never in depth.</li>
</ul>


<p>What do you think? What else is worth a look?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Some Thoughts on SPDY]]></title>
    <link href="http://www.innoq.com/blog/st/2012/11/some-thoughts-on-spdy/"/>
    <updated>2012-11-06T13:02:00+01:00</updated>
    <id>http://www.innoq.com/blog/st/2012/11/some-thoughts-on-spdy</id>
    <content type="html"><![CDATA[<p>What follows is a number of claims about SPDY, none of which I can
back up in any reasonable way. My hope is that readers who know more
will educate me. <a href='http://www.chromium.org/spdy'>SPDY</a>, in case you don&#8217;t know it, is a replacement for
the HTTP wire protocol. It originated with Google and aims to preserve
HTTP&#8217;s application semantics while improving its efficiency and
performance.</p>

<ul>
<li>Supporting true multiplexing on top of a single TCP connection is
great. There is no way anybody can prefer the HTTP 1.0 model, which
forces a separate TCP connection per request, nor the HTTP 1.1
model, which allows for persistent connections but still requires
serialized request/response interactions (never mind HTTP pipelining
as it doesn&#8217;t work in practice). Browsers having to open separate
connections to the same server to achieve parallelism is not a
satisfactory solution.</li>
<li>Reducing header overhead is also an excellent idea. I&#8217;ve heard some
criticism about the way this is actually done in SPDY, but it very
clearly serves no purpose to have a browser send e.g. the same
ridiculously long user agent string with each and every request.</li>
<li>I used to not care much for the push support, i.e. the
opportunity for the server to actively send stuff to the client, for
the same reason I&#8217;m not a fan of Websockets: I don&#8217;t think you
actually need this in practice on the application level. But in a
session done by Jetty developer <a href='http://webtide.intalio.com/author/tbecker/'>Thomas Becker</a> today, I learned about
a quite intriguing usage of this in Jetty&#8217;s SPDY implementation: On
the first request of a page and the subsequent request for the
resources that are referenced in that page, Jetty will build a map
based on the Referer header &#8211; it essentially remembers which
secondary resources a page references. When the next request comes
along, it can actively send the referenced resources <em>before the
client actually asks for them</em>.</li>
<li>I think the fact that SPDY requires TLS is a mistake. While I
totally concede that most traffic on the Net is (and should be)
encrypted, there are many use cases e.g. within an organization or
for public information where this does not make sense. Besides, it
prevents the usage of intermediaries, even though I admit these will
be much harder to build for SPDY than for plain HTTP anyway.</li>
<li>While SPDY proponents point to impressive performance improvements,
they are the more impressive the worse the website is
implemented. For sites that are already optimized in terms of front
end performance, e.g. minimize and compress content, minimize the
number of requests, usage proper caching, the effect is going to be
much less. That said, some of the things we do in terms of
optimization, e.g. combining multiple CSS or JS files into a single
one, are not exactly milestones of architectural purity.</li>
<li>For machine-to-machine communication &#8211; i.e. typical RESTful web
services &#8211; I don&#8217;t think SPDY will have the same kind of effect as
for Web sites, but I&#8217;m willing to let myself be convinced otherwise.</li>
<li>One of the sad but inevitable things when introducing a binary
protocol as opposed to a text-based one is reduced transparency for
humans. If SPDY becomes successful &#8211; and I have small doubts it
will &#8211; being able to telnet to a servers port 80 is going to be
what I miss most.</li>
</ul>


<p>SPDY has a very good chance of essentially becoming the new HTTP 2.0, and I&#8217;m
happy about it: I&#8217;m pretty confident the <a href='http://datatracker.ietf.org/wg/httpbis/charter/'>HTTP WG</a> with the formidable
<a href='http://www.mnot.net/'>Mark Nottingham</a> taking care of
things will produce something that will be usable for a long time to come.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[innoQ Company Events]]></title>
    <link href="http://www.innoq.com/blog/st/2012/09/innoQ-company-events/"/>
    <updated>2012-09-04T11:00:00+02:00</updated>
    <id>http://www.innoq.com/blog/st/2012/09/innoQ-company-events</id>
    <content type="html"><![CDATA[<p>Since the beginning of <a href='http://www.innoq.com/en/'>innoQ</a>&#8217;s existence, 13 years
ago, we&#8217;ve maintained a regular schedule of so-called &#8220;company
events&#8221;. In my opinion, this is one of the really, really great things
about innoQ, and it&#8217;s also quite different from what others do.
Which is a sufficient excuse for me to write this &#8230;</p>

<p>So what&#8217;s an innoQ event? All of innoQ&#8217;s consultants meet at some more
or less remote venue and spend two or three days there, discussing
projects, technology, methods, in general: anything of interest to our
work. Most of the time we use the classical conference format (an
innoQ guy presents something, followed by sometimes controversial
discussion), but we use other approaches, such as open spaces, pecha
kuchas, and lightning talks, too. We occasionally invite guests (we
were lucky to have e.g. <a href='http://steve.vinoski.net/blog/'>Steve Vinoski</a>, <a href='http://jexp.de/blog/'>Michael Hunger</a>, <a href='http://www.voelter.de'>Markus Voelter</a>, <a href='http://www.michaelnygard.com/blog/'>Michael Nygard</a> pay us a
visit). While the location is mostly somewhere in Germany, we go to
Switzerland sometimes, and one event per year is reserved for a trip
&#8220;far far away&#8221; (in the past years we went to e.g. Prague, Barcelona,
Paris, Rome, Budapest, and Strasbourg; these are the only events where
we actually spend a day just sightseeing). Some of the events focus on
project reports, others are programming events, one event per year is
dedicated to company strategy.</p>

<p>What is amazing to most people I talk to about this is the frequency we do this
with, and the resulting amount of time, effort and money we invest. We
do 6-8 events per year, 2 of them three days long, the rest two
days. Events are always scheduled during regular workdays,
typically Thursdays and Fridays; attendance is mandatory. This adds up
to 15-18 days per person per year, with the most significant cost
factor being the &#8220;lost&#8221; revenue. Of course there&#8217;s also a lot of effort
involved in organizing the whole thing: The colleague who does this
essentially organizes 6-8 small conferences (we&#8217;re regularly about 50
people these days) per year (no small feat; thanks, Thomas).</p>

<p>It&#8217;s worth every single cent.</p>

<p>Company events are among the very best things about innoQ. They serve
to help us to spend some quality time discussing various topics,
whether it&#8217;s company strategy, a new programming language, library,
framework or product, a new approach to project management, or some
very project-specific problem. We&#8217;re also able to invite candidate
employees to a setting where they have a great chance to get to know
how innoQ works.</p>

<p>Most importantly of all, they&#8217;re <em>fun</em>. We spend a lot of time doing
geek things, but there&#8217;s always time for great food, occasional
drinks, and socializing and talking about other important things in
life.</p>

<p>So if you see me tweet from Barcelona during the next three days (where I
plan to spend some time with the works of one of my favorite <a
href='http://en.wikipedia.org/wiki/Antoni_Gaud%C3%AD'>artists</a> tomorrow),
you know why I&#8217;m there.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Hypermedia Benefits for M2M Communication]]></title>
    <link href="http://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication/"/>
    <updated>2012-06-22T15:00:00+02:00</updated>
    <id>http://www.innoq.com/blog/st/2012/06/hypermedia-benefits-for-m2m-communication</id>
    <content type="html"><![CDATA[<p>Hypermedia is the topic that generates the most intensive
discussions in any REST training, workshop, or project. While the
other aspects of RESTful HTTP usage are pretty straightforward to
grasp and hard to argue with, the use of hypermedia in
machine-to-machine communication is a bit tougher to explain.</p>

<p>If you are already convinced that REST is the right architectural
style for you, you can probably stop reading and switch over to Mike
Amundsen&#8217;s excellent <a href='http://www.amundsen.com/hypermedia/hfactor/'>&#8220;H Factor&#8221; discussions</a>.  That may be a bit tough to start with, though, so I
thought it might make sense to explain some of the ways I use to
&#8220;pitch&#8221; hypermedia. I&#8217;ve arrived at a number of explanations
and examples of meaningful hypermedia usage, explicitly targeted at
people who are not deep into REST yet:</p>

<ul>
<li><em>&#8220;Service Document&#8221; and &#8220;Registries&#8221;</em>: Especially for people with an
SOA/SOAP/WSDL/WS-* background, the idea of putting at least one
level of indirection between a client (consumer) and server
(provider) is well established. A link in a server response is a way
for a client to not couple itself to a particular server address,
and a server response including multiple links to &#8220;entry point&#8221;
resources is somewhat similar to a small registry. If providing
links to actual entry point resources is the only purpose of a
resource, I&#8217;ve become used to calling it a &#8220;service document&#8221;. Of
course these documents themselves can be linked to each other,
allowing for hierarchies or other relationships; they can support
queries that return a subset of services; they can be provided by
different servers themselves; and they are way more dynamic than a
typical registry setup. In other words, the very simple approach
included in HTTP is far more powerful than what most crazily
expensive registries provide.</li>
<li><em>Extensible contracts</em>: The merits of being able to link to resources
can be exploited to add functionality to existing systems without
breaking their contracts. This is most visible in server responses
that have one or more places where you can put additional links. As
your server or service evolves, you can add links that will be
ignored by existing clients, but can be used by those that rely on
them. The concept of &#8220;a link to a resource&#8221; is both sufficiently
generic and specific to be meaningful enough, especially if you
include a way to specify what they actually mean via a link
rel=&#8230; approach (but more on that in a separate post).</li>
<li><em>Co-Location Independence</em>: What I mean by this slightly weird term is
the fact that while resources that are exposed as part of a service
interface are sometimes (or maybe even often) designed in a way that
requires them to be part of the same implementation, they very often
are not, i. e. they could at least in theory be part of a different
system. (In fact you can reasonably argue that there should be no
assumption about this at all, neither on the server nor the client
side for something to be rightfully called &#8220;RESTful&#8221;, but I simply
haven&#8217;t found that to be doable in practice.) In those cases where
resource don&#8217;t need to be hosted by the same implementation, you can
and should couple them via links and have clients navigate them
instead of relying on common URI paths.</li>
</ul>


<p>There are quite a few more examples to talk about, but I won&#8217;t do that
now <a href='https://twitter.com/stilkov/status/215916063790075907'>as I promised to publish something today </a> and don&#8217;t want to get into
the habit of keeping drafts lying around for too long again. (I know,
lenghty this is probably not. Sue me.) So please
let me know in the comments what you think of these three if you&#8217;re just
starting to pick up REST, and what additional ways of explanations you
use if you already have done so.</p>
]]></content>
  </entry>
  
  <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>
