为什么Ruby有Rails,而Python没有中心框架?

时间:2022-06-30 11:57:00

This is a(n) historical question, not a comparison-between-languages question:

这是一个(n)历史问题,而不是语言之间的比较问题:

This article from 2005 talks about the lack of a single, central framework for Python. For Ruby, this framework is clearly Rails. Why, historically speaking, did this happen for Ruby but not for Python? (or did it happen, and that framework is Django?)

这篇2005年的文章讨论了Python缺乏单一的*框架。对于Ruby来说,这个框架显然是Rails。为什么,从历史的角度来说,这发生在Ruby而不是Python?(或者真的发生了,那个框架就是Django吗?)

Also, the hypothetical questions: would Python be more popular if it had one, good framework? Would Ruby be less popular if it had no central framework?

此外,假设的问题是:如果Python有一个良好的框架,它会更受欢迎吗?如果Ruby没有中心框架,它会不会不受欢迎?

[Please avoid discussions of whether Ruby or Python is better, which is just too open-ended to answer.]

[请避免讨论Ruby或Python是否更好,这太开放了,无法回答。]

Edit: Though I thought this is obvious, I'm not saying that other frameworks do not exist for Ruby, but rather that the big one in terms of popularity is Rails. Also, I should mention that I'm not saying that frameworks for Python are not as good (or better than) Rails. Every framework has its pros and cons, but Rails seems to, as Ben Blank says in the one of the comments below, have surpassed Ruby in terms of popularity. There are no examples of that on the Python side. WHY? That's the question.

编辑:虽然我认为这是显而易见的,但我并不是说Ruby不存在其他框架,而是说流行程度最高的框架是Rails。另外,我要指出的是,我并不是说Python框架不如Rails好(或更好)。每个框架都有其优缺点,但是正如Ben Blank在下面的评论中所说的,Rails在受欢迎程度上已经超过了Ruby。在Python方面没有这样的例子。为什么?这是个问题。

11 个解决方案

#1


35  

As I see it, Rails put Ruby on the map. The simple fact is that before Rails, Ruby was a minor esoteric language, with very little adoption. Ruby owes its success to Rails. As such, Rails has a central place in the Ruby ecosystem. As slim points out, there are other web frameworks, but it's going to be very difficult to overtake Rails as the leader.

在我看来,Rails把Ruby放在了地图上。简单的事实是,在Rails之前,Ruby是一种非常深奥的语言,很少被采用。Ruby将其成功归功于Rails。因此,Rails在Ruby生态系统中有一个中心位置。正如slim所指出的,还有其他的web框架,但是要超越Rails作为领导者将是非常困难的。

Python on the other hand, had a very different adoption curve. Before Rails, Python was much more widely used than Ruby, and so had a number of competing web frameworks, each slowly building their constituencies. Django has done a good job consolidating support, and becoming the leader in the Python web framework world, but it will never be the One True Framework simply because of the way the community developed.

另一方面,Python有一个非常不同的采用曲线。在Rails之前,Python比Ruby使用得更广泛,许多相互竞争的web框架也是如此,每个框架都在缓慢地构建自己的用户群。Django在巩固支持方面做得很好,并且成为Python web框架世界的领导者,但是仅仅因为社区的发展方式,它永远不会成为真正的框架。

#2


7  

I don't think it's right to characterise Rails as 'the' 'single' 'central' Ruby framework.

我认为将Rails定义为“单一的”“中心的”Ruby框架是不对的。

Other frameworks for Ruby include Merb, Camping and Ramaze.

Ruby的其他框架包括Merb、野营和Ramaze。

... which sort of invalidates the question.

…这就使问题失效了。

#3


7  

