Webmachine is a resource server for the Web.
Justin Sheehy - Justin Sheehy - September 23, 2008I don’t like web frameworks. They’re mostly-complete Web applications with a few places you get to modify. If your biggest goal is to get something running instantly, and your something is shaped enough like an existing framework, then it might be your most effective way to get started. However, as soon as things inevitably get interesting, or you want to use a a different data storage system or some aspect of HTTP that your framework didn’t envision… well, your handy framework is now something you have to spend time working around instead of with.
One of the first technical questions to deal with in a Web startup is “which Web framework should we use?” If the term wasn’t already taken I would have imagined a Web framework to be something that gave you a place to define the representations and other Web-relevant properties of your application’s resources—with the emphasis that the first-class things on the Web are resources and that their essential properties of interaction are already quite well defined and usefully constrained. It was a Web framework about the Web that I really wanted, but I didn’t see any.
I knew I wasn’t the first one to ask. People like Bill have been wondering âwhere are the REST toolkits?â? for a few years, but nothing really strong has yet emerged. Mark Nottingham has pointed out that even the better Web frameworks don’t realize the power of having generic semantics. I agree, but I think that his examples didn’t quite go far enough. Last December, Andy Gross and I realized that we could write something good enough for our own needs easily—so we did.
Introducing Webmachine: a layer that adds HTTP semantic awareness on top of the excellent bit-pushing and HTTP syntax-management provided by mochiweb. Webmachine is not yet complete, and it’s not perfect, but it has worked well for us and we’d like for there to be more conversation about what REST tooling should be like.
A Web application in Webmachine is a set of resources, and resources are defined by functions or predicates over their state. That might sound abstract or confusing, but it turns out to be quite simple to implement. I’ve provided some trivial examples to show just how simple it is.
The initial implementation of Webmachine was inspired in large part by version 1 of Alan Dean’s HTTP flow diagram. I subsequently worked with Alan to improve the diagram as we developed Webmachine. Webmachine’s request handling engine reflects that diagram explicitly.
If you decide to take it for a spin or read the source, please feel free to drop us a line.
A brief language digression: when we started writing a system in Erlang we assumed that we’d only be able to use it for some special-purpose backend work. We were wrong. It’s been great for rapid development of interesting Web applications, and developers seem to like it. All of our server-side work, from web request handling to page templating to object storage has ended up being in Erlang not out of any dogma but because it has been such a practical tool.
At some point I hope to also post here about our choices in templating language, our unusual decisions for data storage, building practical systems around linked data, and how we’ve gained business value from representing our core data in multiple media types. But part of the point I hope to make with Webmachine today is that those choices ought to be separable from your choice of Web / REST tools.
Categories: Blogs Justin Sheehy
Comments
No comments so far, you could be the first.Add comment
Erlang on Twitter
» MQuotient (MQuotient Solutions): Great start to seminars at MQ. Started with Fundamentals of statistics, Concurrency with Erlang, Python tricks and Advanced Git
» a2zmax (這いよれ!あずまっくす): RT @matsumotory: erlang入れるのに、久々にepel使ってる
» matsumotory (MATSUMOTO, Ryosuke): erlang入れるのに、久々にepel使ってる
» csanz (Christian Sanz): earlang community is kinda weak ATM http://t.co/pJCU5TSY
» dooridho (Ridho Septiansyah): Hha kirimlah boy nak jadiin DP :D “@doni_erlang: Mantap” boy,haha RT @dooridho: @doni_erlang boy poto kemaren gimano :D”
» doni_erlang (Dony Erlangga): Mantap” boy,haha RT @dooridho: @doni_erlang boy poto kemaren gimano :D
» dooridho (Ridho Septiansyah): @doni_erlang boy poto kemaren gimano :D
» 9renpoto (Keisuke Kan): EndingがErlangに見えるぐらいに視力落ちてる
» doni_erlang (Dony Erlangga): Otak lo yg lemot bro haha RT @rudyprasetio: Lemot amatt ni…
» dtoader (Dragos Toader): Building Erlang OTP R15B from source in cygwin http://t.co/JhSzPZLY
Statistics
Number of aggregated posts: 10504
Number of comments: 2145
Most recent article: May 21, 2012
Latest comments
» sunshine on We Who Value Simplicity Have Built Incomprehensible Machines: How to Get Free Credit Scores Having good credit is imperative in today’s world. There are so many things you…
» cheap stickers printings on A Forgotten Principle of Compiler Design: I really like your way of expressing the opinions and sharing the information. It is good to move as chance…
» jamesmathew on This is Why You Spent All that Time Learning to Program: This could be a good achievement for the small area to have a personal news channel and could really help…