The one about learning Ruby

I started working with Ruby in early 2010, on projects developed with Ruby on Rails. My mentor was influential enough to convince our bosses that this programming language and this framework were the best choice for future projects. We usually worked with CakePHP, so understanding how Rails works with the MVC pattern was really a piece of cake. Got it? Never mind...

15 years later, I work at SNGULAR, which is a consulting firm that mostly works with Java and its ecosystem in the backend of their software development projects. They also have projects with popular languages such as PHP or Node.js, among others. Focusing exclusively on what they call the Backend chapter, each of these technologies has an internal learning path defined. This is not the case with Ruby, since they do not have many projects where this is the main programming language.

When I started working at this company I was already assigned to a project, but as I already had booked my vacations, my start at the American fintech was delayed for a few weeks until I was back.

I had several weeks ahead of me before leaving, so in addition to completing my onboarding, my boss proposed to do a Ruby training to some colleagues who did not have a project assigned at the time. All of them were experienced developers who were used to work mainly with Java or PHP, but had no previous experience with Ruby. I accepted without hesitation.

You will find below the guide I shared with the company to learn Ruby, to which I have been adding some stuff that I consider interesting during the last months.

Ruby Training

Recommendations

The most important recommendation is always learn Ruby first and then learn the framework of your choice if needed, usually the most popular. This is applicable to any ecosystem. That way, when you work on a gem, a script or anything else where you do not have available any of the libraries provided by the framework, you will be able to work with Ruby pretty easily.

Even if you already have experience with this language, I recommend you to access this quiz and you will probably understand what I mean.

Another recommendation that I consider important is that you look at the version of Ruby used in the articles and documentation that you find, because some things might be outdated. On the official website you will always find news about the latest versions released.

Documentation

References in the community

Not an exhaustive list and in no particular order:

Key concepts

Going beyond the most basic concepts present in every programming language we can find the following concepts:

  • Global Interpreter Lock (GIL):
    • Concurrency vs parallelism
    • Threads vs Fibers vs Ractors
  • YJIT:
    • Ruby is an interpreted language
    • The JIT allows to dynamically compile Ruby code into machine code at runtime without interpretation
    • Improve performance and memory usage
  • Types:
    • Duck typing vs is_a?/kind_of? vs instance_of?
    • There are no interfaces
    • Type checkers:
      • Not very extended in the Ruby community
      • Sorbet
      • RBS
  • Debugging:
    • <object>.methods.sort: what methods an object respond to.
    • <object>.method(:<method_name>).source_location: where is defined a certain method.
    • <object>.method(:<method_name>).super_method.source_location: where is defined certain method with the same name in one of the ancestors.
  • Metaprogramming:
  • Exceptions:
  • Pattern matching
  • Shorthand hash syntax
  • Safe navigation operator (&)
  • Strings (to_s) vs symbols (to_sym):
  • Classes vs modules
  • Lambdas vs procs vs blocks
  • Memoization:
  • Logical operators:
    • and vs &&
    • or vs ||
    • not vs !
  • Namespaces
  • Inheritance
  • Constants lookup
  • super
  • self
  • Attribute macros:
    • attr_reader vs attr_writer vs attr_accessor
  • Variables:
    • local vs global vs instance variables vs class instance variables vs class variables
  • Methods visibility:
    • public vs protected vs private
  • Regular expressions:
  • Documentation:

Frameworks

Testing

Interpreters

Installation

  • In a real project, whenever possible, it is recommended to use Docker containers.
  • Version managers:
    • RVM
      • .ruby-version (include in the version control)
      • .ruby-gemset (do not include in the version control: Add to .gitignore)
    • asdf
    • rbenv
    • chruby
  • GoRails setup

Editors and IDEs

You will find plugins for Ruby in any editor/IDE.

Linters

Style guides

Playgrounds

Courses

The company provide us with access to the courses catalog available on Udemy.

Some interesting courses to start learning Ruby and Rails:

Not yet available for us, but hopefully will be soon:

Other courses:

Videos

Books

Newsletters

Exercises and katas

Interesting websites and articles

  • RubyGems: Find, install, and publish Ruby gems
  • Awesome Ruby: A collection of awesome Ruby gems, tools, frameworks and software
  • The Ruby Toolbox: Find actively maintained & popular open source software libraries for the Ruby programming language

Some gems are available for any Ruby project and others are only available for Rails:

Community

Last but not least, get involved in the community the way you prefer. Follow people in social networks, read as much as you can about the language, its frameworks and tools, and even collaborate in open source projects if you feel like it.

In your city probably there is a Ruby group that gathers from time to time, usually monthly, to talk about the language and related stuff. For instance, in Madrid, where I am currently living, we have Madrid.rb.


That training for me was an enriching experience that took about 4 weeks. My colleagues approached the training as a challenge and at all times I felt that they were really interested in learning the language and its ecosystem, and that they wanted to put into practice what they were learning.

My boss told me that they were very happy with the training and I can confirm the guide I created will be used for future trainings at SNGULAR.

I would also like to take this opportunity to thank my mentor, Eddy Josafat, for coming up with the brilliant idea of using this language in which he saw a promising future. He was not wrong.

By the way, this is a list that I will keep updating over time. Is there anything you miss in this list? If so, leave it in the comments, please.

Thank you for reading and see you in the next one!

0
Subscribe to my newsletter

Read articles from David Montesdeoca directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

David Montesdeoca
David Montesdeoca

I love learning new stuff, especially when it comes to building software. I'm really interested in software architecture, clean code, testing and best practices.