The real technical answer is that there are three major approaches to web-development in Python: one is CGI-based, where the application is built just like an old one-off Perl application to run through CGI or FastCGI, e.g. Trac; then there is Zope, which is a bizarro overengineered framework with its own DB concept, a strange misguided through-the-web software development concept, etc. (but Plone is still quite popular); and then there is Django (and Turbogears, etc.), which is guided by the same just-the-tools-needed philosophy as Rails (it can be argued who got there first or who did it better). A lot of people would probably agree that the Django/Rails/CakePHP approach is better than the older approaches, but as the older language Python has a lot more legacy frameworks that are still trying to evolve and stay relevant. These frameworks will hang on because there is already developer buy-in for them. For example, in hindsight many people would probably say that Zope (especially ZODB) was a terrible mistake, but Zope 3 is much better than Zope 2, and there are already whole companies built around Zope technologies.

真正的技术解决方案是,在Python中有三种主要的web开发方法:一种是基于cgion的,其中应用程序构建起来就像一个旧的一次性Perl应用程序,可以通过CGI或FastCGI来运行,例如Trac;然后是Zope,它是一个带有它自己的DB概念的奇怪的超工程框架,一个奇怪的被误导的通过web软件开发的概念,等等(但是Plone仍然很受欢迎);然后还有Django(以及Turbogears等),它遵循的是与Rails相同的“只需要工具”的哲学(可以争论谁先到达那里,谁做得更好)。很多人可能会同意Django/Rails/CakePHP方法比旧的方法要好,但是由于旧的语言Python有更多的遗留框架,这些框架仍在努力发展并保持相关性。这些框架将继续存在,因为已经有开发人员购买了它们。例如,事后许多人可能会说Zope(特别是ZODB)是一个可怕的错误,但是Zope 3比Zope 2要好得多,而且已经有很多公司围绕Zope技术建立起来。

#4


5  

Rails was somewhat revolutionary in its extreme "convention over configuration" approach which set it apart from pretty much anything else and made it the "killer app" of Ruby, causing a lot of people to notice Ruby in the first place.

Rails在其极端的“约定优于配置”方法上有些革命性,这种方法将它与几乎所有其他东西区分开来,并使它成为Ruby的“杀手级应用”,使许多人首先注意到Ruby。

So the question is really "Why did David Hansson decide to write Rails in Ruby rather than Python?"

所以真正的问题是“为什么David Hansson决定用Ruby而不是Python来编写Rails ?”

#5


5  

Remember that Ruby had existed for a long time before Rails was created. According to Wikipedia, Ruby was created in the mid-90's; Rails didn't come around until 2004. Ruby is simply the language that David Hansson chose to use for Rails.

记住,Ruby在Rails创建之前已经存在很长一段时间了。根据*,Ruby创建于90年代中期;Rails直到2004年才出现。Ruby是David Hansson为Rails选择的语言。

And yes, I would say Ruby is to Rails as Python is to Django.

是的,我想说Ruby对于Rails就像Python对于Django一样。

#6


5  

I agree with Ned. I'd bet that more than 90% of Ruby installations are for no other purpose than running Rails. Rails dominates Ruby - there is no single application that dominates Python, mainly because the Python community is somewhat bigger than the Ruby community.

我同意内德。我敢打赌超过90%的Ruby安装都是为了运行Rails。Rails主导Ruby——没有一个应用程序主导Python,这主要是因为Python社区比Ruby社区更大。

#7


2  

Would ruby be less popular without Rails? absolutely.

没有Rails ruby会不会不受欢迎?绝对的。

Would Python be more popular with one true framework? You mean as opposed to several? May be, who knows. In any case most agree Django is a very good framework.

Python会在一个真正的框架中更受欢迎吗?你是说相对于几个?也许,谁知道呢。无论如何,大多数人都认为Django是一个非常好的框架。

Why, historically, did it happen to Ruby? Because DHH chose Ruby after doing his own research.

为什么,在历史上,它发生在Ruby上?因为DHH在做了自己的研究之后选择了Ruby。

To add to the answer regarding Rails having made a breakthrough because of 'convention over configuration' there is also another reason and that is that Rails has been using the meta-programming abilities of Ruby superbly. A lot of the magic of Rails which has contributed to removing a lot of the pain of developing web apps came through this clever use of ruby meta-programming.

