Building Concurrent Primitives in Ruby without a Queue

The number-one, easiest way to make Ruby threads communicate and synchronize is to use the built-in Queue class. You can even see this in the Ruby docs: This class provides a way to synchronize communication between threads.

Unfortunately, a Queue isn’t always what we want. So, how can we build our own primitives that are still nice and thread-safe? Read more on Building Concurrent Primitives in Ruby without a Queue…

When & How to Solve Problems with Genetic Algorithms

Genetic algorithms are a class of algorithms designed to explore a large search space and find optimal solutions by mimicking evolution and natural selection. Potential solutions are randomly found, evaluated, and bred with one another in hopes of producing better solutions.
Read more on When & How to Solve Problems with Genetic Algorithms…

Making Unexpected Friends at Work by Prepping for External Events

When I joined Atomic many years ago, it was a small group of tight-knit developers. With fewer than 10 developers working in an open office environment, it was easy to build and maintain a sense of camaraderie. Now that the number of Atoms is around 60, it’s not so easy to get to know one another. We’ve done many experiments to help build and foster the family feeling here at AO, but we’re always looking to improve. Read more on Making Unexpected Friends at Work by Prepping for External Events…

Active Record Aggregate Fields via Sub-Selecting Scopes

I was recently working on a piece of code from a legacy Rails application. An unusually large number of queries being run on a particular page let me know there was an N+1 query lurking.

The application was an online assessment platform dealing with assessments, questions, and responses. The question listing page was simply asking each question if it’s locked—which happens if it has any responses. So what’s the best way to query for lots of questions and their locked status? Read more on Active Record Aggregate Fields via Sub-Selecting Scopes…

Building Better Board Games with Clojure and Gorilla REPL

A while back, my six-year-old daughter and I were on one of our regular daddy-daughter date nights when we decided to create a board game. We sat at a restaurant table with paper, crayons, and a small collection of Dungeons and Dragons trinkets. To my surprise, we built a fun little game that my daughter named Turtle Burglars.
Read more on Building Better Board Games with Clojure and Gorilla REPL…

Ember.js Components with DOM Dependencies

Ember.js is a great framework for building single-page applications. Its mantra of “data down, actions up” sets a clear guideline on how to structure most of your application.

Your route gets some data and tees it up for your controller/component to render it. When something changes the UI (say entering text), you fire an action with the updated values and use it to update your data. This approach also helps with rendering speed under the hood. Your view is totally driven by your model. Perfect. Unless…
Read more on Ember.js Components with DOM Dependencies…

Testing Data Migrations in Rails

When working on a Rails project, you will inevitably need to move data around in your database. Some join table value will need to be moved into its own table or what have you. When approaching these kinds of migrations, there are two major complications: future-proofing and testing. In this post, let’s walk through an example migration.
Read more on Testing Data Migrations in Rails…