English 中文(简体)
纵向框架何时比事件驱动框架好? (即铁路何时比节点/js好? )
原标题:When are threaded frameworks better than event-driven frameworks? (i.e., when is rails better than node.js?)

我理解什么是线性框架(Rails, Django, Symfony2,...)。我理解什么是事件驱动的框架(Node.js, EidentMachine, Twisted,...),为什么它对于生活、聊天和速度来说是巨大的.此外,它们似乎不会给正常使用带来问题。所以:

  • What are the drawbacks of event-driven frameworks?
  • When should I prefer Rails to Node.js?
  • Why aren t all new web servers written with EventMachine, Twisted, or Node.js?
  • Will famous frameworks such as Django or Rails become event-driven or die?
最佳回答

由事件驱动的框架的缺点何在?

  1. Familiarity. Because event-driven web programming is so different, it will be a while before programmers are comfortable with it. When you are working on a deadline, it’s easier to use what you know, that works.
  2. Library support. Node has an amazing number of modules, but has a long way to go to catch up with Ruby and Python. Update: Node now has more published modules available than Python or Ruby.
  3. Deployment. IT staff are used to threaded frameworks. To take advantage of event-driven frameworks, you’ll want to be asynchronous top-to-bottom. Right now you can develop in Node.js, but will you be able to deploy it effectively, or will you have to administer your own servers?
  4. Unfounded concerns. Things that seem like problems, but aren’t really:
    • Event-driven programming is bad for CPU-intensive apps: The reason being that a CPU-intensive calculation would block the server. This is strictly true, but practically, it is overcome by spawning another process and treating it as I/O, for example, by using Node’s child_process.exec.
    • Event-driven programming is only for apps that need high concurrency: The reason here is that event-driven programming is “harder” than traditional web app programming, so it’s not worth doing unless you have a good reason to. I personally do not think this is the case—event-driven programming is no more difficult, but it is very different. At some point, a critical mass of programmers will be familiar with the event-driven approach and this concern will vanish.
    • Event-driven programming is a mess of nested callbacks. This may be true when you first learn it, but eventually you’ll discover how to structure your code in a readable way.
  5. Documentation. The documentation for Node and its 3rd-party libraries is terrible, usually consisting of nothing more than a README.md. Coming from the Python world, where we are used to excellent documentation, this is a big drawback. This is slowly getting better (we need more documentation like this).

我什么时候应该更喜欢铁路而不是Node.js?

  • When you or your team just prefer Ruby over JavaScript.
  • When you or your team are not familiar with Node and you need to get the job done.
  • When you need to use functionality that’s in Rails that Node doesn’t have yet.
  • When you need to deploy to existing Rails-based infrastructure.
  • When you have to convince management that you should use Node.js, but you don’t want to be the one to take the fall if the project fails.

为什么所有新的网络服务器不与事件Machine、Twisted或Node.js一起写入?

见上文。

著名的“决哥”或“铁路”框架会变成事件驱动还是死亡?

江哥和铁道将存在很长一段时间。 这些框架中有很多应用程序,也没有理由重写它们。 还有一个巨大的人才库,这在开发新的网络应用程序时常常是一个考虑因素。

(但见"http://www.quora.com/What-are-the-forests-forming-in-node-js-versus-Python" rel=“noreferr”>这个Quora回答来自Django的主要开发者,赞同节点)。

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签