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!
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…
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).
Say you have one part of state…
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.
(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…
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:
books_array.map do |book_hash|…
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).
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).
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!
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,