Learn to Program with Ruby

You should learn to program. No, seriously. YOU should learn to program.

In 2024, it’s a cliche to say that technology is important. Software has already eaten the world. Most of our lives are inter-tangled with software applications, both via computers and smartphones.

We are surrounded by computers everywhere. We all know that programming is a critical skill to learn. Almost all industries have a digital footprint, and many companies are evolving to become “software” companies.

The importance of learning to program is greater than it has ever been.

We also know that software industry is one of the highest-paying industries. You can work from anywhere in the world and work any time you want. If done well, a career in programming and software development gives you the three important freedoms in life:

  1. Financial Freedom: Earn as much as you want
  2. Location Freedom: Work from anywhere in the world
  3. Time Freedom: Work whenever you want

But I guess you already knew all that. My goal is not to convince you about the financial or other material benefits of programming and software development.

I want to show you the other freedom of programming: The freedom to create; create whatever you want; build your own digital world and cultivate an online garden. Experience the joy of learning about computers and the magical world of software development.

When you learn to code, you learn to tell your computer how to do something. You can create pixels on the screen, and change those pixels to however you want, whatever you want. You can create the digital world you want.

Not only that, but your world-view also changes when you learn to program. You don’t consider computers as some complicated machinery, but just some devices that can be manipulated via programs.

So you should learn to program, to learn to create. Programming can be an extremely fun and rewarding hobby.

I can’t promise that you will immediately get a remote, six-figure job as a software developer. What I can promise is that your world will be different once you learn to program.

Learning to program is not hard.

Maybe you’ve heard that programming is hard, it’s full of complex Math, formulas, equations, calculations. 

Programming is not only about Math. Modern programming is much more than programming complex formulas. It’s about building websites, programming web applications, solving interesting problems, designing web pages, and much more.

Maybe you’ve even tried to learn to code when you were in college, and gave up, because the language you were learning was C or C++, or Java, and you just couldn’t figure it all out. The words pointers, polymorphism, inheritance, encapsulation were thrown onto you without explaining the need and the problems they were trying to solve, and it only added to the confusion.

Maybe someone told you that you weren’t fit to code, you weren’t smart enough to be a programmer, and you believed them.

They were wrong. It doesn’t have to be that way. Programming doesn’t have to be hard. It can be one of the most fulfilling and satisfying activities you can do.

Why Ruby?

One reason I am telling you that learning to program will be easier, because you will learn to program with me in one of the most elegant programming languages called Ruby. It’s one of the most beginner-friendly and one of the most beautiful programming languages in the world.

💡
Ruby is a programming language from Japan. It was created by Yukihiro “Matz” Matsumoto in 1995.

I’d go one step further and say that Ruby should be everyone’s first programming languages.

Don’t believe me? Let’s compare two programs that print the text “Hello World” on the screen.

Here’s the one in Java.

public class HelloWorld {
    public static void main(string []args) {
        System.out.println("Hello World")
    }
}

Here’s the same program in Ruby. Yes, it’s a complete program.

print "Hello World"

Not only the programs written in Ruby are wonderfully short, they are also much more expressive than most other programming languages. They're also free from most of the punctuation rules such as semi-colons or brackets and parenthesis.

Ruby is also an incredibly concise and readable programming language. What other languages take multiple statements to express, Ruby can express it in often a single statement. Even developers who have never seen Ruby can see a piece of code written in Ruby and understand what it does.

💡
You can read a piece of code written in Ruby like pure English and make sense of it, even if you haven’t programmed before.

Ruby is a fun programming language. What’s more, Matz, the creator of Ruby, created Ruby in the first place to make programmers happy.

Not the computer. Not the compiler. The developer.

Ruby is the only programming language focused on developer happiness. You will truly experience the joy of programming when using Ruby.

However, don’t think for a moment that Ruby is a “toy” programming language that’s fun to program but not build “serious” applications.

There’s nothing wrong with toys, toys are wonderful. But Ruby can be (and is) used to build some of the biggest applications and billion-dollar companies (like Shopify, GitHub, Airbnb, Zendesk) and multi-million dollar companies like 37signals, Cookpad, Intercom, and many more.

The web application framework Ruby on Rails is written in Ruby, which lets you create amazing web applications pretty quickly. All the above companies use Ruby on Rails.

No matter what anyone tells you, Ruby is the best programming language to start your programming journey.

Ruby also has a wonderful, friendly community all around the world. Although you write programs alone, having support when you need it is essential. There are hundreds of thousands of developers all over the world who are there to help you solve problems and support your journey as a developer.

So these are the reasons we will learn to program in Ruby. If you’ve never written a line of code before, Ruby is a wonderful choice as your first programming language.

Hope my words have convinced you enough to learn to program and program in Ruby. However, before you proceed, let me set clear expectations.

💥
This is not one of those “Learn to Program in 7 Days!!” post. You won’t finish reading this post and land a cushy, work-from-home tech job with a six-figure salary the next day.

Programming is a craft. Just like any craft, it takes years and years of patient practice and learning to master. However, getting started in programming is very easy. There are a handful of basic concepts you need to know to get started, and then you learn things as you go on. Technologies come and go, but the fundamentals of programming don’t change. And that’s what we’ll learn in this article. The fundamentals.

Learning to program is a long-term process. Anyone who tells you otherwise is trying to sell you their book/course/bootcamp. However, if you stick to the path and practice every day, you’ll be amazed at how much progress you can make in just a few months.

This post gives you the basics to start your programming journey.
From a Lorry Driver to Ruby on Rails Developer at 38
I recently had the pleasure to interview Pedro David Garcia Lopez, a Ruby and Rails developer based in UK, who used to be a Lorry driver. What’s interesting is that he decided to become a developer at the age of 38. This post shares his story and I hope you find it as inspiring as I did!

Table of Contents

Sounds interesting? Let’s get you all set up for writing Ruby programs.


Day 1: Installation, Setup, and Our First Program

In this lesson, we will install all the tools you'll need for programming and write a simple program. Here's the software we'll install on our computer.

  1. iTerm: A Command Line or Terminal application to run the programs.
  2. Ruby: A programming language in which you write the programs
  3. Visual Studio Code: An Integrated Development Environment (IDE) to write the program.

Let’s get you set up with all three.