Null Objects

Nothing is something - Sandi Metz Null objects surface hidden assumptions making code easier to reason about and to change. Consider the number 0. Initially a mathematical placeholder, 0 was imbued with meaning allowing all numbers to be used in new ways. By working with numbers as they approach zero,…

Pundit - Rails Authorization

Problem As your users create and manage data, you need to decide what is visible and editable by any user in the application. You set out by scoping your domain resources to the user or to the user's team and are off to the races! Your service grows (hooray!) and…

Warden - Rails Authentication

Warden is a simple and powerful authentication mechanism for rack based ruby applications. Using a rack middleware, it injects an object into the rack environment which can be used to authenticate incoming requests. At its core, Warden uses 'manager', 'proxy', and 'strategy' abstractions to accomplish its goals. The library shines…

Recursion in Ruby

Studying Ruby and object oriented programming at Dev Bootcamp we have been working with exercises that lend themselves to recursive thinking. Because recursion was challenging yet often elegant I researched the subject further in the context of the Ruby language. For more here is an excellent resource on recursion in…

Sorting Algorithms in Ruby

Having enjoyed excellent posts on sorting algorithms I wanted to share my implementation of common sorting algorithms in Ruby. There are some great visualizations of sorting algorithms especially on Mike Bostock's blog such as the Fisher-Yates Shuffle, merge sort, and quick sort. Taking a leaf out of Jesse La Russo's…