Code I like

Code I like

Articles by Jorge Manrubia on Rails design techniques
and patterns. They feature code examples extracted
from 37signals apps.

Globals, callbacks and other sacrileges

Maximalist positions are a thing in our industry. Take a technique, outline its drawbacks, extrapolate you can’t use it under any circumstance, and ban it forever. We are lucky that Rails embraces exactly the opposite mindset as one of its pillars.

Active Record, nice and blended

Active Record restates the traditional question of how to separate persistence from domain logic: what if you don’t have to?

Vanilla Rails is plenty

A common critique of Rails is that it encourages a poor separation of concerns. That when things get serious, you need an alternative that brings the missing pieces. We disagree.

Good concerns

We love concerns and have been using them for years in large codebases. Here we share some of the design principles we use.

Fractal journeys

Good code is a fractal: you observe the same qualities repeated at different levels of abstraction.

Domain driven boldness

How to create a good domain model is the subject of many books, but here’s a lesson I learned at 37signals: don’t be aseptic, double down on boldness.