Chapter 12. Responsibility
It’s hard to get the right balance of responsibility between objects. One of the beauties of refactoring is that it lets us experiment with different ideas in a way that lets us safely change our minds.
There are tools we can use to help us decide how our objects should work together, such as design patterns and CRC cards (see “A Laboratory for Teaching Object-Oriented Thinking” [5]).
Refactorings are often reversible, and they may trade off between two good things. A good example of this is Message Chain versus Middle Man. Sometimes there’s a way to improve both smells at the same time, but many times it’s a balancing act between them.
In this chapter we’ll cover the following smells:
• Feature Envy, in which an ...
Get Refactoring in Ruby now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.