I’ll have more notes about CouchDB later tonight.
First, though, I want to step back and look at the big picture.
A few months ago, Bill de hÓra wrote that “a framework like Django or Rails is purpose-built for the Web” (as opposed to old-school tools that try to pretend the Web doesn’t exist — I’m looking at you, ASP). It doesn’t sound like much, but to me this is the best possible compliment Django could be given. We’ve tried incredibly hard to make sure that Django respects and follows the general principles of the Web.
Let me tell you something: Django may be built for the Web, but CouchDB is built of the Web. I’ve never seen software that so completely embraces the philosophies behind HTTP. CouchDB makes Django look old-school in the same way that Django makes ASP look outdated.
Let me try to explain what I’m talking about. You want an API without having to write a line of code? It’s called curl, and it ships with your MacBook. And just look at how simple the APIs are in your favorite language.
The wins go deeper than APIs, though. Think about what it would take to add load-balancing to CouchDB. I’ll give you a hint: perlbal. Or what about adding a transparent caching layer? Try Squid.
HTTP is the lingua franca of our age; if you speak HTTP, it opens up all sorts of doors. There’s something almost subversive about CouchDB; it’s completely language-, platform-, and OS-agnostic.
Look, CouchDB may succeeded, and it may fail; who knows. I’m sure of one thing, though — this is what the software of the future looks like.
Comments:
Hitting the nail on the head I think. I gave a quick BarCamp presentation a while back stressing that, as a hacker of APIs, one of the best things about REST is the obviousness of the documentation. You can get up to speed and start building with it faster.
just for the record: couchDB was not the first database that was
using REST as its interface. e.g. eXist (exist.sourceforge.net)
can be used in pretty much the same fashion. One thing that eXist does better is that you can address all elements by a unique xpath expression which is much more comfortable to use than the syntax in couchDB.
What goes around, comes around: on an initial reading, CouchDB looks just like the core concepts of Lotus Notes updated to work across HTTP. I extracted some text from the CouchDB Quick Overview, and replaced CouchDB with Notes, leaving the bits which don't apply to Notes in [square brackets]:
What Lotus Notes[CouchDB] is
* A document database server[, accessible via a RESTful JSON API].
* Ad-hoc and schema-free with a flat address space.
* Distributed, featuring robust, incremental replication with bi-directional conflict detection and management.
* Query-able and index-able[, featuring a table oriented reporting engine that uses Javascript as a query language].
What Lotus Notes[CouchDB] is not
* A relational database.
* A replacement for relational databases.
* An object-oriented database. More specifically, Lotus Notes[CouchDB] is not meant to function as a seamless persistence layer for an OO programming language.
What's a Document?
A Lotus Notes[CouchDB] document is an object that consists of named fields. Field values are lists that may contain strings, numbers and dates. An example of a document would be a blog post:
Subject: "I like Plankton"
Author: "Rusty"
PostedDate: "5/23/2006"
Tags: "plankton" "baseball" "decisions"
Body: "I decided today that I don't like baseball. I like plankton."
In the above example document, Subject is a field that contains a single string value "I like plankton". Tags is a field with values "plankton", "baseball" and "decisions".
A Notes[Couch] database is a flat collection of these documents. Each document is identified by a unique ID, a DocID. Each document has one (and only one) DocID, and that DocID must be unique. Two documents with the same ID in different replicas of the same database are considered to be instances of the same document.
By default, DocIDs are UUIDs (a [randomly] generated 128 bit number, example: F81D4FAE7DEC11D0A76500A0C91E6BF6)[, but **any string** can be a document ID].
Remember - the bits in square brackets are the bits don't apply to Notes but do apply to CouchDB.
Lotus Notes is a very powerful system, and was much ahead of its time, but is widely hated because its programming model, user interface and parts of its implementation are a crock compared to the elegance and power of its underlying concepts and some aspects of its low-level implementation (e.g. replication). However, Notes developers often have to put up with weird arbitrary limits like 15K, 64K, etc. on field sizes. In this day and age, there's no excuse for such poor implementation, and it's not as if IBM's short of resources, is it?
Any way - if CouchDB can bring the good parts of Notes to a wider audience, without the crud that Notes developers have to endure in their working life, then more power to CouchDB.
There have been other attempts to do things like this - e.g. using Java - see www.puakma.com for an example.
Vinay, if I'm not mistaken, I read somewhere a while back that the original couchDB developer was intimately involved with Lotus Notes as well.
fxj - CouchDB has very deliberately moved away from XML and it's developers would not consider XPath a feature. The XML flavor of CouchDB's past is gone. Good riddance.
Vinay - Yes, the roots of many CouchDB ideas are in Notes:
http://damienkatz.net/2005/...
@dan - i totally agree. in principle every output language could be used in couchdb just by creating a special view of the data. very cool.
i just wanted to emphasize that the "language agnostic" features of couchDB also exist in other DBs like eXist.
By ASP do you mean ASP.Net? By that I think you mean ASP.Net WebForms. ASP.Net by itself is quite web friendly, and the projects of MonoRail and the new MSFT MVC framework are solid contenders. my $0.02
This approach to building apps is pretty much what I've been evangelizing (poorly, apparently) and practicing for the last couple years as "microapps" (see microapps.org).
Dru, without trying to guess whether Jacob meant classic ASP or ASP.Net, can you explain what you mean by "web-friendly", and how ASP.Net is that?
Leave a comment: