This Blog continues on

Saturday, October 04, 2008

What Twisted could learn from Kamaelia.

Two awesome things: Twisted, and Kamaelia. I will not compare them. They are different, and have different purposes, and as I said. Both are great.

I have recently been playing with Kamaelia for the first time. If you don't know what Kamaelia is check out but I admit it does take some getting my head around. (Just like Twisted did, back in the day when I first came across it.) But persevere.

Kamaelia is a library for creating highly concurrent applications. And along the way it has reminded me of: Erlang, Tasklets and Twisted. It has a highly componentized approach where components communicate with eachother using inboxes and message passing. That's all I'll say about it here. I am sure I will blog more as I use it more.

Now the first thing I want to do with Kamaelia is be able to hook it up with GTK, and I have managed to do that, but it was incredibly easy. Why? Because Kamaelia is happy to run its scheduler in the background in a non-main thread.

from Axon.background import background

So the remainder of the gtk application can just run:

gtk.main() # yay!

Now Twisted has a solution for GTK, using the GTK reactor, and it works perfectly well, but look at the difference. Between the two:

Kamaelia is a library, Twisted is a framework.