Towards the end of this video there’s a terrific discussion of the point at which DRYing out the code any further would just make it harder to understand. I was also amused by the quote: I have downloaded much of my brain into emacs muscle memory.
It’s time to reclaim the lost art of refactoring.
I recently visited the Hashrocket offices in Jacksonville, and while I was there I did a Lunch & Learn talk on the topic of of breaking down too-big classes into smaller pieces. In it I went over pros and cons of four strategies: Breaking the class into modules Decorators Dynamic module extension Object Composition We […]
I’ve started working my way through Refactoring in Ruby, by William C. Wake and Kevin Rutherford. I haven’t been this excited about a book since Michael Feathers’ Working Effectively with Legacy Code. I feel like a schoolboy, relearning refactoring as if for the first time. The core concept of the book was not clear from […]
Periodically the question of how to test private methods comes up at work or online. My answer is: don’t. It may seem trite, but there is some reasoning behind it. Private methods are, by definition, implementation details. If you are approaching your tests from a behavioral standpoint – and you really should be, whether you […]