Enterprise Web Application Architecture 2.0 and Kittens
Join the DZone community and get the full member experience.Join For Free
According to its homepage, CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. That is a boring bunch of words. Here is why it is interesting.
Typical enterprise web-application architectures that I've worked on in the past look something like this:
grey boxes represent the data format used between each layer. As you
can see, the data gets transformed many times in a typical web request
from Database to Browser.
Ok now let's have some fun. Imagine that our database was clever enough to do all of our form validation and authentication for us. Our diagram would change to look like this:
And what about if we split up the application layer - we can put all of our business validation logic in database, and push any other leftover application logic into the presentation layer.
As shown in the diagram, there are typically two methods used to produce HTML, and they are often used together:
1. Server side view templating - where HTML code is produced on the server and sent directly to the browser (e.g. server side MVC, JSP, Velocity, Freemarker)
Then how about we give our Database an HTTP interface, make it speak JSON and store data in JSON format. This will allow us to remove the data access layer and that awful ORM to which we've been shackled for so long.
What kind of amazing magical database can do all this? Well it turns out that a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API can.
I'm not claiming any silver bullet here, in fact CouchDB is still relatively immature. But as a potential architecture for a typical Enterprise Web App - it makes you think about whether we really need all of those grey and blue boxes. If you'd like to learn more - download CouchDB, try CouchApp, and try this demo.
Oh and as promised - here are some kittens:
Opinions expressed by DZone contributors are their own.