我应该具备哪些 Ruby 知识? [英] what Ruby knowledge should I have?

查看:49
本文介绍了我应该具备哪些 Ruby 知识?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现了我应该拥有哪些 c# 知识? 问题和想知道同样的,但对于 Ruby.我认为 Ruby 是我最喜欢的编程语言,除了学习基础知识,至少我从许多 Ruby on Rails 项目和一些 Ruby 脚本中学到的东西之外,我还尝试通过阅读诸如 暴食O'Reilly RubyOla Bini打磨 Ruby.我还读过诸如 The Ruby Way.

I just discovered the what c# knowledge should I have? question and wondered about the same, but for Ruby. I consider Ruby to be my favorite programming language, and beyond learning the basics, at least what I've picked up from numerous Ruby on Rails projects and a few Ruby scripts, I've tried to learn from reading blogs like Gluttonous, O'Reilly Ruby, Ola Bini, and Polishing Ruby. I've also read in books like The Ruby Way.

但是,在接受有关我的 Ruby 技能的面试时,我还没有做好充分的准备.有人问我是否知道闭包,起初我回答说我不知道​​,但后来我问面试官是否指的是代码块,比如 lambda 和 do...end,他做到了.我是如何进行 3 年的 Ruby 编程并尝试学习这门语言而不学习闭包 = 代码块的?

However, I haven't felt fully prepared when being interviewed about my Ruby skills. I was asked once if I knew about closures and at first I responded that I didn't, but then I asked if the interviewer meant code blocks, like lambda and do...end, and he did. How did I go about 3 years of programming Ruby and trying to learn the language without learning that closures = code blocks?

那么,我想问您一个 Ruby 程序员应该具备哪些 Ruby 语言知识?作为 Ruby 职位的面试官,您希望我知道什么?只需列出一些主题,我就会阅读有关它们的内容.如果您认为有必要,列出 Ruby 特定的工具(如 Ruby on Rails、Rake、Rack 等)也很好.

So, my question to you is what knowledge should a Ruby programmer have of the Ruby language? What would you expect, as an interviewer for a Ruby position, me to know? Just list some topics, and I'll do the reading about them. Listing Ruby-specific tools like Ruby on Rails, Rake, Rack, etc. is good too, if you think that's necessary.

推荐答案

这有点出乎我的意料;我确定我错过了很多.除了这里提到的东西,当然,理解编程和面向对象编程是必须的.

This is sort of from the top of my head; I'm sure I am missing a lot. Besides the things mentioned here, understanding programming and object-oriented programming in particular is a must, of course.

一些重要的语言特性:

  • 意识到在 Ruby 中,一切都是表达式,并且能够应用该原则,即使您认为它会使您的代码不可读.
  • 闭包被提及;我还希望 Rubyists 知道块和过程(和 lambdas)之间的区别,并知道如何在它们之间进行转换.在我看来,精通闭包对于编写漂亮的 Ruby 很重要.
  • 运算符重载:知道定义名为 [][]=== 的方法时会发生什么>、+<< 等.
  • 精通ArrayEnumerableHash的大多数实例方法(即使你不知道确切的定义).如果您不使用诸如 collectinjectjoinzip等在适当的地方.
  • 彻底了解什么是符号,以及何时应该使用/避免使用它们.
  • 了解什么是元类,了解类变量类实例变量的区别.
  • 了解对象属性如何在 Ruby 中工作,如何使用 attr_accessor 和朋友定义它们,以及如何自己定义它们.
  • 能够将模块用作混入命名空间工具.您还应该了解如何混合使用实例方法类方法(或者能够弄清楚如何做到这一点).
  • 了解raise/rescuethrow/catch 之间的区别,并能够正确使用两者.
  • 了解元编程的工作原理,至少对允许您进行元编程的所有方法有基本的了解(主要隐藏在Module类中)对象).
  • 能够使用 Hash 方法参数代替命名参数(即使只是因为它是一种常见模式).
  • 了解并发在 Ruby 中的作用和作用.
  • 延续,即使它们很少使用.
  • Realise that in Ruby, everything is an expression, and be able to apply that principle, even if you think it makes your code unreadable.
  • Closures are mentioned; I would also expect Rubyists to know the differences between blocks and procs (and lambdas) and know how to convert between them. Closure mastery is important to being able to write beautiful Ruby, in my opinion.
  • Operator overloading: know what happens when you define methods named [], []=, ==, +, <<, etc. on an object.
  • Be proficient with most instance methods of Array, Enumerable and Hash (even if you don't know the exact definition by heart). Your Ruby code will be so much more verbose if you don't use methods like collect, inject, join, zip, etc. where appropriate.
  • Thoroughly understand what Symbols are, and when you should use / avoid them.
  • Understand what metaclasses are, know the difference between class variables and class instance variables.
  • Know how object attributes work in Ruby, how you can define them with attr_accessor and friends, and how you can define them yourself.
  • Be able to use modules, both as mix-ins and as namespacing tool. You should also understand how to mix-in instance methods and class methods (or be able to figure out how you could do it).
  • Know the difference between raise/rescue and throw/catch, and be able to use both correctly.
  • Understand how metaprogramming works, and at least have a basic idea of all the methods that allow you to do metaprogramming (mostly hidden in the classes Module and Object).
  • Be able to use a Hash method argument as a substitute for named arguments (even if it's just because it's a common pattern).
  • Know how concurrency does and doesn't work in Ruby.
  • Continuations, even if they're rarely used.

一些重要的工具:

  • 了解并理解Ruby gems
  • RDoc.
  • YAML.

一些框架知识:

  • Rails 的基本知识会很有用.即使只是因为外界有时似乎不知道 Rails 和 Ruby 之间的区别.
  • 知道除了 Rails 之外还有其他网络框架:Merb、Sinatra、Camping ......
  • Basic knowledge of Rails would be useful. Even if it's only because the outside world sometimes doesn't seem to know the difference between Rails and Ruby.
  • Know there are other web frameworks than Rails: Merb, Sinatra, Camping, ...

最后,请记住,以上内容只是知识",而不是技能.如果您不熟悉它,可能很容易掌握其中的大部分内容.

这篇关于我应该具备哪些 Ruby 知识?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