from/prod
← All companies

THE COMPANY INDEX TRACKED BLOG

Jake Yesbeck

Ideas, decisions, and lessons from the team.

jakeyesbeck.com (opens on the source site)
25Posts tracked
last weekLatest publication
0.1Posts / month over the last 12 months

Latest writing

20 of 25 posts

The Way and Remainder (opens on the source site)

1970 - 2024: BCC Era (Before Claude Code) Writing software in the “before times” was an iterative process, evolving from punching holes in paper all the way to clacking away on custom, clicky mechanical keyboards. Through variations of this process, the steps were mostly the same: Understand the problem Come up with a solution Break the solution into parts Write code that solves each part Test that new things work Test that old things still work Repeat as needed As time went on, patterns emerged. Then those patterns were overused and new patterns took their place. Programming dogma went from…

Read at the source

Why You Should Avoid Models in Rails Migrations (opens on the source site)

Humble Beginnings A simple Rails application exists with two models, Books and Authors. class Book ApplicationRecord belongs_to :author end class Author ApplicationRecord has_many :books end After some domestic success, this simple Rails app goes international. A new column is required on the books table: country to denote which country published the Book. A Reasonable Migration To preserve data integrity, the country column should not allow null since null isn’t a country. Existing books also need to have a country set. This is all accomplished within a single migration in 3 steps: Add a…

Read at the source

Making RSpec Tests More Robust (opens on the source site)

RSpec is a popular framework for testing Ruby code. With an expect assertion, a developer can make sure their code calls the proper method or an acceptable result is returned. The expect().to receive matcher in a test overrides the default implementation and can cause some unintended side effects. To demonstrate this potential problem, assume a very simple API client exists that can update models. Testing an API Client An example api_client.rb class defines a single put method that calls the underlying API with a Faraday connection. # api_client.rb class APIClient def put(url, body)…

Read at the source

Ruby Processes and Threads - Configuring a Web Server (opens on the source site)

Multiple popular Ruby web servers exist. Each Ruby application is different and the ultimate tl;dr for configuring a web server is: it depends. This post will not prescribe one web server or configuration over another and will instead explain internal components most popular servers contain. In order to facilitate more than one request at a time, a Ruby web server implements Threads, Processes, or both. These tools are used to enable concurrency and are beneficial in different ways. Threads Threads in Ruby are a solution for concurrent programming and can alleviate slow downs due to blocking…

Read at the source

Improving Remote Work as a Software Engineer (opens on the source site)

After working in the Bay Area for many years, I decided that being able to afford a house was something I’d like to do. That and family led me back to the East Coast and a new chapter of my career began: Remote Software Engineering. Transitioning to working remotely in any profession has its challenges. After a few years as a remote software engineer, I have learned many things that don’t work and a few that do. Most of the things that didn’t work helped point me in the direction to those that do and hopefully these bits of insight can help others. These tips are most relevant to someone who…

Read at the source

A Few RSpec Helpful Hints (opens on the source site)

Two main frameworks dominate the Ruby testing world: Rspec and MiniTest. RSpec is a very expressive testing framework with many great features and helpers to make tests readable. When writing RSpec tests, here are just a few not so obvious hints that could make tests even easier to write, read, and maintain. Assuming a system exists with Books and Authors, let’s utilize these hints to make testing easy. class Book attr_reader :title, :genre def initialize(title, genre) @title = title @genre = genre end end class Author attr_reader :books def initialize(name, books) @name = name @books =…

Read at the source

A Successful Year of Commits (opens on the source site)

At Rails Conf 2015, I met a lot of great people from the Ruby community. These people had a profound effect on me, instilling in me a new motivation to become part of something larger than myself. A year ago today, I embarked on a journey to better myself as a Software Engineer. I decided to commit to open source software every day for a year. Even though open source software has been around for decades, up until a year ago I had thought it mostly magic and far beyond my reach. After Rails Conf 2015, it became clear to me that contributing to and becoming part of the open source community was…

Read at the source

How to Diagnose Ruby on Rails N + 1 Query Problems (opens on the source site)

Diagnosing performance problems in a production Ruby on Rails application can be deceptively complex. When constructing a new application or expanding the features of an existing one, development environments that are not subject to typical production web traffic may not make performance issues evident. In those instances, the use of some simple (and mostly free) tools can help diagnose performance issues in production. If an application is hosted on Heroku, the New Relic add-on can be added to the application for free. Despite it having a few limitations, the free version of New Relic can be…

Read at the source

Things to Consider when Metaprogramming in Ruby (opens on the source site)

Metaprogramming in Ruby is a polarizing topic. The most common purpose of Ruby metaprogramming is for code to alter itself at runtime. Metaprogramming can be used to achieve terse and more flexible code. However, it is not without its cost. As with most things, nothing of value is free, even metaprogramming. Undoubtedly, there is a time and place for metaprogramming; but, awareness of concessions that need to be made to support a metaprogrammed solution is important. Code Discovery and Readability One problem with metaprogramming solutions are their obstruction of code discovery. When…

Read at the source

How to Deal with Timezones the Active Support Way (opens on the source site)

“Well the code is bad because we had to…” is a phrase one might hear when discussing timezone offsets or daylight savings time considerations. Unless a developer is fortunate enough to work at a company whose userbase is entirely located in the UTC timezone, writing software aware of different timezones can be a daunting task. Luckily, Ruby on Rails’ ActiveSupport library has some very nice built in features that can prove invaluable when facing time related issues. Built-in Timezones ActiveSupport in Ruby on Rails 4.0+ has a built in list of all supported timezones on the TimeZone class:…

