4 ms·
I like the idea of the performance and simplicity of Tornado, as I primarily use web.py. After reading this blog entry I decided to give Twisted another look. I
by crad 17y ago
I like the idea of the performance and simplicity of Tornado, as I primarily use web.py. After reading this blog entry I decided to give Twisted another look. It took me about 2 minutes to get to the info about the web module and the examples were not very clear. I've walked away wondering a few things:
If I use twisted, should I use web or web2?
How do I map URI's to functions?
When I go to the tornado homepage, I scroll and in < 1 minute I see how I would code for it and can be off and running. To develop web apps, I shouldn't have to spend time figuring out an async network communications framework, I should be worried about programming my app.
My perception from the Twisted site is that I would need to spend time figuring out the twisted way of doing things, then figure out the web add-on way of doing things, then worry about my app. With Tornado, I'm very close to a drop in replacement for web.py and I can be off to the races.
- dlsspy 17y agoYour perception of twisted may be as it is because you can do SO MUCH with twisted. If it's a web.py replacement you want, it doesn't add complexity. Take a look at the diff to go from a friendfeed ioloop to a twisted reactor loop (with my adaptor) in tornado: http://pastebin.com/f707e5ae9 http://pastebin.com/f707e5ae9 You replace two imports with two other imports, and three lines of startup code with three other lines of startup code. Your app doesn't change.
- scott_s 17y agoWhich is the same as saying it's a failure of documentation and explanation.
- crad 17y agoI was eyeing up the code earlier for this. This is great and is a good counter for my argument about Tornado's near drop in replacement. However, that's not my main point. Ultimately, I think Twisted, due to the fact it does so much, is intimidating. The documentation lacks succinct examples of how to implement the very basic things people want to implement. The documentation to figure out how to make an app is buried under at least 3 clicks and even then isn't clear. The comments, when there are comments, in the examples don't truly explain the why of the actions just that they are there. If twisted wants to be considered as a serious contender as foundation to develop web apps on, they need to take a look at how important very good documentation is to Django's success or how the simple, uncommented example at http://www.tornadoweb.org/ http://www.tornadoweb.org/ is more clear than the first bit of web example code at twisted: http://twistedmatrix.com/projects/web/documentation/examples/silly-web.py http://twistedmatrix.com/projects/web/documentation/examples.... I'm not knocking twisted, I'm trying to explain why when I went around evaluating what I would use in my projects, I did not choose Twisted. If you find my decisions and observations valid or not is up to you.
- dlsspy 17y agoI'm not reading anything you're saying as being negative towards twisted. The thing, is twisted isn't a web framework, so nobody should find it surprising that it doesn't make it really easy and obvious how one would go about making a web site with it. A lot of people nowadays seem to look at a programming language and think "yeah, but where do my HTML templates go?" Most of the things I've built in twisted don't have web interfaces. There's a guy in the list now trying to figure out how to get his IRC MUC sending out ICQ alerts through OSCAR -- now HOWTO there, either. :) This feels more like a python vs. ruby discussion than anything else to me. One has a community that focused really hard on making a very rich web framework and the other can do web stuff, but isn't quite there. In both camps, you have extremists who can't see why anyone would use the other. In both cases, they can be better. :) So I'm hoping others will contribute to making the twisted web story better.
- nuggien 17y agoIs the code for tornado.twister available anywhere?
- crad 17y agohttp://github.com/dustin/tornado http://github.com/dustin/tornado
- gsiener 17y agoYes, Dustin forked it on github. You can read about it here: http://dustin.github.com/2009/09/12/tornado.html http://dustin.github.com/2009/09/12/tornado.html tornado.twister here: http://github.com/dustin/tornado/blob/205a13b3c0afac843abdebb86bff9f7336414510/tornado/twister.py http://github.com/dustin/tornado/blob/205a13b3c0afac843abdeb...
- waleedka 17y agoYou might be missing the point. Had FriendFeed worked on improving Twisted and it's documentation to make it easier to use, they would have achieved what they needed in less time and would have avoided fragmenting the resources of the open source community among two projects.
- crad 17y agoI do get that point, but to that end, perhaps they made their decision, in part, based upon the same type of thought process. This is progress, and as a result, the Twisted people, if they're listening, have gotten valuable feedback out of the process from many people other than myself as a result. There has also been much more about Twisted on places like Hacker News than I've seen, relatively speaking. With Dustin porting the meat of Tornado on top of Twisted's IO handler, there is much more interesting things to come out of it all. It is in no way a negative thing for Twisted for there to be competition in an area of cross-over such as this.
- mbrubeck 17y agoI think you underestimate the effort it would take to write concise, accurate documentation for a project the size of twisted. I bet it took far less time to write the 5000 lines of code in Tornado than it would to rewrite the documentation for Twisted and its web modules, and get that accepted and integrated upstream. And it wouldn't fix the fact that Twisted has all sorts of functionality that Tornado developers don't need, aren't interested in documenting, and that web developers would have to either avoid or wade through.