couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <>
Subject Re: Changing rev to _rev in view results (Was: Re: newbie question #1)
Date Tue, 30 Dec 2008 00:09:40 GMT

On 30/12/2008, at 10:31 AM, Damien Katz wrote:

> The current rule is that every couch-domain value has a leading  
> underscore when it appears in the root of a document. Your rule  
> would mean that throughout the API, everything that has special  
> significance should have an underscore. In views (key -> _key, value  
> -> _value) in urls ( GET /db/doc?_rev="...") and design docs (views - 
> > _views, map -> _map). That rule is simpler, but I think all the  
> leading underscores are ugly (aethetics) and require more  
> unnecessary typing (efficiency) and gain you no additional behaviors  
> (functionality), and all for the sake of consistency to a slightly  
> simpler rule.

i.e. this simpler rule promotes consistency, which leads to more  
reliable understanding, over writing.

In all cases one should prefer readability/comprehensibility over  
writability. That is a principle worth following.

And as far as writing is concerned, using name identity for values  
that appear in multiple contexts makes it easier to write polymorphic  
code e.g. a function that extracts the document id and revision from  
either a view row or the document value (possibly) contained within.

Antony Blakey
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

The trouble with the world is that the stupid are cocksure and the  
intelligent are full of doubt.
   -- Bertrand Russell

View raw message