The MemoWise logo, designed by Luci Cooke and licensed under CC BY-NC 4.0.

There’s a new gem in town! It’s a memoization gem called MemoWise (pun very much intended) and we think it’s the best way to memoize methods in Ruby. This post covers its origin story, and we also wrote about what makes it so fast and some esoteric Ruby we learned along the way.

What is memoization?

One of our codebases has a method that we’ll call slow_value. It’s really complex, involves multiple database queries, and takes a long time to return a result.

Performance data for our application made it clear that this method was a…


A scaling challenge

Event sourcing is at the core of our data pipeline: each night we extract data from our client systems and construct an event log describing everything that happened within the data (e.g., a student was added, attendance was taken, grades were recorded). We replay these events in our code to construct Postgres tables that our application queries to answer questions like “What is student XYZ’s name?” and “How many days of school has student XYZ missed this year?”

In event-sourcing parlance, these tables are called projections. Even though we only add one day’s…


At Panorama, we strongly believe in automated tests. No code gets deployed without passing both a thorough code review and a battery of thousands of automated tests, and no code makes it through code review without updating tests for the new features it’s adding. Automated tests help us build new features and refactor old code without introducing bugs, and are a big part of the reason we are able to confidently deploy new changes to our production apps multiple times a day.

What are flaky tests?

But with an automated test suite comes the dreaded possibility of tests that fail nondeterministically-that is, most of…


As Rails developers, we spend a fair amount of time in the Rails console, which is itself just the native Interactive Ruby Shell (IRB). By default, it’s not particularly pretty…

$ rails c
irb(main):001:0> def hello
irb(main):002:1> puts “hello”
irb(main):003:1> end
=> :hello
irb(main):004:0> hello
hello
=> nil
irb(main):005:0>

…but it gets the job done. We were content with it, because we didn’t know things could be better.

But then we started worrying. Our app lives on Heroku, and there are several other Heroku “forked” apps that give us non-production environments for various levels of testing. And with many shells…

Jacob Evelyn

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