由于“约定优于配置”,Rails已经取得了突破性的进展,这也有另外一个原因,那就是Rails一直在使用Ruby的元编程能力。Rails的许多神奇之处在于,它消除了开发web应用程序的许多痛苦,这是通过ruby元编程的巧妙使用实现的。

#8


2  

I'd have to agree that Django is basically the "Rails for Python" equivalent. Why did it take so long? The simple answer is too many options.

我不得不承认Django基本上是“Python的Rails”的对等物。为什么花了这么长时间?简单的答案就是选择太多。

In Python, there are many request/response systems, url rewriters, ORMs, templating languages, etc. that you could build a web stack in dozens of different configurations. In fact, this is exactly what Pylons and TurboGears do is provide a reliable, predictable stack to build MVC web apps.

在Python中,有许多请求/响应系统、url重写器、ORMs、模板语言等,您可以在几十种不同的配置中构建web堆栈。实际上,这正是铁塔和TurboGears所做的,提供了一个可靠的、可预测的堆栈来构建MVC web应用程序。

What Django did differently was they encapsulated everything. Rather than go the components route, they built one contiguous system. They built their own ORM, their own template language, their own middleware system, etc. Their reasoning was that there was no unified system like this for Python.

Django做的不同之处在于它封装了所有东西。他们不走组件路线,而是构建了一个连续的系统。他们构建了自己的ORM、模板语言、中间件系统等等。

#9


1  

Python is not a one-trick pony. Therefore, there's no single "central framework" for it. Many people first heard of Python as "another nice OO language" or through one of the many uses to which it has been put.

Python不是一种独门绝技的小玩意。因此,它没有单一的“中心框架”。许多人第一次听说Python是“另一种很好的OO语言”,或者是通过它的许多用途之一。

To be fair, Ruby is not a one-trick pony either. It's just that many people regarded Rails as the "killer app" that got them to look at a previously-not-well-known language. I suspect many people never heard of Ruby before Rails, but that's by no means the only thing Ruby can do.

说句公道话,鲁比也不是一匹诡计多端的小马。只是很多人认为Rails是一款“杀手级应用”,让他们看到了一种不太知名的语言。我怀疑许多人在Rails之前从未听说过Ruby,但这绝不是Ruby唯一能做的事情。

#10


0  

If you followed the news, you have read that Merb and Rails will merge. This is a good move IMHO. I think it's because of the common goal that the developers have: They want a simple framework for webdev, which comes with a OR mapper, routing, template language, etc which fits for most tasks..

如果您关注新闻,您已经阅读了Merb和Rails将合并的消息。这是一个很好的举动。我认为这是因为开发人员有一个共同的目标:他们想要一个简单的webdev框架,这个框架包含一个或mapper、路由、模板语言等,适合大多数任务。

#11


0  

Check out this article on why we'll never see Python-on-Rails. The author gives some of the basic reasons why Python has never had and will never have a central framework. I might add, myself, that Java doesn't have one either, and for the same reasons.

看看这篇关于为什么我们永远不会看到Python-on-Rails的文章。作者给出了Python从来没有并且永远不会有一个中心框架的一些基本原因。我自己可能会补充一点,Java也没有,而且出于同样的原因。

According to the author, Rails is strictly tied to its "implementation," which is Ruby. Rails was adopted by many developers and Ruby was just part of it. Rails works perfectly on Ruby (or Ruby wanna-bes like Groovy), but more importantly, as many other answers say, Rails led the way to Ruby adoption.

根据作者的说法,Rails与它的“实现”(Ruby)紧密相连。许多开发人员采用了Rails, Ruby只是其中的一部分。Rails在Ruby(或者像Groovy一样的Ruby)上运行得非常好,但更重要的是,正如许多其他答案所言,Rails引领了Ruby的采用。

This is why Rails-for-Python won't work, or at least what people have been focusing on with Rails isn't correct. It's not about the implementation or the quality of the framework, it's about the pattern of adoption. It's about putting the framework up front, and the implementation in the back -- even if this wasn't the Rails developers intentions (though maybe they are clever and this was their intention).

