学习 Ruby 作为脚本语言需要多长时间?

发布于 2024-10-03 14:57:49 字数 187 浏览 4 评论 0原文

我需要为我的工作自动化软件测试,我目前使用 groovy 来做到这一点。不过,我正在考虑将 Ruby 添加到我的技能中。主要是因为我可以预见自己将来会从事 Rails 项目。

您认为需要多长时间才能相对熟练地使用 Ruby 编写脚本?我主要谈论的是使用 webdriver/webrat 在 DOM 中导航,并以编程方式进行文本/文件更改工作。

I am required to automate software tests for my job and I currently use groovy to do this. However, I am thinking about adding Ruby to my repertoire. Mainly because I can see myself working on a rails project in the future.

How long do you think it would take to become relatively proficient at scripting with Ruby? I am talking mainly navigating around a DOM with webdriver/webrat and programatically doing text/file changing work.

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

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

发布评论

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

评论(7

人疚 2024-10-10 14:57:49

一个周末的高度奉献。

说真的,这取决于你有多少时间以及你以前的经验。如果您曾涉足 Perl 或 Python,那么您可能会比之前只使用过 Java 更容易掌握 Ruby。

One weekend of intense dedication.

Seriously, it's a matter of how much time you have got on your hands and what's your previous experience. If you've dabbled in Perl or Python, you'll probably have an easier time picking up Ruby than if you had just used Java before.

风轻花落早 2024-10-10 14:57:49

取决于您对其他编程语言有多少经验。您应该能够在一个下午的时间里学习基本的 ruby​​ 语法。然后学习测试库可能还需要几天的时间来使用它们。您当然不会成为 Ruby 专家,但您应该能够很快地编写一些测试脚本。

你可以从这里开始 -
二十分钟掌握 Ruby

那么也许可以去这里 -
17 个涵盖基本 Ruby 技术的视频

Depends on how much experience you have with other programming languages. You should be able to learn the basic ruby syntax in an afternoon. And then work on learning the testing libraries might take another couple of days of playing around with them. You certainly wont be a ruby expert but you should be able to hack together some test scripts pretty quickly.

You could start here -
Ruby in Twenty Minutes

Then maybe go here -
17 Videos Covering Basic Ruby Techiques

带上头具痛哭 2024-10-10 14:57:49

如果你有编程经验,我想说,花 2 周的时间专注于 ruby​​ 就能完成 99% 的任务……Ruby 与其他脚本语言的主要区别在于它对迭代器的内在使用(你几乎从不编写迭代器代码)或 while 循环)和相关的代码块。一旦你熟悉了这些,其余的事情就会水到渠成。

If you have programming experience I would say 2 weeks of intense focus on ruby will get you 99% of way....the major features of ruby that distinguish it from other scripting languages are its intrinsic use of iterators (you almost never code for or while loops) and associated code blocks. Once you become familar with these the rest of it falls into place.

别念他 2024-10-10 14:57:49

一分钟学习……一生掌握。

A minute to learn ... a lifetime to master.

高跟鞋的旋律 2024-10-10 14:57:49

由于之前没有任何技术经验,我同时开始学习 ruby​​、html、css 等,我花了 2 年时间才能够掌握一些东西并知道实际发生了什么。当然,Rails 使这一切变得更快,如果您已经了解其他编程语言,您可以在 6 个月内掌握基础知识并发挥作用。

With no previous technical experience I started learning ruby, html, css etc at the same time and it took me 2 years before I could get something up and know what was actually going on. Rails of course makes all of this faster and if you already know other programming languages you could tackle the basics and be functional in 6 months.

若能看破又如何 2024-10-10 14:57:49

Ruby 有 Nokogiri,它是一个优秀的 HTML/XML 解析器。它支持 CSS 和 XPath 访问器,使得在解析的 HTML 文件的 DOM 中导航变得非常容易。

Mechanize 构建在 Nokogiri 之上,它基于 Perl 的 WWW::Mechanize。它可以轻松浏览网站页面、提取字段、填写表单并提交、跟踪 cookie 和会话等。由于 Mechanize 构建在 Nokogiri 之上,因此您可以获取底层 DOM 并使用相同的 CSS 和XPath 访问器。

