On 30/12/2008, at 10:21 AM, Chris Anderson wrote:
On Mon, Dec 29, 2008 at 3:38 PM, Antony Blakey <[email protected]
> wrote:
How is it 'easier to work with'? How does using _id and _rev
everywhere make
it not easy? Surely it's not the difficulty of writing code?
I argued in IM with Jan, that having _id and _rev only appear with
prefixes in the context of a document, makes for a primitive type
system. Any JSON object with _id and _rev fields is a CouchDB
document. Where those same values appear elsewhere they are not
prefixed, and it's not a document.
I think it's nice that code which is designed to process documents
will hit a speed bump if it is passed view rows. Duck typing is a
fundamental advantage of JSON, and CouchDB's makes good use of it.
It's nice to know by looking if you have a document on hand.
A similar argument could be applied to having _id and _rev everywhere,
on the basis that it types the atom - wherever you see _id you know
you have a document id, and similarly with _rev. And it makes it
easier to write generic code that deals with ids and revs, because
such code doesn't have to be aware of the context of either it's input
or output.
Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787
Isn't it enough to see that a garden is beautiful without having to
believe that there are fairies at the bottom of it too?
-- Douglas Adams