Refactoring in Ruby: Primitive Obsession

We’ve all been at this point where we have bloated our classes with primitive values all over the place. Usually, we drop in primitive constants that, for whatever reason, we think that are a good fit to the class. Or sometimes, we just dump primitive values instead of small objects, thinking “it’s okay, it’s just an attribute in the class”. But, does it always make sense? The problem Say we have a project for a finance journalist who wants us to automate his text editor to do some random fixes to his texts, on the fly....

March 8, 2016 · 12 min · Ilija