1. Memoization in Ruby using three different patterns

    Memoization is the process of performing an expensive calculation — a lookup from a database, a long-running function, etc. — and then caching its value to prevent the expensive action from running again. In computer science jargon, it trades space complexity for time complexity; that is, instead of releasing the calculated value for the garbage collector, it stores the value, thus increasing the space requirements of the object, to save on the time it takes to calculate the value more than once.

  2. RubyConf 2018: Let's Subclass Hash - What's the Worst That Could Happen?

    The RubyConf 2018 logo.

    Have you ever been tempted to subclass a core class like Hash or String? Or have you read blog posts about why you shouldn’t do that, but been left confused as to the specifics? As a maintainer of Hashie, a gem that commits this exact sin, I’m here to tell you why you want to reach for other tools instead of the subclass.

  3. The absurdity of Ruby's Hash default value

    A chalkboard with a question mark drawn on it.

    The Hash default value behavior in Ruby is one that can leave people confused. The hallmark of a good API is that it is obvious what is going to happen in each way you use it. This is one of the few places I can think of where Ruby’s standard library has surprising and confusing behavior. In the case where you use a value object – like a Numeric – as the default value, everything works as you would easily expect.

  4. A checklist for reviewing Rails database migrations

    A joking todo-list for the day saying: 1. Wake up, 2. Coffee, 3. The rest.

    Software teams often cite code reviews as a primary means for ensuring quality and reducing bugs in their code. However, without high quality reviews, the efficacy of this practice is questionable. In most places that I’ve worked, a change requires only one code review (either through necessity due to team size or through informal norms). When this is the case, the code review becomes a taxing process where, if you’re not on your game, bugs or maintainability issues can start to leak into production. This means that it often falls to the senior engineers to do code reviews. However, relying entirely on the seniors means that they become a bottleneck in the process. When it comes to “dangerous” changes like Rails database migrations, the bottleneck of relying on a small subset of the team can mean that velocity drops. Or, to keep up velocity, you make code reviews less stringent and quality drops.

  5. Grouped pagination in ActiveRecord

    Sometimes, designers will mock-up an extremely usable page that they’ve thought about and tested. Once they’re done and they bring it to you to implement, you look at it and think, “how on Earth can I do that efficiently?” One such case happened at work recently.

  6. Using the double-splat operator in Ruby

    The double-splat operator is one of my favorite additions in Ruby 2.0. For some reason, the two little asterisks together make me happier than an optional Hash parameter in a method. Even so, outside of method definitions, I didn’t realize there was a use for the double-splat operator until I dug into a bug in Hashie. I liked the result enough that I wanted to take a quick minute and share what I found.


Hi, I'm Michael Herold. I am a husband, father of two, and a staff engineer at Shopify working on the Shop Search team.

I'm a Rubyist by trade and maintain Hashie and KSUID for Ruby. I am working to better the IndieWeb experience in Ruby, in particular for the Bridgetown static site generator, which I use to host this website.