简体   繁体   中英

In Ruby/Rails, what is “Rails”?

So I am leaving a job that is solely Java stack, and moving to one that doesn't outwardly admit it, but they are absolutely Ruby/Rails crazy.

I understand Ruby fine, but "Rails" doesn't seem to be much more than an MVC framework which the Ruby language is placed upon.

I'm sure there are plenty of people rolling over right now wondering how I could be so naive, but seriously... please help me understand what Ruby is w/o Rails.

Willing to take any readings or books suggested! Sorry, I'm new to the game! Thanks!

Here is a books list

Also Ryan Bates maintained an awesome screencats collection

Official RoR guide

I hope that helps.

Ruby is a language, much more closely related to Perl or Python than to a C-based language like Java. Ruby is very approachable as a language, and there's even an interactive console that you can use to quickly experiment with. Ruby itself is interpreted, so you have a lot of dynamic capabilities at your disposal. It's really a good language that you can pick up quickly.

As you say, Rails is a MVC framework that includes an ORM (ActiveRecord), a view template engine (ERB), and a variety of extensions to the standard Ruby library. Most Rails applications are websites, but you can use Rails for other purposes, such as an API-based headless server or a mobile application server - these are often combined together to make full-stack applications.

I typically recommend 2 books to programmers looking to make the switch:

  • Programming Ruby by Dave Thomas, Chad Fowler, and Andy Hunt
  • Agile Web Development by Sam Ruby, Dave Thomas, and David Heinemeier Hansson

"Programming Ruby" covers the language constructs and use of standard tools with decent examples in the first half of the book, followed by a standard library reference in the second half. It's well written, and loved by millions as 'The Pickaxe Book'. Make sure to get the Ruby 1.9 & 2.0 book, as this covers the most recent Ruby versions and features.

"Agile Web Development" covers the introduction to Rails by developing projects and explaining the problems and decisions made along the way. I've found this to be very helpful as an introductory book for programmers looking to make the switch from another language/framework.

I think it's important to note that Rails is not just like any other web framework in another language.

Rails is unique in that it is a "Domain Specific Language" that uses the metaprogramming features of Ruby, its host language, to modify that language substantially. There are many methods added to standard Ruby classes such as Hash and numeric classes.

Also, there are several implementations of the Ruby language, the two best ones being "MRI" Ruby (1) and JRuby (2).

(1) MRI = Matz Ruby Implementation; Matz is the nickname for Yukihiro Matsumoto, the primary author of the Ruby language. This implementation uses C language for low level operations and is sometimes called "C Ruby".

(2) JRuby - Ruby implemented in Java and running on the Java Virtual Machine, enabling interacting with code in Java and other JVM languages, and enabling use of all available CPU's for threads, unlike MRI Ruby which is limited to 1.

Along with the resources listed above, here is another tutorial/book that is free which is a staple in learning Ruby on Rails: https://www.railstutorial.org/book

It starts with many beginner concepts to more advanced concepts. It's super easy to understand.

It also teaches using Test Driven Development, which a lot of rails developers advocate; another perk to trying this book.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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