Systems | Development | Analytics | API | Testing

Ruby

State Machines in Ruby: An Introduction

A state machine can hold all possible states of something and the allowed transitions between these states. For example, the state machine for a door would have only two states (open and closed) and only two transitions (opening and closing). On the other hand, complex state machines can have several different states with hundreds of transitions between them.

Using Scientist to Refactor Critical Ruby on Rails Code

Ask any software engineer to review key portions of production code, and inevitably, they will point out three things that need to be refactored. So why does so much bad, brittle, or misunderstood code remain running in production? The answer is simple: engineers are afraid to touch it. Refactoring tasks get identified and added to the backlog, but rarely make it into the current sprint. There are numerous reasons for this.

5 Tips to Design Ruby on Rails Transactions the Right Way

Data integrity problems are among the most common database issues Rails developers face. Besides allowing for proper validation, correctly designed transaction blocks ensure that your data isn't partially created or updated. However, transactions can also harm your application — or even take down your whole database — when not properly designed. This article offers a set of good practices for working with transactions.

Delayed Job vs. Sidekiq: Which Is Better?

Most applications need background jobs for mailers, regular clean-ups, or any other time-consuming operation that doesn't require a user to be present. Several gems support job queues and background processing in the Rails world — Delayed Job and Sidekiq being the two most popular ones. In this post, we will take a detailed look at Delayed Job and Sidekiq, including how they fare against each other. Let's go!