Introduction to Ruby
Learn what Ruby is, who created it and why, its core philosophy of programmer happiness, and write your first line of Ruby code.
Introduction
Ruby is a dynamically typed, interpreted, general-purpose programming language built around an unusual founding goal for a programming language: making the programmer happy, not just the computer efficient. Every design decision in Ruby, from its syntax to its standard library, traces back to that one idea.
This lesson introduces what Ruby is, who created it and why, the philosophy that shapes every design decision in the language, and gives you your very first taste of actual Ruby code.
- What Ruby is and what kind of language it is (dynamically typed, interpreted, object-oriented).
- Who created Ruby, and the goals that shaped its design.
- The core philosophy — programmer happiness — that guides every Ruby feature.
- The key features that make Ruby stand out from other scripting languages.
- What a minimal Ruby program looks like.
What is Ruby?
Ruby is an open-source, dynamically typed, interpreted, purely object-oriented language. "Purely object-oriented" is a strong claim, and Ruby earns it: unlike languages where numbers or booleans are special primitive types, in Ruby every single value — including the number 5 or the boolean true — is a genuine object with its own methods you can call on it.
What sets Ruby apart from many other dynamically typed languages is how consistently it optimizes for how the code reads and feels to write, sometimes even at a small cost to strict consistency — Ruby often provides several ways to express the same idea, specifically so you can pick whichever reads most naturally in context.
Who Created Ruby, and Why
Ruby was created by Yukihiro Matsumoto, known widely in the Ruby community as "Matz," starting around 1993 in Japan, with its first public release in 1995. Matz has said directly that he wanted to create a language that made programming enjoyable, not just productive — famously describing his goal as prioritizing the "principle of least surprise," where code behaves the way a human would intuitively expect it to.
Matz drew inspiration from several existing languages — Perl's practicality, Smalltalk's pure object-oriented model, and ideas from Lisp and Ada — combining them into something he felt no existing language quite offered: genuinely enjoyable, expressive, object-oriented scripting.
Core Philosophy
Every feature Ruby has — and the flexibility it deliberately allows — traces back to a small set of guiding principles.
- Programmer happiness — Ruby is explicitly designed to be enjoyable and expressive to write, not just correct and efficient.
- The principle of least surprise — code should behave the way it reads, with minimal hidden or unexpected behavior.
- Everything is an object — a fully consistent object model, with no special-cased primitive types.
- There's more than one way to do it — Ruby often provides multiple valid syntaxes for the same operation, trusting you to choose what reads best.
- Convention over configuration — a philosophy Ruby on Rails later built on directly, favoring sensible defaults over exhaustive manual setup.
Key Features at a Glance
Pure Object Model
Every value, including numbers and booleans, is a real object with callable methods.
Blocks, Procs & Lambdas
First-class, flexible ways to pass chunks of code around as values — covered fully in lesson 8.
Readable, Expressive Syntax
Ruby code often reads close to plain English, minimizing unnecessary punctuation.
Mixins via Modules
Share behavior across classes without the rigidity of single-parent-only inheritance.
Rich Standard Library
A well-designed standard library covers most common tasks without reaching for an external package.
RubyGems & Bundler
A mature, widely used package ecosystem and dependency manager, covered in lesson 11.
Your First Taste of Ruby
No introduction to a language is complete without seeing actual code. Here is the smallest complete Ruby program — one that prints a greeting to the screen.
puts "Hello, Ruby!"Click Run to see what this code prints.
That is genuinely the entire program — no imports, no main function, no class wrapper required. puts (short for "put string") is one of Ruby's built-in methods for printing output, and a Ruby script is simply a sequence of statements executed from top to bottom, exactly like this one line.
Where Ruby Is Used Today
Ruby's biggest and most famous footprint is web development, largely thanks to Ruby on Rails, but its reach extends well beyond that.
| Project / Company | How Ruby Is Used |
|---|---|
| Shopify | Built on Ruby on Rails, one of the largest and most well-known production Rails deployments in the world. |
| GitHub | Originally built with Ruby on Rails, and Ruby remains part of GitHub's broader technology history. |
| Basecamp | The company that created Ruby on Rails, still built on it today. |
| Chef & Puppet | Widely used infrastructure automation and configuration management tools, both written in Ruby. |
| Jekyll | A popular static site generator written in Ruby, and the engine behind GitHub Pages. |
| Airbnb (early history) | Built its original web platform on Ruby on Rails. |
Common Mistakes
- Assuming "Ruby" and "Ruby on Rails" are the same thing — Rails is a web framework built with Ruby, not the language itself.
- Expecting strict, single "one right way" syntax the way some other languages enforce — Ruby deliberately allows multiple valid styles.
- Judging Ruby's relevance purely by hype cycles — it remains in serious, active production use at many established companies.
- Skipping the philosophy section and jumping straight to syntax — understanding *why* Ruby favors readability makes several later design choices click faster.
Best Practices
- Read Ruby code out loud when you're unsure what it does — its syntax is deliberately designed to read close to natural language.
- Install a Ruby version manager (like rbenv, covered in lesson 3) early, so switching Ruby versions between projects stays painless.
- Get comfortable with irb, Ruby's interactive REPL, for quick experiments before writing a full script.
- When stuck, check the official Ruby documentation (ruby-doc.org) — Ruby's core classes are unusually well documented with examples.
Frequently Asked Questions
No — Rails is Ruby's most famous use case, but Ruby is also used for automation scripting, infrastructure tooling, static site generation, and even small games via frameworks like Gosu and DragonRuby.
Yes. Ruby has been open source since its first release and is developed under a dual license (Ruby's own license and the BSD-style license), with ongoing development led by Matz and the wider Ruby core team.
No, but familiarity with basic programming concepts (variables, loops, functions) from any language will help you move through the early lessons faster.
Ruby minimizes required punctuation, allows natural-language-like method names (like 5.times), and consistently prioritizes code that reads the way you'd describe it out loud.
Key Takeaways
- Ruby is an open-source, dynamically typed, purely object-oriented scripting language.
- It was created by Yukihiro "Matz" Matsumoto starting around 1993, with its first public release in 1995.
- Ruby's core philosophy is programmer happiness and the principle of least surprise.
- A minimal Ruby program is a single line — no imports, no main function, no class wrapper required.
- Ruby powers Shopify, Basecamp, and (historically) GitHub, alongside tools like Chef, Puppet, and Jekyll.
Summary
You now know what Ruby is, who built it, why it exists, and what its guiding philosophy is. You have also seen your very first line of runnable Ruby code. Next, you will dig deeper into Ruby's history — from its 1995 debut through Rails' arrival and today's performance-focused Ruby 3.x.