Learn How to Code
  • Welcome
  • Foundations
    • Introduction
      • Becoming a web developer
      • Motivation and mindset
      • Join a supportive community
      • How does the web work?
    • Requirements
      • Prerequisites
      • Text editors
      • Command line basics
      • Setting up Git
      • Setting up Node
    • Git
      • Git basics
      • Project: Practicing Git
    • Frontend
      • HTML and CSS
      • Developer Tools
      • Project: Create a web page
    • JavaScript
      • Strings and Conditionals
      • Using Developer Tools
      • Functions
      • Problem solving
      • Project: Rock paper scissors
      • Writing clean code
      • Arrays and Loops
      • The DOM
      • Project: Etch-A-Sketch
      • Objects and More Arrays
      • Project: Calculator
    • Backend
      • Frameworks
    • Next steps
  • Deep dives
    • Computer Science
      • Pseudocode and algorithms
      • Recursion and algorithms
        • Project: Fibs and sorting
        • More on algorithms
        • Big O
        • Project: Practicing Big O
      • Data structures
        • Maps, Stacks and Queues
        • Project: Stacks and Queues
        • Nodes, Linked Lists and Trees
        • Project: Linked Lists
        • Project: Trees
        • Next steps
    • Databases
      • Databases and SQL
      • Project: SQL Zoo
    • Design / UX
      • Fonts and typography
      • Grids
      • Project: Teardown
      • Responsive design
      • Project: Mobile friendly
      • CSS frameworks
      • Project: Bootstrapping
    • HTML / CSS
      • HTML Basics
        • Linking
        • Images and media
        • Project: Embedding media
        • HTML5
        • Tables
        • Lists
        • Forms
        • Project: Make a form
      • CSS Basics
        • Box model
        • Floats and positioning
        • Flexbox
        • Grids
        • Project: Breaking news
        • Best practices
        • Backgrounds and gradients
        • Project: One more thing
        • CSS3
        • Preprocessors
        • Project: Your own framework
      • Next steps
    • JavaScript
      • Refresher
      • Organization
      • Objects and constructors
      • Project: Library
      • Factory functions and module patterns
      • Project: Tic Tac Toe
      • Classes
      • ES6 Modules
      • Project: Restaurant
      • Object Oriented Programming
      • Project: Todo list
      • Linting
      • Menus and sliders
      • Forms
      • ES6 features
      • JSON
      • Callbacks and promises
      • Using APIs
      • Async and Await
      • Project: Weather
      • Testing
      • Project: Testing 1-2-3
      • Advanced Testing
      • Project: Battleship
      • Backends
      • Project: Where's Waldo?
      • Project: All-Star
      • Next steps
    • NodeJS
      • Project: Going to school
      • Project: Passing the test
      • Express
        • Templates and middleware
        • CRUD and MVC
        • Project: Message board
        • Routes
        • Displaying data
        • Forms and deployment
        • Project: Inventory
      • Authentication
      • Security
      • Project: Clubhouse
      • APIs
      • Securing an API
      • Project: Blog
      • Testing
      • Testing with a database
      • Project: Social network
    • React
      • Props and State
      • Render lists and handle inputs
      • Project: CV
      • Lifecycle methods
      • Hooks
      • Project: Memory card
      • Router
      • Project: Shopping cart
      • Advanced concepts
    • Ruby
      • Installation
      • Data types
      • Variables
      • Input and Output
      • Conditionals
      • Loops
      • Arrays
      • Hashes
      • Methods
      • Enumerables
      • More enumerables
      • Nested collections
      • Blocks
      • Pattern matching
      • Debugging
      • Project: Caesar cipher
      • Project: Substrings
      • Project: Stock picker
      • Project: Bubble sort
      • Object oriented programming
      • Project: Tic Tac Toe
      • Project: Mastermind
      • Serialization
      • Project: Event manager
      • Project: Hangman
      • Computer Science
        • Recursion
        • Project: Merge Sort
        • Data structures and algorithms
        • Project: Linked Lists
        • Project: Binary Search Trees
        • Project: Knight Travails
      • Testing
      • RSpec
      • Project: Four in a row
      • Git
      • Project: Open Source
      • Project: Chess
      • Next steps
    • Ruby on Rails
      • Using Heroku
      • Installing Rails
      • Basics
        • Routing
        • Controllers
        • Views
        • Asset pipeline
        • Deployment
        • Project: Blog
      • Active Record
        • Project: Upvote
      • Forms
        • Cookies, sessions, and authentication
        • Project: Password
      • Advanced forms and Active Record
        • Associations
        • Project: Private Events
        • Callbacks
        • Menus, helpers and nested forms
        • Project: Ticket agent
      • APIs
        • External APIs
        • Project: Animals
        • Project: Photo widget
      • Mailers
        • Project: Confirmation
      • Advanced topics
        • Action Cable
      • Project: Social network
      • Next steps
  • Getting hired
    • Preparing to find a job
      • Plan a strategy
      • What companies want
      • Get yourself together
      • How to prepare
      • Project: Make your website
    • Applying and interviewing
      • Qualifying leads
      • Project: Make your resume
      • Applying for jobs
      • Preparing for an interview
      • Handling an offer
      • Final words
  • Maintained by
    • wbnns
  • License
    • CC BY-NC-SA 4.0 © 2022
