This article was previously published on

Image for post
Image for post

The Ruby language was developed by Yukihiro Matsumoto (“Matz”) in 1995. The language was designed to be object-oriented, intuitive, and easy to learn to optimize for developer time. As “Matz” once said:

“…in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.”

In this tutorial, we’ll explore Ruby best practices to ensure our code is in line with Matz’s principles of being legible, modular, and concise.

1) Use case/when conditionals instead of lengthy if statements.

Let’s say we are writing a program…

In this tutorial, we will explore the naive and optimized solutions for a simple interview-type problem.

The Problem

Given an array (arr) of n unique non-negative integers, return a non-negative integer that is not in the array. Return nil if the array contains all possible integers.

Unoptimized Solution

In this solution we search the array for integer n, and return n if it is not in the array. We iterate through every integer from zero to the maximum integer in array + 1 to capture all possible integers that might not be in the array. See below.

In this solution we search through…

Image for post
Image for post

In this tutorial, we’ll cover two different algorithms to encrypt text with Vignere’s Cipher. One is a more naive but concise solution and the second is more computationally efficient. We’ll discuss the time and space complexity of each and conclude with how to design your code so it is as efficient as it can be.


Vignere’s Cipher is a variation on the more well known Caesar’s cipher. Before diving into Vignere its important to understand how Caesar’s cipher works.

Caesar’s cipher takes a single integer key, and offsets each character in the target string by that many letters in the…

This tutorial will take you through the steps to make your own Rock, Paper, Scissors command line game. Before you begin, you should be fairly comfortable with object oriented programming in Ruby. By the end you will have your own Ruby Gem that can be downloaded by anyone anywhere. Make a gem and get your code out there!

Image for post
Image for post

Initialize your Gem

What is a gem? A gem is just a library of Ruby code hosted on that can be downloaded and used by anyone. Let’s begin!

  1. Create an account on
  2. Name your gem. Choose an original name. Feel free to search…

Hannah Squier

Software Engineer, GIS Analyst

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store