couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Wolff <>
Subject Re: doctype vs. duck typing
Date Thu, 12 Nov 2009 21:44:44 GMT
We use duck typing, which is very javascript-y. When we had strict typing,
we ended up building an inheritance mechanism for our views. Down-side is
that property names within a given database are global.


On Thu, Nov 12, 2009 at 1:40 PM, Robert Campbell <> wrote:

> I'm reading CouchDB in Action and they make use of a doctype in their
> examples. This doctype attribute is used in your Map functions to
> easily filter out the specific types you want. Example:
> if (doc.doctype == "User") // we have a user...
> CouchDB: A Definitive Guide, on the other hand, makes use of duck
> typing. Essentially you determine that a document is a duck if it
> quacks and flies:
> if (doc.quacks && doc.flies) // Looks like a duck..
> What are the pros and cons of each approach? Which one do you guys use and
> why?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message