My Experience Speeding Up ORM Methods for A Match Search

I learned an important lesson recently while writing code that finds Lego sets you can build based on Lego sets you already own:

Whenever possible, pass search results!

The Problem

Suppose you have a single match-search method you want to call, but you want some of the behaviors it performs to be reusable on their own. A good bet is to break up those behaviors into separate methods that can be used in your final match-search method. That’s what I did. That’s good reusable code.

But, if you don’t watch out, you…

When a Change in One Part of State Requires Change in Another.

You’re using React-Redux. Suppose one part of your state should change if another part changes. Some might call this a supervenience relationship. Whatever you call it—you want a change in X part of state to always result in a change in Y part of state. This article shows you one solution: set two parts of state to respond to the same action type with a switch-case.

I’ll give you two examples: one, with a single reducer (Example 1), and another, which I used in my latest React app, which uses combineReducers (Example 2).

Example 1: Change in Values => Change in Average

Say you have one part of state…

I just wrote a JavaScript app called the “Mounty Hall Problem App” (which simulates a famous game-show puzzle with a very similar name).

The user is presented with three closed doors. After picking one door, the host opens one of the other two doors to reveal a losing token behind it.

Photo by Jon Sailer on Unsplash

(I used Canadian woodland creatures to represent losing tokens behind the doors. You might want to take them home, but they can be pretty aggressive.)

Now the user is given the choice of staying with their original door pick or switching to the other unopened door.

What should the…

Library—The Analog Version

I didn’t plan to build search features for my Books & Banter Rails project, especially with the Google Books API , but…laziness.

Laziness is a mother of invention—along with her sister, necessity, of course.

Why conjure up a bunch of book data to build a library, when you can just harvest it from Google Books?

In a previous blog, I went over the basic setup for using the Google Books API . This time, I added a check to see if the data was valid before instantiating a new book instance:

... do |book_hash|

Model-Side Issues in Validation & Future Functionality of the HealthCare Portal App

While making my HealthCare Portal App, built with Sinatra (short video on how it works can be found here), I found an interesting issue when I tried to render an .erb page after a failed validation.

The Problem:

  • My patient’s edit page patients/edit.erbis built to show the patient’s current information when you open the edit form. (The <input>field is set to show the current values saved in the database for the patient’s attributes before they’ve been edited and updated).
  • In my app, the “name” and “birthdate” attributes of each patient must be valid per the ActiveRecord validation macros I used :

What API do you choose to work with if you spend all your time reading old books and looking for “scholarly references” online? The GoogleBooks API, of course!

For my first CLI project, I decided to look for books in my new field of interest, “Object-Oriented Programming”(rather than an old one).

Do these books look up-to-date for Computer Programming? If they’re in English, I bet they use words like “thou,” “wouldst,” and “apothecary.”

With this program, I fetched the top 40 most relevant books (according to the Google search engine) on “Object-Oriented Computer Programming” from the Google Books API.


My background is in teaching people to read Classical Greek and Latin (hence the title).

There’s still a lot of work to be done in the digital humanities to make ancient texts available, and I’ve done some work in that area—but, I get really excited when I think about all of the new avenues for creative design that software engineering opens up. I’m particularly interested in designing applications that have real-world use. I also just really like learning new languages and talking about them with other people.

In short, I’m looking forward to moving into the 21st century and finding a new path (inveniens novam viam) in programming!

David Ryan Morphew

I’m very excited to start a new career in Software Engineering. I love the languages, frameworks, and libraries I’ve already learned / worked with (Ruby, Rails,

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