Victus Spiritus

home

Bare Canvas vs Complex Frameworks, a case review of couchapps

07 Nov 2010

Over the past couple of months I've gotten a taste of CouchDB, the couchapp framework, and a chance to explore several superb applications*. My biggest hurdle to doing anything useful with CouchDB was (and still is) totally understanding the couchapp file structure. Couchapp is a utility written in python that creates a framework for placing applications within, and extracting applications out of couchDBs. The benefit of couchapp over alternative web frameworks that utilize couchDB as a backend, is portability. The application becomes embedded and works anywhere couchDB does (servers, replicated local couchDBs, etc).

Here's the default file tree for an application created by couchapp init:


As you can observe the basic couchapp is composed of 34 directories and 59 files. If like myself you prefer a bare canvas to begin development you'll be a little overwhelmed by the file and functional breakdown.

Craving a cleaner canvas

Last weekend while strolling about Bayard cutting I wondered how feasible putting something simple like Sammy.js in front of couchDB would be. A quick search revealed that Richard Metzler and Aaron Quint had hacked together soca (sammy on couch app), precisely the type of app framework I was seeking (implemented as a ruby gem). Here's a look at the bare soca file tree:

From this image you can see 8 directories and 14 files. Soca sacrifices the ability to extract the application from an existing couchDB but gains in both flexibility for app designers to place files where they prefer, as well as much more compact set of files which capture the interaction of the app.

The design advantage is freedom that comes with choices between optional frameworks. It's not unlike the relationship Sinatra has with Rails. Both frameworks have their benefits, but appeal more to specific developers or have a better fit with certain applications.

But wait there's more, node.js for writing couchapps

While writing this post I came across Mikeal Rogers' couchapp toolkit, node.couchapp.js. As of yet I have no idea how to create apps with it, but I've reinstalled node on my iMac and Air since my Ubuntu desktop is on the road to retirement. Juggernaut is powered down. I may install Mac OS X and hackintosh it for my folks.

Would appreciate your feedback in the comments here or on the HackerNews reactions.

Notes:
* = Related posts