Guidance on how to break down problems and structure solutions.
Category: Design
Episode #224: Surrogate Ordering
It's often desirable compare objects to see which is "lesser" or "greater"; but not all objects are inherently comparable. Today we'll look at a scheme for easily imposing an arbitrary …
Episode #220: Type and Class
Where do we draw the line between objects differntiated only by state, and objects differentiated by their class? That's the question we'll examine in this episode.
Episode #217: Redesign
Today, a story about a refactoring that went south, and turned out not to be a refactoring at all.
Episode #216: Tell, Don’t Ask
In today's episode, we explore a practical application of the famous "tell, don't ask" principle.
Episode #214: Conversion Ratio
Today we puzzle through a design problem that threatens to result in dozens of extra methods.
Episode #213: Conversion Protocol
Today's topic is "conversion protocols", an extensible way to enable safe, automatic conversions between types.
Episode #210: Implicit Conversion
Have you ever wondered why Ruby has both #to_i and #to_int methods? Or both #to_a and #to_ary? In today's episode we'll answer this question, and look at how we can …
Episode #208: Lenient Conversions
For core types like Float, Ruby has both conversion methods (#to_f), and conversion functions (Float()). When should we use one vs. the other? This episode attempts to answer that question.