Methods that have a single responsibility confer the following benefits:
• Expose previously hidden qualities Refactoring a class so that all of its methods have a single responsibility has a clarifying effect on the class. Even if you do not intend to reorganize the methods into other classes today, having each of them serve a single purpose makes the set of things the class does more obvious.
• Avoid the need for comments How many times have you seen a comment that is out of date? Because comments are not executable, they are merely a form of decaying documentation. If a bit of code inside a method needs a ...
- Chapter 2. Designing Classes with a Single Responsibility
- from Practical Object-Oriented Design in Ruby: An Agile Primer
- Publisher: Addison-Wesley Professional
- Released: September 2012
Benefits of designing methods with single responsibilities
Share this highlighthttp://www.safaribooksonline.com/a/practical-object-oriented-design/3507/