CouchDB: a new way

A few months ago I found out about CouchDB. It is a document database that speaks HTTP: you can manage it from a static HTML page using just HTTP methods: PUT, GET, DELETE and that is an amazing thing. People are reinventing the CRUD wheel last couple of decades and it got so mainstream that no one tries to question that. Why we need to re-implement something that HTTP already has? And that’s true for every web application we see on-line…

What we know as a “record” in relational databases is (almost) a “document” in CouchDB. I’m saying “almost” because a document is a complete thing: a product, an article, a contact, anything, and in relational world a record may be only a piece of something. In relational database terms a document it’s like a completely denormalized entity. Every document is self-contained.

It makes a lot of sense to me because when you gather information on a “record” you have to run across a bunch of tables to get it. Every single time. Relational databases are immensely complex applications and it takes a huge amount of computational power to do that every time. Why don’t we store all the data we need for an entity together and retrieve it quickly when we need it? This is what CouchDB does and I think this is a brilliant approach.

But this is not all: documents are managed as JSON documents which you can easily crunch using JavaScript alone. That’s another reason why I appreciate it so much: is simplifies things. You don’t need a server-side language that would take data from the HTTP request, populate some object, validate, and pass it through an ORM to the database for storage, and this is an enormous gain in computational power and man-effort to write that application code.

One more amazing thing I found in CouchDB is the possibility to attach files to documents. Then you can get it as a part of the document of independently, just as you would download a static file from a web-server. This made me think to store HTML pages in it, as well as CSS files, JavaScript files, images and anything else. So you don’t need anything else to write a web application!

You have a couple of limitation that puts your creativity at work, and this make you review the way you develop a web application on every step. Every request can address a single individual document like “get me the document with ID XYZ”, or a list of document, like “give me the documents that have ID’s from 34 to 42″.

This is only a couple of goodies, that I found for me as a web UI developer. But is has a lot more to offer: fault tolerant (you have to try very very hard to loose data), scalable, fast, and a lot others. If you’re a hardcore RDBMS-oriented developer (and who isn’t??) it may need some time to find your way and to adapt your mind to think the CouchDB way, but even if you don’t like it enough to want to forget everything you know about relational databases and embrace it for it’s simplicity, getting to understand it can dramatically change your viewpoint on web development.

I’ve started an experimental project for CouchDB just to get a feel of how it works and it is amazing.


Sursa
2010-01-10 02:25:30



Comenteaza





Ultimele 25 posturi adăugate

16:50:14La întâlnire cu opera lui Constantin Brâncuși —» Biblioteca de Arte 'Tudor Arghezi'
07:14:03JURNALUL LUI ORFEU —» Leo Butnaru
16:31:29Marşul tăcerii pentru victimele pe bicicletă —» Curaj.TV | Media alternativă
13:18:48Șota Maharadze, gruzinul care i-a făcut campioni pe hînceșteni. Legătura cu Kvaratskhelia. Tată unic 🔥🔥🔥 —» Sandu GRECU
08:10:00Lilian Carp: Raportul Primăriei Chișinău confirmă distribuirea apartamentelor de la Apă-Canal către oameni de partid și conducerea întreprinderii 😡 —» Sandu GRECU
07:40:49DIN REVISTA TINERILOR —» Leo Butnaru
15:01:45Vino și joacă fotbal alături de copilul tău ⚽️🏆💥 —» Sandu GRECU
11:19:57Tradițiile au cucerit centrul Chișinăului. Corespondentele Curaj TV Ploiești , CristinaVîrtosu și Laurenția Costin au fost prezente cu camera de filmat la „Festivalul Tradițiilor” —» Curaj.TV | Media alternativă
11:19:57Tradițiile au cucerit centrul Chișinăului —» Curaj.TV | Media alternativă
00:54:00Prevenirea tentativelor de fraudă telefonică și importanța protejării datelor cu caracter personal ☎️ —» Sandu GRECU
18:30:06Studiul 5.0 privind impactul Investițiilor Străine Directe: Reziliență, consolidare și parcurs accelerat de integrare europeană a economiei Republicii Moldova 🚀 —» Sandu GRECU
08:34:01Festivalul Internațional Shakespeare de la Craiova —» Biblioteca de Arte 'Tudor Arghezi'
20:45:01Compania de consultanță și comunicare strategică, Parsec angajează - Specialist de comunicare și PR 💥 —» Sandu GRECU
20:14:32Agricultura 5.0 explorată de tineri la Târgul regional „Viitorul e AgriCOOL” de la Căușeni ☀️ —» Sandu GRECU
08:23:59Chateau Cristi lansează două vinuri noi —» Fine Wine
04:40:04DIN JURNAL 2023 —» Leo Butnaru
07:01:55DIN POEZIA LUMII —» Leo Butnaru
17:24:24🎊 15 ani de activitate ai S.A. „Loteria Națională a Moldovei" —» Sandu GRECU
12:58:44Am desemnat câștigătorul premiului de 6600 de lei oferit de Clubul Premier Football 💥🏆🔝 —» Sandu GRECU
09:07:43TÜV Austria își extinde prezența în Republica Moldova: Standarde internaționale pentru creșterea competitivității economice 💫 —» Sandu GRECU
13:45:50Efros la Londra, acasă la Borsetca. Agenție de impresariat împreună cu Plahotniuc. Banii din transferuri 🔥🔥🔥 —» Sandu GRECU
12:13:34Moldova, prezentă la CMB în Erevan —» Fine Wine
05:30:37INTERVIU CU UN CORESPONDENT... NEVĂZUT —» Leo Butnaru
15:12:02🔔 Chișinăul va găzdui evenimentul la nivel înalt EU-Moldova Investment Conference pe 4 iunie 2026 —» Sandu GRECU
07:27:39INVIDIA, URA —» Leo Butnaru