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

发布于 2024-07-10 20:45:17 字数 648 浏览 6 评论 0原文

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

这篇文章来自2005 谈论了 Python 缺乏单一的中央框架。 对于Ruby来说,这个框架显然就是Rails。 从历史上看,为什么这种情况发生在 Ruby 上而不是 Python 上?(或者它发生了,而那个框架是 Django?)

另外,假设的问题:如果它有一个好的框架吗? 如果 Ruby 没有中心框架,它会变得不那么受欢迎吗?

[请避免讨论 Ruby 或 Python 哪个更好,这个问题太开放,无法回答。]

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

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

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?)

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?

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

桃气十足 2024-07-17 20:45:17

在我看来,Rails 让 Ruby 名声大噪。 一个简单的事实是,在 Rails 之前,Ruby 是一种不太深奥的语言,很少有人采用。 Ruby 的成功归功于 Rails。 因此,Rails 在 Ruby 生态系统中占有中心地位。 正如 slim 指出的那样,还有其他 Web 框架,但要超越 Rails 成为领导者将非常困难。

另一方面,Python 的采用曲线则截然不同。 在 Rails 之前,Python 的使用比 Ruby 广泛得多,因此出现了许多相互竞争的 Web 框架,每个框架都在慢慢地建立自己的支持者。 Django 在巩固支持方面做得很好,并成为 Python Web 框架世界的领导者,但仅仅因为社区的发展方式,它永远不会成为一个真正的框架。

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.

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.

娇柔作态 2024-07-17 20:45:17

我认为将 Rails 描述为“单一”“中央”Ruby 框架是不正确的。

其他 Ruby 框架包括 Merb、Camping 和 Ramaze。

...这使得这个问题无效。

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

Other frameworks for Ruby include Merb, Camping and Ramaze.

... which sort of invalidates the question.

墨落画卷 2024-07-17 20:45:17

真正的技术答案是,Python 中的 Web 开发有三种主要方法:一种是基于 CGI 的,其中应用程序的构建就像旧的一次性 Perl 应用程序一样通过 CGI 或 FastCGI 运行,例如 Trac; 然后是 Zope,这是一个奇怪的过度设计框架,有自己的数据库概念,是一个奇怪的误导网络软件开发理念等(不过Plone还是相当流行的); 然后是 Django(以及 Turbogears 等),它由相同的 just-the-tools 指导 -需要像 Rails 一样的哲学(可以争论谁先到达那里或者谁做得更好)。 很多人可能会同意 Django/Rails/CakePHP 方法比旧方法更好,但随着旧方法Python 语言还有很多遗留框架仍在努力发展并保持相关性。 这些框架将继续存在,因为开发人员已经接受了它们。 例如,事后看来,许多人可能会说 Zope(尤其是 ZODB)是一个可怕的错误,但 Zope 3 比 Zope 2 好得多,并且已经有整个公司围绕 Zope 技术构建。

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.

心的憧憬 2024-07-17 20:45:17

Rails 的极端“约定优于配置”方法具有一定的革命性,这使其区别于其他任何东西,并使其成为 Ruby 的“杀手级应用程序”,导致很多人首先注意到 Ruby。

所以问题实际上是“为什么 David Hansson 决定用 Ruby 而不是 Python 编写 Rails?”

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.

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

倾其所爱 2024-07-17 20:45:17

请记住,在 Rails 创建之前,Ruby 已经存在很长时间了。 根据维基百科,Ruby 诞生于 20 世纪 90 年代中期; Rails 直到 2004 年才出现。Ruby 只是 David Hansson 选择用于 Rails 的语言。

是的,我想说 Ruby 之于 Rails 就像 Python 之于 Django

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.

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

oО清风挽发oО 2024-07-17 20:45:17

我同意内德的观点。 我敢打赌,90% 以上的 Ruby 安装只是为了运行 Rails。 Rails 主导 Ruby - 没有任何一个应用程序主导 Python,主要是因为 Python 社区比 Ruby 社区大一些。

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.

享受孤独 2024-07-17 20:45:17

如果没有 Rails,Ruby 会不会那么受欢迎? 绝对地。

如果有一个真正的框架,Python 会更受欢迎吗? 你的意思是而不是几个? 也许是,谁知道呢。 无论如何,大多数人都同意 Django 是一个非常好的框架。

从历史上看,为什么这种情况会发生在 Ruby 身上? 因为DHH在做了自己的研究后选择了Ruby。

要补充关于 Rails 因“约定优于配置”而取得突破的答案,还有另一个原因,那就是 Rails 一直出色地使用 Ruby 的元编程能力。 Rails 的许多魔力都通过巧妙地使用 ruby​​ 元编程来消除开发 Web 应用程序的许多痛苦。

Would ruby be less popular without Rails? absolutely.

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.

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

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.

走走停停 2024-07-17 20:45:17

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

在 Python 中,有许多请求/响应系统、url 重写器、ORM、模板语言等,您可以用数十种不同的配置构建 Web 堆栈。 事实上,这正是 Pylons 和 TurboGears 所做的,即提供可靠、可预测的堆栈来构建 MVC Web 应用程序。

Django 的不同之处在于它们封装了一切。 他们没有走组件路线,而是构建了一个连续的系统。 他们构建了自己的 ORM、自己的模板语言、自己的中间件系统等。他们的理由是 Python 没有这样的统一系统。

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.

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.

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.

猫卆 2024-07-17 20:45:17

Python 不是只会一招的小马。 因此,没有单一的“中心框架”。 许多人第一次听说Python是“另一种不错的面向对象语言”,或者是通过它的众多用途之一听说的。

公平地说,Ruby 也不是只会一招的小马。 只是很多人将 Rails 视为“杀手级应用”,让他们开始关注一门以前并不为人所知的语言。 我怀疑很多人在 Rails 之前从未听说过 Ruby,但这绝不是 Ruby 唯一能做的事情。

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.

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.

檐上三寸雪 2024-07-17 20:45:17

如果您关注新闻,您就会了解到 Merb 和 Rails 将合并。 恕我直言,这是一个好举动。 我认为这是因为开发人员有一个共同的目标:他们想要一个简单的 webdev 框架,它带有 OR 映射器、路由、模板语言等,适合大多数任务。

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..

没︽人懂的悲伤 2024-07-17 20:45:17

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

根据作者的说法,Rails 与其“实现”(即 Ruby)严格相关。 Rails 被许多开发人员采用,Ruby 只是其中的一部分。 Rails 在 Ruby(或者像 Groovy 这样的 Ruby 崇拜者)上完美运行,但更重要的是,正如许多其他答案所说,Rails 引领了 Ruby 的采用。

这就是为什么 Rails-for-Python 不会
工作,或者至少是人们所拥有的
一直专注于 Rails 不是
正确的。 这不是关于
实施或质量
框架,它是关于模式
采用。 这是关于把
前面的框架,以及
后面的实现——即使
这不是 Rails 开发人员
意图(尽管也许它们是
聪明,这就是他们的意图)。

基本上,你无法让一群热爱语言的人聚集在一个框架周围。 在 Java 方面,虽然 Spring 深受喜爱,但就 Java 社区的受欢迎程度而言,它不及 Rails。 在成熟的社区中,开发人员对于框架中哪些隐喻有效、哪些无效有自己的想法。 就是为什么 Rails 会导致 Ruby,而不是相反(通常,大多数情况下,并非在所有情况下)。

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.

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.

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).

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文