BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Wee: Continuation Based Ruby Web Framework

Wee: Continuation Based Ruby Web Framework

Leia em Português

This item in japanese

Bookmarks

Wee (web engineering easy) is a Seaside like web framework that uses continuations and lets the developer "get the job done quick and beautiful", as its developer Michael Neumann writes. Wee also has reusable components, "which are like widgets in a GUI. Once written, you can use them everywhere", targeting componentized HTML GUI applications, rather than RESTish ones. The approaching 2.0 release will also be fully Rack based.

Neumann's blog post about Wee shows some examples how much more readable code with continuations can be. With continuations, a simple sequential flow can be written as:

 callcc page1
 callcc page2
 callcc page3

Compare this to the alternative, written in continuation passing style:

 call page1 do
   call page2 do
     call page3
   end
 end

If continuations are so useful, why isn't every framework using them? A reason why there aren't more continuation based web frameworks for Ruby is certainly that continuations in Ruby 1.8 leak memory. Although Brent Roman's MBARI patches fix the memory leak, they aren't yet in the official Ruby 1.8 series (they might get included once Engine Yard assumes the maintenance). With Ruby 1.9.1, the memory leaks are also gone and Wee takes advantage of that:

For 10000 requests (with one thread) Ruby 1.9.1 takes 16 seconds and requires 12 MB of memory. The same example with Ruby 1.8.7 grows to 329 MB of memory and takes 56 seconds

Wee seems to be a good reason to start switching to Ruby 1.9 and also an interesting alternative to Rails, now that Merb will be merged into Rails 3.0.

Rate this Article

Adoption
Style

BT