简体   繁体   English

我为什么要使用Ruby on Rails?

[英]Why should I use Ruby on Rails?

A friend of mine asked me if I was aware of Ruby on Rails ... and frankly I have heard a lot about it but know practically nothing about it. 我的一个朋友问我是否知道Ruby on Rails ......坦率地说,我已经听过很多关于它的信息,但几乎一无所知。 Any help will be much appreciated. 任何帮助都感激不尽。

Ruby on Rails is a framework for building web applications. Ruby on Rails是一个用于构建Web应用程序的框架。 If favors convention over configuration which means that a lot of choices have sensible defaults and thus you can get something running with very little effort. 如果赞成约定优于配置,这意味着很多选择都有合理的默认值,因此你可以用很少的努力来运行。

More info here: http://rubyonrails.org/ 更多信息: http//rubyonrails.org/

In addition to the default script/generators (which make scaffolds, models, controllers, etc for you), Ruby on Rails has a lot of convenient plugins that can handle the majority of the work for you, as well as a plethora of tools for tracking down bugs, errors, and bottlenecks in your code. 除了默认的脚本/生成器(为您创建脚手架,模型,控制器等)之外,Ruby on Rails还有许多方便的插件可以为您处理大部分工作,还有很多工具可供您使用。跟踪代码中的错误,错误和瓶颈。 I've outlined some examples below. 我在下面列举了一些例子。

Convenient Plugins 方便的插件

  • Subdomain-fu allows you to set up and use subdomains in literally minutes Subdomain-fu允许您在几分钟内设置和使用子域
  • Active Scaffold sets up beautiful default "admin" pages that interface with the database Active Scaffold设置与数据库连接的漂亮的默认“admin”页面
  • RestfulAuth is a basic, easy to use authentication system RestfulAuth是一个基本的,易于使用的身份验证系统

Code Testing 代码测试

  • RSpec lets you write clear, meaningful tests, and colour-codes the output RSpec允许您编写清晰,有意义的测试,并对输出进行颜色编码
  • Cucumber lets you write even clearer tests 黄瓜可以让你写出更清晰的测试
  • Metric-fu tests your code duplication, complexity, and more Metric-fu测试您的代码重复,复杂性等

There's also a lot of video tutorials for Ruby on Rails ( Railscasts ). Ruby on Rails( Railscasts )还有很多视频教程。

Why use it? 为什么要用它? Just to try something new. 只是尝试一些新的东西。 Ruby has changed many way I've programmed before and now it's my favourite language. Ruby已经改变了我以前编程的方式,现在它是我最喜欢的语言。 Rails have combined all good practices and shown people now friendly framework may be. Rails已经结合了所有良好的实践,并向人们展示了现在友好的框架。

Spending two weeks for studying Ruby + RoR is worth it, really. 花两个星期学习Ruby + RoR是值得的,真的。

I recently wrote a blog post about this and it covers some of the pros and cons of using rails for building web applications (disclaimer: I run a rails consultancy, but I tried to be as impartial as possible): 我最近写了一篇关于此的博客文章,它涵盖了使用rails构建Web应用程序的一些优缺点(免责声明:我运行rails咨询,但我试图尽可能公正):

http://blog.bitzesty.com/what-is-ruby-on-rails-and-why-should-i-use-it http://blog.bitzesty.com/what-is-ruby-on-rails-and-why-should-i-use-it

Why use it? 为什么要用它? Because you want to develop dynamic database-oriented web applications. 因为您要开发面向动态数据库的Web应用程序。

If you want to develop something else, Rails can become really annoying, although some of the components that ship with it (ActiveRecord, for example) can be useful on their own. 如果你想开发其他东西,Rails会变得非常烦人,虽然它附带的一些组件(例如ActiveRecord)可以自己使用。

If the question was really supposed to be "Why use Rails over some other web app framework?" 如果问题真的应该是“为什么使用Rails而不是其他一些Web应用程序框架?” then there's plenty to read already on SO: 那么有很多东西可以在SO上阅读:

for example... 例如...

FWIW - An interesting perspective can be gained by looking at where Ruby ranks relative to other common languages in terms of popularity (a subject measure at best): TIOBE Programming Community Index . FWIW - 通过查看Ruby在流行度(最佳主题指标)方面相对于其他常见语言的排名,可以获得一个有趣的视角: TIOBE编程社区索引 I wouldn't read too much into this, but it does provide some perspective. 我不会对此有太多的了解,但确实提供了一些观点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM