coffee, black   no sugar


20061118 Saturday November 18, 2006
the funky web
200611181059

During the last months I was playing around with an idea of mine: what is a computational unit in terms of the web? How could it be defined and what properties would it have? Can it describe how it interacts in a manner that allows to extend the notion of resources, representations and transfers?

On the one hand this sounds rather high level, almost philosophical, but being a dirty hands programmer, I am most curious to find out how it affects software we write. This post is not describing a fleshed out concept, but the ideas which tumble around in my mind. I use this post mainly to reflect on myself (writing lets me focus), but if someone finds all this interesting, I'd be most pleased.

The Writable Web

The Web is described by mentioning things as resources and representations, the RESTfulness of it and, well, you know it all. What is deliberately kept out of this description of the Web - for very good reason - is how all these resources come there in the first place and how and if they change over time.

The HTTP protocol has the verbs PUT, POST and DELETE since version 1.1 (rfc1945 HTTP/1.0 was lacking PUT and DELETE) but they have been a bit neglected in the past. Most talk was around the proper use of GET and if a Url can denote TBLs car or just a picture of it. Well...

But with bigger and better web applications came the need to properly define POST, PUT and DELETE some more which is what REST also does. In order to set an example for future generations, some high profile people set out to show how a resource producing application shall interact with HTTP. The Atom Publishing Protocol was formed and is hopefully soon reaching RFC status.

So, we are today in the excellent position to define how consuming resources and producing resources in the Web shall work. The next step would be to develop concepts how these two aspects interact.

The Process of Creation

Soon we know how to use HTTP properly to publish create resources. But how do these resources come into being? Who are the creators (no polytheism intended), what types of them are there and what properties do they have? And why should we care?

Apart from being a nice mental exercise, I want to categorize resource creation in order to define the most simplistic, yet immensely useful model for it and use that to guide software development. I believe that it is time to define for the web, what functions and objects did for general purpose programming in the past.

The categorization that immediately springs to mind is the distinction between human generated content and machine generated one. The attractiveness of this is the notion that the human mind cannot be modeled anyway, so divide et impera, we can focus on the machines.

But this does not take us very far. For one, nobody knows if the human mind is a machine or not. Second, human minds need to use machines to change the web, so the border is fuzzy at best.

The Web Centric View

Imagine for a moment the worldwide web as a kind of being (No, this is not getting esoteric!). There are two changes it experiences:

  • deterministic: it is possible to make a mathematical description of the change, taking the whole state of the web into account and nothing else.
  • chaotic: what triggered the change and the contents of the change cannot be described through the web itself. There is an outside agency at work here (from the view of the web).
To make a silly analogy: a blind mole's feeling of hunger can be explained by its empty stomach. The pain when banging its head on a root is not depending on its internal state however and cannot be explained that way (it could reason that its running forward was the cause, but then it probably has run forward in the past without banging its head. So this by itself does not allow a deterministic description. Until it makes a model of the roots in its tunnels part of his mental state, but then there are always the new digs that lead to surprises).

Web Determinism

Determinism sounds boring. After all, where is the surprise in that? Have you ever tried to explain programming to a non-technical person? You talk about adding numbers and variables and how even characters have a number and the other person just thinks you are nuts if you spend your life with that stuff. But if you show someone flickr he gets excited. He is just unable to see the connection. (Which you do and therefore you are paid your salary, my friend. Isn't that so?)

So, we know that determinism can lead to exciting things. And, even better, we know from experience that determinism leads to working things. We like that, don't we? How would we then describe an entity, operating in the web, which shows deterministic behavior (from the web's point of view)?

Well, if we go back to the last century, then programs where described as some algorithm which, given a certain input, produces a certain output. So, using this as a base, I come to my description for a web changing entity:

Webions

A webion is a computational entity that for a given set of input Web resources will produce a set of output Web resources. Input resources are defined by their representations received by the webion. Output resources are either new web resources or changes to existing resources. By resource change we mean a change that can be observed on the web, e.g. a change in the resource representation.

Are all webions fundamentally the same? A meaningful further classification would be the set of webions that completely live on the web. I mean by this that the output is completely defined by the input resources. Sort of what functional languages are about. So we can define:

Funkiness

A funkion is a webion that is completely and solely depending on its input web resources. Given the same set of resource representations, it will always generate the same output resources.

Note that in the above definition, I emphasize that the representations of the input resources define the output. So, funkions can have varying output when the input resources change. Otherwise they would be boring. funkions are interesting to me, because as long as the input resources do not change it does not really matter exactly when or how often they run, if they run at least once and do the changes they are made for.

This is really a key point. So I elaborate a bit more. In a global network, any concept that relies on synchronization is very costly and brittle indeed. If your web browser would only work when your computers time is in sync with the web server, there would be no web.

HTTP and REST not only tries to avoid time dependance whenever possible, but the basic concept of resources and their representations, last-modified and etags, encourages resources to show stable behaviour in between changes. It is fundamental for HTTP caching to work and have an effect.

Funkions seem to fit well into this model. Firstly, on collecting input, they can be well behaving HTTP citizens and have no need to bypass any caches. Second, on generating resources, they will not destroy caching (if implemented correctly) since the output should be the same on any subsequent runs, so output resources already living in network caches somewhere will stay valid. Until a change in input forces a changes in output and a real change is done.

Technorati Tags: , , , , , ,

Comments:

Comments are closed for this entry.