Chapter 10. 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 safely lets us change our minds.

There are tools we can use to help us decide how our objects should work together, namely, design patterns and CRC cards (see www.c2.com/cgi/wiki?CrcCards).

Refactorings are often reversible, and they may trade off between two good things. A nice example of this is Message Chains 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.

Smells Covered

  • Feature Envy

  • Inappropriate Intimacy (General Form)

  • Message Chains

  • Middle Man

Feature Envy

Symptoms

  • A method ...

Get Refactoring Workbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.