28697 cazuri COVID-19 în Moldova
7836 – cazuri active
19998 – cazuri vindecate
863 – cazuri fatale
Actualizarea datelor: 13 august 2020 ora 16:27


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

10:29:54Acuză condiţii inumane la închisoarea de la Cahul —» Curaj.TV | Media alternativă
03:36:07Dragostea și încercarea —» Viata pe Tinder – Viata amoroasa pe Tinder
22:07:52Mesaj de solidaritate pentru belaruşi (ru) —» Curaj.TV | Media alternativă
22:00:0528 HEX —» Castraveţ
21:59:09Stop poluării Ploieştilor! De vorba cu o activistă de mediu —» Curaj.TV | Media alternativă
12:29:11Atelier de planificare strategică —» Centrul Comunitar Instruire, Acces Informaţie Călăraşi
12:04:01Va ninge în august —» Eleonora Lisnic în versuri
10:36:55Locuia pe stradă, acum are un culcuş civilizat —» Curaj.TV | Media alternativă
10:24:32La primăria Grindu au venit activişti, femeia cu legitimație sună poliția! —» Curaj.TV | Media alternativă
09:03:37RENAULT SCENIC 3, 15dCI - FAP EGR off —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
07:13:56Un brand nou în lumea vinurilor bune: Caragia Winery —» Fine Wine
05:11:52Cum am ajuns să le oferim copiilor în fiecare vară o vacanță de neuitat la bunici —» Sunt MAMĂ!
22:29:44Distracție ciudată în jungla urbană —» Curaj.TV | Media alternativă
22:09:59DESPRE GLAMOUR ŞI VINĂRII —» Curaj.TV | Media alternativă
20:43:09Înscrieri la webinarul “Vampirii energetici. Cum ne protejăm de oamenii toxici” —» Sanda Diviricean – "Fii-Nu încerca să devii." – Osho
19:04:29Râsuri prezidențiabile —» Sergiu Mocanu
18:48:17ЧТО НАТВОРИЛ ДАРВИН: Кровавое наследие теории эволюции —» Curbet Alexandru
16:12:21Un ”7 aprilie” în Belarus?! Va cădea dictatura lui Lukașenko? —» Elena Robu
10:06:21„Cartea Nicoletei” la Centrul Academic Internațional Eminescu —» BiblioCity
09:10:03Cheia succesului—un parteneriat viabil —» Mişcarea Ecologistă din Ştefan-Vodă
09:06:24Как любимый автомобиль, превращается в кирпич, через 450 км? AdBlue Error —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
07:38:20Au prins poliția cu un transport de lemne —» Curaj.TV | Media alternativă
07:29:24Candidata opoziției, Svetlana Tihanovski a părăsit Belarusul —» Elena Robu
07:09:36COVID-19: Peste 20 de milioane de infectări la nivel global —» Elena Robu
07:06:51Tu cui dai energia ta pozitivă? —» Sunt MAMĂ!