oop

Resist Memoization

Memoizing complex objects often feels like a “free optimization”. But it comes with hidden costs.

Policy as Structure

Managing the switchover to a new service provider using feature flags is great… until you find yourself in a codebase littered with if/else switches. Learn how to think about app states as policies, and then model your policies as composed …

Safe Navigation Redux

Sometimes objects are missing, and sometimes that’s OK! We need a way to say it’s OK, and we have one: the “safe navigation operator”. But what exactly does it do, and what are its limitations? And why does it look …

Valued Ruby

Create safe, sturdy code by modeling domain attributes as rich value objects.

Where do Private Methods Come From?

A question that I hear a lot is: “Do you test private methods? And if so, how?” In this, the first of a series, we’ll talk about where private methods come from, and what that has to do with testing them (or not).

Mistake-Proof API

Learn how to eliminate a whole class of possible user interface mistakes by modifying your API design, making it impossible to even express incorrect usage.

From Hash to Value Object

Join guest chef Tom Dalling to see how Value Objects can function as contracts, documenting expectations at the integration points of our code. Along the way, learn how to use the ValueSemantics gem!

Minimum Viable Method

Is there such a thing as a method that is too small? Is it worth it to extract a method just to satisfy a guideline like the Law of Demeter?