Quantcast
Channel: a little place of calm » couchdb
Viewing all articles
Browse latest Browse all 10

CouchDB and data storage

$
0
0

Alexander Lang has written a great article about why CouchDB is not compatible with ActiveRecord, and why you should not try to coerce CouchDB into mimicking a relational database. It really is a very different thing altogether: The case of ActiveRecord vs. CouchDB

In my experience of CouchDB i first tried out ActiveCouch because of my familiarity with ActiveRecord. I soon came across problems because it was trying to make CouchDB something that it is not. As i exclaimed at the time, “LOL. ActiveRecord this is not!”

I had far more success with couchrest which is a much closer CouchDB wrapper, enabling CouchDB to be used as it’s intended: as a RESTful interface with map/reduce views.

Domain-Driven Design

Recently i have been reading Domain-Driven Design by Eric Evans. Through reading it my understanding of Rails – and web programming – has completely turned around. My thinking used to be entirely database-centric. I saw Rails as little more than an easy access into the database. For ages i didn’t even realise that you could have models that weren’t connected to a database table!

Now my thinking has changed and i consider the primary focus to be the domain model. I think about the classes and the design patterns that apply to them. I consider how they fit together, how they communicate with each other, and the boundaries between the core domain and subdomains. In my mind, the database has gone from being the most important thing to being just a method of persistence for the data in the domain model.

When you think of things this way round you are less likely to get hung up on the differences between ActiveRecord and CouchDB. You work out your domain, design the classes and then think about the most appropriate database platform to support your model.

Update: I’ve just come across a useful article that provides three methods to achieve a has_many relational structure in CouchDB. CouchDB “Joins” by Christopher Lenz.


Posted in books, couchdb, geeky, ruby on rails

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images