Beginner Series: Ruby Tutorial
What is Ruby?
Ruby is an object-oriented programming language in the purest sense. That is because unlike other languages, everything in Ruby is considered an object.
Furthermore, Ruby is a scripting language. Often, a scripting language is called so because it is interpreted, and not compiled. While that is true, Ruby is a proper scripting language. This means that it can be embedded in other programs and that it can be used to control them.
The architect of Ruby, Yukihiro Matsumoto – known as Matz in the web development community – designed the language to be both simple and powerful. He wanted it to be simple enough so that novice coders would not have difficulty using it, but powerful enough that experienced developers would have everything they need from a language.
From the outset, this seems contradictory, but Matsumoto definitely accomplished his goal. Ruby is both remarkably easy to use and learn, and powerful enough to be used by experienced programmers and novices alike.
How is Ruby used?
Ruby was conceived for the world wide web, but it is still considered a general purpose language.
While it is primarily used for web-based projects, when combined with Rails – a popular Ruby framework – it can also be used to develop web applications.
Many developers use Ruby as a stand-in for Perl, that is small, ad-hoc scripting tasks that would have been solved using Perl in the past. This is because it is an ideal scripting language for text processing and middleware programs.
Ruby is Great for Beginners!
Ruby is often lauded as one of the best languages to cut your teeth on if you’re a novice or beginner coder. This is because it is one of the easiest languages to learn and master. To perform the same functions in Ruby as you would in another language takes a lot less code.
For example, here’s what the infamous “hello world” exercise looks like written in C++:
#include <iostream> using namespace std;
int main() { cout << "Hello world" << end1; return 0; }
That’s an extensive process just to display a couple words on the screen!
The same thing can be accomplished in Ruby with just a single line of code:
puts "Hello world!"
Just looking at those code comparisons, you can see why Ruby is a great place to start for anyone new to programming.
Next, let’s take a look at the Benefits of Learning Ruby.
Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.