Articles

A collection of my articles on technology, engineering, and products.

Making Lazy Accessors Thread-Safe

What’s scarier than meta-programming? Thread-safe meta-programming!

Continue reading »


Lazy Attributes in Ruby

Lazy attributes are absent from Ruby, but a bit of creativity enables them to be programmed into the language.

Continue reading »


2022 in Review

A summary of work I did in 2022, and my plans for 2023.

Continue reading »


Elixir-style Pipelines in 9 Lines of Ruby

Elixir pipelines are an elegant construct for sequencing operations in a readable way. Fortunately, 9 lines is all it takes to implement them in Ruby.

Continue reading »


API Integrations: Client Classes and Error Handling

The way API clients signal results and errors is critical to integration quality, especially for under-documented APIs.

Continue reading »


API Integrations: Building Client Classes

Calling third-party APIs is associated with inherent complexity that’s not going to disappear. It needs to be tamed and confined.

Continue reading »


Power Estimation: Balance Between Simplicity and Accuracy

Estimates – love them or hate them, sometimes you need them. This article outlines a simple yet effective estimation method I use for client projects.

Continue reading »


Database Performance: Redundant Indexes

Databases use sophisticated planning algorithms to determine best query execution strategy. An important aspect is deciding which indexes, if any, to use. This article explores why some indexes could be replaced by other existing indexes and how to identify them.

Continue reading »


Database Performance: Indexing Foreign Keys

Foreign keys are essential to all non-trivial database schemas, yet their performance aspects are often overlooked. In this article, we’ll shed more light on the subject.

Continue reading »


Database Performance: Deletion Timestamps and Indexing

Deletion timestamps are often used to implement soft-deletion by marking rows deleted without actually discarding them. While simple, this approach has consequences for index performance. Let’s understand the problem and how partial indexes help to to solve it.

Continue reading »


How to Access Production Data in Rails Migrations

Sooner or later every project will need to migrate production data, not only the schema. There are many different approaches in the wild – most of them overly complex. In this article we’ll tackle the problem using vanilla Rails.

Continue reading »


How to Protect Individual Resources with Passwords

User authentication in Rails is a solved problem but how can we protect individual resources with a password? It turns out that all we need is vanilla Rails and not that much code.

Continue reading »


How to Reduce Test Interference in Minitest

Global state can easily lead to interference between test cases and cause random failures. In this article, we’ll discuss a technique for alleviating this problem when reducing the global state is infeasible.

Continue reading »


Numbering Copies Using Enumerators

Copying a file in a file manager results in adding a copy counter to the file name. In this article, we’ll devise a simple and elegant algorithm based on Enumerator for doing the same in a Rails app.

Continue reading »


How to Reduce Memory Usage by Tuning Gemfile

Rails is known for many things but memory effectiveness is not one of them. By default, it loads all gems, used and unused, which contributes to the overall memory footprint. Fortunately, we can easily eliminate this waste without touching the app.

Continue reading »


The Architecture No One Needs

Single-page apps are all the rage nowadays. Many praise their vague technical benefits while ignoring tremendous development costs.

Continue reading »


How to Speed up Your Tests without Touching the Code

The larger the test suite the slower it gets. This is an obvious yet annying truth. In this article, I present a simple and generic technique for improving test suite performance (almost five-fold in my case) without touching the code base at all.

Continue reading »

Leave your email to receive updates about articles.