Ruby 有几种不同的测试环境。 Test::Unit 附带 Ruby,并且易于使用。还有 Autotest、RSpec、Shoulda 和 Cucumber 等。自动测试很好,因为它会在您修改文件时监视您的目录并运行测试,因此您可以立即意识到是否破坏了某些内容。

我是从 Perl 和 Java 背景开始接触 Ruby 的,之前是 C/C++。对我来说,Ruby 就像 Java 和 Perl 的子版本,因为它与这两种语言都有一些相似之处,但同时,Ruby 很好地回避了这两种语言所烦恼的事情。 Ruby 几乎就像是其他两者的逻辑增长或下一代。我认为这在一定程度上是事后诸葛亮的好处,也是 Matz 想让 Ruby 成为程序员而不是机器的语言的意图。

我尝试同时学习 Rails 和 Ruby,但在 Rails 从 v1 变为 v2 时发现了它。所有的书籍都已经过时且错误,大多数网站都是错误的,找到好的信息很困难。最终我意识到文档中存在混乱,因此我放弃了 Rails 六个月,转而专注于 Ruby,每天在工作中使用它。我开始几乎完全使用它,因为我能够用它比用 Perl 更简洁地表达想法。我可以用 Perl 写得更简洁,但可读性较差,这对我来说很重要,因为这有助于使代码可维护。

几年后的现在,我更喜欢 Ruby,而不是我曾经使用过的任何语言。我仍然使用 Perl 进行编程,但在工作中推广 Ruby,并在需要编写涉及数据库的内容时使用它,因为 Sequel,或者使用 RailsSinatraPadrino,与HAML

Ruby has Nokogiri, which is an excellent HTML/XML parser. It supports both CSS and XPath accessors, making it very easy to navigate through a parsed HTML file's DOM.

Building on top of Nokogiri is Mechanize, which was based on Perl's WWW::Mechanize. It makes it easy to navigate through a website's pages, extracting fields, filling out forms and submitting them, tracking cookies and sessions, etc. Because Mechanize is built on top of Nokogiri, you can get at the underlying DOM and use the same CSS and XPath accessors.

Ruby has several different testing environments. Test::Unit comes with Ruby and is easy to use. There's also Autotest, RSpec, Shoulda and Cucumber to name a couple others. Autotest is nice because it will watch your directory and run tests as you modify the files, so you're instantly aware if you break something.

I came to Ruby from a Perl and Java background, with C/C++ before those. To me, Ruby is like a child of Java and Perl because it has some similarities to both, but at the same time the things that were annoying with both those languages are nicely sidestepped on Ruby. It's almost as if Ruby was the logical growth, or next generation, of the other two. I think that's partly the benefit of hindsight, and of Matz' intention to make Ruby be a language for programmers, not machines.

I tried learning Rails in parallel with Ruby, but caught Rails as it changed from v1 to v2. All the books were out of date and wrong, most websites were wrong, and finding good information was tough. Eventually I realized the confusion was in the documentation and backed away from Rails for six months and concentrated on Ruby, using it daily at work. I began using it almost exclusively because I was able to more succinctly express ideas in it than I could in Perl. I could write more tersely in Perl, but it wasn't as readable, which is important to me because that helps make code maintainable.

Now, a few years later, I prefer Ruby over any language I've ever used. I still program in Perl but evangelize Ruby at work, and use it any time I need to write something that touches a database, because of Sequel, or to write web front ends to the databases using Rails, Sinatra or Padrino, combined with HAML.

风筝在阴天搁浅。 2024-10-10 14:57:49

取决于,您是否使用任何其他脚本语言?对于某些人来说,Ruby 非常简单。我发现记住大多数常用方法名称很容易。如果您已经在一定程度上使用过其他语言,那么深度享受该语言应该不会超过一周。如果这是您第一次编程,您需要牢牢掌握面向对象编程才能真正欣赏它。

Depends, are you using any other scripting languages? Ruby is pretty straight-forward to some people. I found it easy to remember most of the common method names. If you've worked with other languages to any decent extent then it shouldn't be more than a week to be deeply enjoying the language. If it's your first time programming, you need to get a good solid grip on Object Oriented Programming to truly appreciate it.

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