这就是为什么python的Rails不能工作的原因,或者至少人们关注Rails的东西是不正确的。它不是关于实现或框架的质量,而是关于采用的模式。它是关于把框架放在前面,实现放在后面——即使这不是Rails开发人员的意图(尽管他们可能很聪明,这是他们的意图)。

Basically, you can't get a bunch of language-loving folk to gather around a single framework. On the Java side, while Spring is well-loved, it's no Rails in terms of popularity in the Java community. In a mature community developers have their own ideas about what metaphors work and don't work in a framework. This is why Rails leads to Ruby and not the other way around (typically, mostly, not in all cases).

基本上,你不可能让一群热爱语言的人聚集在一个框架周围。在Java方面,虽然Spring很受欢迎,但从Java社区的流行程度来看,它并不是Rails。在一个成熟的社区中,开发人员对在框架中什么隐喻起作用而什么不起作用有自己的看法。这就是为什么Rails会导致Ruby而不是相反的方式(通常,大多数情况下,不是所有情况下)。

#1


35  

As I see it, Rails put Ruby on the map. The simple fact is that before Rails, Ruby was a minor esoteric language, with very little adoption. Ruby owes its success to Rails. As such, Rails has a central place in the Ruby ecosystem. As slim points out, there are other web frameworks, but it's going to be very difficult to overtake Rails as the leader.

在我看来,Rails把Ruby放在了地图上。简单的事实是,在Rails之前,Ruby是一种非常深奥的语言,很少被采用。Ruby将其成功归功于Rails。因此,Rails在Ruby生态系统中有一个中心位置。正如slim所指出的,还有其他的web框架,但是要超越Rails作为领导者将是非常困难的。

Python on the other hand, had a very different adoption curve. Before Rails, Python was much more widely used than Ruby, and so had a number of competing web frameworks, each slowly building their constituencies. Django has done a good job consolidating support, and becoming the leader in the Python web framework world, but it will never be the One True Framework simply because of the way the community developed.

另一方面,Python有一个非常不同的采用曲线。在Rails之前,Python比Ruby使用得更广泛,许多相互竞争的web框架也是如此,每个框架都在缓慢地构建自己的用户群。Django在巩固支持方面做得很好,并且成为Python web框架世界的领导者,但是仅仅因为社区的发展方式,它永远不会成为真正的框架。

#2


7  

I don't think it's right to characterise Rails as 'the' 'single' 'central' Ruby framework.

我认为将Rails定义为“单一的”“中心的”Ruby框架是不对的。

Other frameworks for Ruby include Merb, Camping and Ramaze.

Ruby的其他框架包括Merb、野营和Ramaze。

... which sort of invalidates the question.

…这就使问题失效了。

#3


7  

The real technical answer is that there are three major approaches to web-development in Python: one is CGI-based, where the application is built just like an old one-off Perl application to run through CGI or FastCGI, e.g. Trac; then there is Zope, which is a bizarro overengineered framework with its own DB concept, a strange misguided through-the-web software development concept, etc. (but Plone is still quite popular); and then there is Django (and Turbogears, etc.), which is guided by the same just-the-tools-needed philosophy as Rails (it can be argued who got there first or who did it better). A lot of people would probably agree that the Django/Rails/CakePHP approach is better than the older approaches, but as the older language Python has a lot more legacy frameworks that are still trying to evolve and stay relevant. These frameworks will hang on because there is already developer buy-in for them. For example, in hindsight many people would probably say that Zope (especially ZODB) was a terrible mistake, but Zope 3 is much better than Zope 2, and there are already whole companies built around Zope technologies.

真正的技术解决方案是,在Python中有三种主要的web开发方法:一种是基于cgion的,其中应用程序构建起来就像一个旧的一次性Perl应用程序,可以通过CGI或FastCGI来运行,例如Trac;然后是Zope,它是一个带有它自己的DB概念的奇怪的超工程框架,一个奇怪的被误导的通过web软件开发的概念,等等(但是Plone仍然很受欢迎);然后还有Django(以及Turbogears等),它遵循的是与Rails相同的“只需要工具”的哲学(可以争论谁先到达那里,谁做得更好)。很多人可能会同意Django/Rails/CakePHP方法比旧的方法要好,但是由于旧的语言Python有更多的遗留框架,这些框架仍在努力发展并保持相关性。这些框架将继续存在,因为已经有开发人员购买了它们。例如,事后许多人可能会说Zope(特别是ZODB)是一个可怕的错误,但是Zope 3比Zope 2要好得多,而且已经有很多公司围绕Zope技术建立起来。

#4


5  

Rails was somewhat revolutionary in its extreme "convention over configuration" approach which set it apart from pretty much anything else and made it the "killer app" of Ruby, causing a lot of people to notice Ruby in the first place.

Rails在其极端的“约定优于配置”方法上有些革命性,这种方法将它与几乎所有其他东西区分开来,并使它成为Ruby的“杀手级应用”,使许多人首先注意到Ruby。

So the question is really "Why did David Hansson decide to write Rails in Ruby rather than Python?"

所以真正的问题是“为什么David Hansson决定用Ruby而不是Python来编写Rails ?”

#5


5  

Remember that Ruby had existed for a long time before Rails was created. According to Wikipedia, Ruby was created in the mid-90's; Rails didn't come around until 2004. Ruby is simply the language that David Hansson chose to use for Rails.

记住,Ruby在Rails创建之前已经存在很长一段时间了。根据*,Ruby创建于90年代中期;Rails直到2004年才出现。Ruby是David Hansson为Rails选择的语言。

And yes, I would say Ruby is to Rails as Python is to Django.

是的,我想说Ruby对于Rails就像Python对于Django一样。

#6


5  

I agree with Ned. I'd bet that more than 90% of Ruby installations are for no other purpose than running Rails. Rails dominates Ruby - there is no single application that dominates Python, mainly because the Python community is somewhat bigger than the Ruby community.

我同意内德。我敢打赌超过90%的Ruby安装都是为了运行Rails。Rails主导Ruby——没有一个应用程序主导Python,这主要是因为Python社区比Ruby社区更大。

#7


2  

Would ruby be less popular without Rails? absolutely.

没有Rails ruby会不会不受欢迎?绝对的。

Would Python be more popular with one true framework? You mean as opposed to several? May be, who knows. In any case most agree Django is a very good framework.

Python会在一个真正的框架中更受欢迎吗?你是说相对于几个?也许,谁知道呢。无论如何,大多数人都认为Django是一个非常好的框架。

Why, historically, did it happen to Ruby? Because DHH chose Ruby after doing his own research.

为什么,在历史上,它发生在Ruby上?因为DHH在做了自己的研究之后选择了Ruby。

To add to the answer regarding Rails having made a breakthrough because of 'convention over configuration' there is also another reason and that is that Rails has been using the meta-programming abilities of Ruby superbly. A lot of the magic of Rails which has contributed to removing a lot of the pain of developing web apps came through this clever use of ruby meta-programming.

由于“约定优于配置”,Rails已经取得了突破性的进展,这也有另外一个原因,那就是Rails一直在使用Ruby的元编程能力。Rails的许多神奇之处在于,它消除了开发web应用程序的许多痛苦,这是通过ruby元编程的巧妙使用实现的。

#8


2  

I'd have to agree that Django is basically the "Rails for Python" equivalent. Why did it take so long? The simple answer is too many options.

我不得不承认Django基本上是“Python的Rails”的对等物。为什么花了这么长时间?简单的答案就是选择太多。

In Python, there are many request/response systems, url rewriters, ORMs, templating languages, etc. that you could build a web stack in dozens of different configurations. In fact, this is exactly what Pylons and TurboGears do is provide a reliable, predictable stack to build MVC web apps.

在Python中,有许多请求/响应系统、url重写器、ORMs、模板语言等,您可以在几十种不同的配置中构建web堆栈。实际上,这正是铁塔和TurboGears所做的,提供了一个可靠的、可预测的堆栈来构建MVC web应用程序。