Read at the source

Five More Active Record Features You Should Be Using (opens on the source site)

In a previous post, I illustrated a few helpful ActiveRecord features. The entire API of ActiveRecord cannot possibly be contained within a single or even a handful of digestible posts; but, here are at least five more pieces of that massive API that some might find useful. Just like before, the example application used to demonstrate these features will be an imaginary Ruby on Rails application: “booksandreviews.com”: class Book ActiveRecord::Base belongs_to :author has_many :reviews end class Author ActiveRecord::Base has_many :books end class Review ActiveRecord::Base belongs_to :book end…

Read at the source

How to Build a Ruby on Rails Engine (opens on the source site)

Ruby on Rails Engines are miniature applications whose purpose is to supplement a larger Ruby on Rails application. If functionality can exist independent from a main application, an Engine can provide a wonderful degree of encapsulation. Recently, I created the and “gemified” the Passages Ruby on Rails Engine to help alleviate some routing frustration. This gem will be the be used as the example for demonstrating what goes into creating a Ruby on Rails Engine. Revving Up There are two ways to start building an Engine. One option is to use the built in generators to create directories and…

Read at the source

The Power of Arel (opens on the source site)

Many modern web applications have at least a few overlapping responsibilities. One of these responsibilities deals with maintaining state. A common choice for storing this state is by way of a relational database. Ruby on Rails applications assume the presence of a database by default and communicate with it via ActiveRecord. ActiveRecord is an Object Relational Mapping (ORM). Under the hood, ActiveRecord uses a relational algebra library called Arel to compose queries for execution. Arel is a very powerful library readily available for when ActiveRecord falls short. The Basics Keeping up…

Read at the source

The Real Cost of Technical Debt (opens on the source site)

Writing software is an iterative process. Rarely is software written and then never revisited. When this iteration occurs, a software engineer is presented with multiple options. Usually, a single objectively correct option is present but may not be chosen due to time constraints or other outside pressures. When shortcuts are taken to alleviate these external pressures, technical debt is often accrued. Permit Today, Pay Tomorrow Technical debt is referred to as such due to its similarities with financial debt. A credit card enables a person to complete a purchase they may not otherwise be…

Read at the source

Ruby Spaceship <=> Operator (opens on the source site)

Adhering to the law of trichotomy, the operator (sometimes called the “Spaceship Operator”) works by comparing two elements and returning a -1, 0, or 1. While the original mathematical criteria applies to only real numbers, many programming languages implement the law of trichotomy as a general comparison between equivalent types. Basics At first glance, the return value of the operator can be a bit confusing. A simple way to remember the significance of these return values is to break an expression down from left to right: 1. –> -1 if a , then -1 is returned 2. = –> 0 if a = b, then 0 is…

Read at the source

Four PostgreSQL Tips (opens on the source site)

PostgreSQL is an open source object-relational database used to power many production web applications. While many web applications interact with relational databases through Object Relational Mappers (ORM), direct SQL queries via a command line interface or graphical client are still common. When writing these queries, these four tips may come in handy. All examples will assume the presence of a simple users table: Column | Type ---------------+----------------------------- id | integer first_name | character varying(255) last_name | character varying(255) email | character varying(255)…

Read at the source

Ruby Threads and ActiveRecord Connections (opens on the source site)

Processing large data sets is a common problem faced by many production web applications. One solution is to divide the work amongst multiple processes and have each responsible for a single or significantly smaller batch of data. However, this solution is not without its problems. Machine provisioning limitations or financial barriers may invalidate this solution for a very large N. Within the same vein as “divide and conquer” exists another solution, one which requires far fewer parallel processes: Threads. In the Ruby programming language, a Thread is a built-in object for concurrent…

Read at the source

How to Remove a Column with Zero Downtime in Ruby on Rails (opens on the source site)

For a production Ruby on Rails application, uptime is paramount. Altering the structure of an application’s persistence layer is an operation that competes directly with uptime. Specifically, removing a table column within a relational database causes issues with the ActiveRecord ORM (the default relational mapping within a Ruby on Rails application). However, this particular pain point has been removed as of Ruby on Rails 4.0.0, saving developers a lot of headache and greatly reducing the need for structural change coordination. Old and Busted To demonstrate the problem, a simple Ruby on…

Read at the source

Nine Months of Commits (opens on the source site)

It is hard to believe that already nine months have passed since the onset of my Year of Commits. In these past nine months, I have experienced a wide range of new aspects of open source development. This has truly been an eye opening experience, with many facets I doubt I would have experienced otherwise. Confidence An unexpected and fortuitous side effect of my Year of Commits has manifested as a significant boost in my overall coding confidence. Confidence is a very important aspect of anyone’s life. Without confidence, a person may place objectives out of reach or deem them too arduous to…

Read at the source

Ruby Private Class Methods (opens on the source site)

In the Ruby programming language, defined methods come in two variants: instance methods and class methods. Instance methods are available after an object has been initialized, creating an instance. Class methods, on the other hand, are available without creating an instance of the class they are defined upon. Ruby methods can vary in visibility. Public methods are available in any context, while private methods’ availability is restricted within the instance of a class and its descendants. A third visibility scope, protected, behaves similarly to private methods, but protected methods can be…

Read at the source

Privacy choices

Reading never requires analytics. These choices last 90 days on this browser.

Essential sign-in and security storage always stays on. Read the privacy notice.