Powered by GitBook
On this page
  • Introduction
  • Learning Ruby before Ruby on Rails
  • The path ahead
  • Assignment
  • Optional materials
  1. Deep dives

Ruby

Learn everything you need to know in order to start building applications with Ruby.

Introduction

This course is all about teaching you Ruby, the language designed specifically for programmer happiness. What could possibly be better than that?! A task that takes dozens of lines of code to accomplish in Java or a hundred in C could take just a few in Ruby thanks to Ruby prepackaging so many useful functions into easy-to-use and convenient methods.

Ruby and Python are quite similar and in some ways resemble Romance languages: once you've learned one, it's not terribly hard to pick up the other because they tend to follow many of the same conventions. Python tends to be taught more in colleges and is often used for more data-intensive and processor-heavy applications.

However, Ruby has a secret weapon that makes it the love of fast-iterating web developers: the Ruby on Rails framework, which we'll cover in a later course. Rails has been optimized for writing code faster and with less headache, allowing you to iterate more frequently when building a website. Faster iteration means that the end product is more likely to suit the client's or users' needs, making your projects more successful.

You'll do a healthy chunk of learning in this course, but by the end of it all, you'll have built some pretty sweet projects including Tic Tac Toe, Hangman, and even Chess. You'll be able to save and open files, write tests for your code, separate out your spaghetti code into nice, distinct classes, and even reproduce some basic algorithms and data structures to solve complex problems.

Basically, you're going to start feeling a whole lot more like a real programmer, and that feeling will be justified.

Learning Ruby before Ruby on Rails

Some people believe you can just dive right into Rails and start firing out websites. So why do we have an entire course dedicated to only Ruby before we start looking at Rails? Rails is a framework built using exclusively Ruby, and every bit of code in it is written with Ruby. When (not "if") something in your project breaks, you'd better be able to debug it, which means having a strong understanding of Ruby, how it works, and what its error messages look like. Beyond that, when you start to stretch your wings and do something just a bit beyond what the vanilla tutorials explicitly show you how to do, you'll quickly discover a world of frustration if you don't have a strong foundation in Ruby. The amount of time you would spend Googling your error messages and staring blankly at help docs would be better spent learning Ruby now.

The path ahead

Ruby is a big language with lots of syntax, so we've broken the concepts up into smaller chunks to make it more digestible. Some of the early material will be fairly straightforward and will rely on simple exercises to help reinforce your understanding. As you progress through the course, the goal is for you to get a much deeper and more practical understanding of the material. As you move into some of the more advanced topics, you'll be reading less and building more--just the way it should be!

  • In the first section, you'll learn all about the basics of Ruby along with some classic programming basics.

  • In the second section, you'll learn about object-oriented programming, which will show you how to cleanly and neatly organize your code into reusable objects.

  • In the third section, you'll dive into some basic computer science, where you'll learn about recursion and common data structures.

  • In the fourth section, you'll learn the basics of test-driven development.

  • In the fifth section, you'll learn some more advanced features of Git and the Git workflow used by professional developers.

  • In the sixth and final section, you'll tie everything together by building a fully fledged chess game.

Assignment

Optional materials

The resources listed below cover Ruby basics, and you may want to go through these on the side while going through the first section of this Ruby Basics course. Repetition is the mother of all learning after all!

Consider the resources here optional, though we recommend them to help supplement your learning.

Okay, enough talk. Let's learn Ruby!

PreviousAdvanced conceptsNextInstallation

Last updated 4 years ago

Read the of Launch School's Introduction to Programming with Ruby book to learn a bit more about the history of Ruby.

To understand how you'll be interacting with Ruby throughout this course, read through the of The Ruby for Beginners book from Ruby Monstas. (Note that even though they recommend using Sublime as your text editor, any code editor will work. For the record, we still tend to prefer VS Code around here!)

Skip the installation instructions and read through the of Launch School's Introduction to Programming with Ruby book for some helpful advice about using and learning Ruby effectively. Don't worry, you will install Ruby in the next lesson.

Now that you've learned a few ways to interact with your Ruby code, read about , which will be helpful for quick troubleshooting and experimenting.

covers Ruby basics and OOP basics.

covers Ruby basics along with plenty of exercises.

Introduction
Your Tools chapter
Preparations
how to use code files inside IRB
The Codecademy Ruby course
Chris Pine's Learn to Program book