Blog

All Posts

Naming – The hardest thing in Software

There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton   All of us struggle with naming on a day to day basis. What should we call a class, a field or table...

Cleaner custom validations in ActiveRecord

We've all been there. An ActiveRecord model deep in the domain of the app. Rails (or rather ActiveRecord) provides a lot of validations off the shelf. But sometimes, they are just not enough to get the job done. That's when...

Refactoring: Rails Presenter pattern

Rails by default uses simple functions for view helpers. This is good enough for most scenarios, but there are times when it makes sense to create view objects instead. Let's take a look at a scenario like this. Here, we...

Parallel Test Execution in Rails

Tests are run quite frequently, hence it is vital that the test suite runs as fast as possible to ensure development time is not wasted waiting for the suite to complete its runs. However, we occasionally find ourselves with a...

Refactoring to design patterns: The template pattern

The template method pattern is a useful design pattern when you have a bunch of classes which follow a similar algorithm/steps but vary in the implementation of the steps. Let's take a look a simple example where refactoring to this...

Abstractions in Ruby and Clojure

One of the primary reasons I find it much easier to write Clojure is just the fact that you get to model your problems just using simple functions and values. This method seems to naturally fit my mental model of...

Get weekly updates