Justin Marney


While programing I usually have a few different rdocs open for the various libraries I am working with. I also have a dictionary and a thesaurus on hand and have often noticed I reference them more than the rdocs. I've always felt that there is a literary art form to abstraction naming but I have never been able to succinctly state why I felt this was so important. It existed as a strong intuition, something I knew was worth focusing on.

Ruby Hacknight to the Rescue

In order to prepare for the next Ruby Hacknight I have been reading Refactoring, Ruby Ed. and recently came across this quote which states precisely why proper naming is important.

So much of object-oriented design depends on the effectiveness of the abstractions that you create. Let’s say you have object A that delegates to object B, which in turn delegates to object C. It is much easier to understand the algorithm if each object can be synthesized in isolation by the reader. To provide for this, the clarity of the public interface of the object being delegated to is important. If object B’s public interface represents a cohesive piece of behavior with a well-named class, well- named methods, and parameter lists that make sense given the name of the method, a reader is less likely to have to delve into the details of object B to understand object A. Without this clear abstraction around the behavior of object B, the reader will have to move back and forth between object A and object B (and perhaps object C as well), and understanding of the algorithm will be much more difficult.

Fields, Jay, Shane Harvie, Martin Fowler and Kent Beck. Refactoring. Ruby ed. Upper Saddle River: Addison-Wesley, 2010.