What Django did differently was they encapsulated everything. Rather than go the components route, they built one contiguous system. They built their own ORM, their own template language, their own middleware system, etc. Their reasoning was that there was no unified system like this for Python.

Django做的不同之处在于它封装了所有东西。他们不走组件路线,而是构建了一个连续的系统。他们构建了自己的ORM、模板语言、中间件系统等等。

#9


1  

Python is not a one-trick pony. Therefore, there's no single "central framework" for it. Many people first heard of Python as "another nice OO language" or through one of the many uses to which it has been put.

Python不是一种独门绝技的小玩意。因此,它没有单一的“中心框架”。许多人第一次听说Python是“另一种很好的OO语言”,或者是通过它的许多用途之一。

To be fair, Ruby is not a one-trick pony either. It's just that many people regarded Rails as the "killer app" that got them to look at a previously-not-well-known language. I suspect many people never heard of Ruby before Rails, but that's by no means the only thing Ruby can do.

说句公道话,鲁比也不是一匹诡计多端的小马。只是很多人认为Rails是一款“杀手级应用”,让他们看到了一种不太知名的语言。我怀疑许多人在Rails之前从未听说过Ruby,但这绝不是Ruby唯一能做的事情。

#10


0  

If you followed the news, you have read that Merb and Rails will merge. This is a good move IMHO. I think it's because of the common goal that the developers have: They want a simple framework for webdev, which comes with a OR mapper, routing, template language, etc which fits for most tasks..

如果您关注新闻,您已经阅读了Merb和Rails将合并的消息。这是一个很好的举动。我认为这是因为开发人员有一个共同的目标:他们想要一个简单的webdev框架,这个框架包含一个或mapper、路由、模板语言等,适合大多数任务。

#11


0  

Check out this article on why we'll never see Python-on-Rails. The author gives some of the basic reasons why Python has never had and will never have a central framework. I might add, myself, that Java doesn't have one either, and for the same reasons.

看看这篇关于为什么我们永远不会看到Python-on-Rails的文章。作者给出了Python从来没有并且永远不会有一个中心框架的一些基本原因。我自己可能会补充一点,Java也没有,而且出于同样的原因。

According to the author, Rails is strictly tied to its "implementation," which is Ruby. Rails was adopted by many developers and Ruby was just part of it. Rails works perfectly on Ruby (or Ruby wanna-bes like Groovy), but more importantly, as many other answers say, Rails led the way to Ruby adoption.

根据作者的说法,Rails与它的“实现”(Ruby)紧密相连。许多开发人员采用了Rails, Ruby只是其中的一部分。Rails在Ruby(或者像Groovy一样的Ruby)上运行得非常好,但更重要的是,正如许多其他答案所言,Rails引领了Ruby的采用。

This is why Rails-for-Python won't work, or at least what people have been focusing on with Rails isn't correct. It's not about the implementation or the quality of the framework, it's about the pattern of adoption. It's about putting the framework up front, and the implementation in the back -- even if this wasn't the Rails developers intentions (though maybe they are clever and this was their intention).

这就是为什么python的Rails不能工作的原因,或者至少人们关注Rails的东西是不正确的。它不是关于实现或框架的质量,而是关于采用的模式。它是关于把框架放在前面,实现放在后面——即使这不是Rails开发人员的意图(尽管他们可能很聪明,这是他们的意图)。

Basically, you can't get a bunch of language-loving folk to gather around a single framework. On the Java side, while Spring is well-loved, it's no Rails in terms of popularity in the Java community. In a mature community developers have their own ideas about what metaphors work and don't work in a framework. This is why Rails leads to Ruby and not the other way around (typically, mostly, not in all cases).

基本上,你不可能让一群热爱语言的人聚集在一个框架周围。在Java方面,虽然Spring很受欢迎,但从Java社区的流行程度来看,它并不是Rails。在一个成熟的社区中,开发人员对在框架中什么隐喻起作用而什么不起作用有自己的看法。这就是为什么Rails会导致Ruby而不是相反的方式(通常,大多数情况下,不是所有情况下)。