|
|
|
|
|
by PhilChristensen
6109 days ago
|
|
I'm sorry, but this post is just packed full of FUD. I hear this all the time, "argh, Deferreds are so hard to understand," as if there's some kind of magic going on in a Deferred. Deferreds are just a way to encapsulate two callbacks, one for errors and another for successful callbacks. If you're writing any kind of significantly complicated asynchronous process, what is the difference between following a bunch of Deferreds and following a bunch of callbacks?? Asynchronous coding is hard. There's no framework that is going to make that go away. Diesel looks nice enough, but although it shows promise, there's not enough examples of hardcore usage to make a sufficient comparison. An asynchronous IO framework that has nothing but HTTP and echo examples doesn't even scratch the surface of the kinds of apps that require the advanced asynchrony available in Twisted. |
|
The difference is that in co-routine based code (such as concurrence or eventlet) there are no callbacks. Co-routines are all about message passing which leads to much cleaner and much less code in most applications.
It's not uncommon to see 40%+ boilerplate callback-handling code in a twisted app. Those are not needed in a coro-environment.
Asynchronous coding is hard.
Actually the established patterns for implementing asynchronous code are hard. You get to choose between threading-hell (deadlocks, races) and callback-hell (code-bloat). I have no idea why these abstractions grew so popular, my guess would be because they are "closest to the metal".
But they are not without alternatives; co-routines, actor-based concurrency and erlang exist - all of which enable fairly straightforward "Do what I mean" development.