DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Enterprise Web Application Architecture 2.0 and Kittens

Enterprise Web Application Architecture 2.0 and Kittens

Daniel Alexiuc user avatar by
Daniel Alexiuc
·
Feb. 05, 10 · Java Zone · Interview
Like (0)
Save
Tweet
8.74K Views

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:



 

The 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)

2. AJAX - where only data is sent from the server via an XMLHttpRequest, and Javascript manipulates the DOM directly

Let's abandon server-side templating, and do all our templating on the client side in Javascript. In fact, let's use Javascript for all our presentation needs:

 



 

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:


Web application Architecture

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Enough Already With ‘Event Streaming’
  • How to Test JavaScript Code in a Browser
  • Choosing Between GraphQL Vs REST
  • Create a Self-Service Customer Support Chatbot Without Code

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo