More Challenges


EXERCISE 7 Smells and Refactorings.

Consider these smells:

  1. Comments

  2. Large Class

  3. Long Method

  4. Long Parameter List

For each refactoring in the following list, write the letter for the smell(s) it might help cure:

___ Duplicate Observed Data

___ Extract Class

___ Extract Interface

___ Extract Method

___ Extract Subclass

___ Introduce Assertion

___ Introduce Parameter Object

___ Preserve Whole Object

___ Rename Method

___ Replace Parameter with Method

See Appendix A for solutions.

See Appendix A for solutions.

EXERCISE 8

Triggers.

Consider the smells described in this chapter (Comments, Large Class, Long Method, Long Parameter List).

  1. Which of these do you find most often? Which do you create most often?

  2. To stop children from sucking their thumbs, some parents put a bad-tasting or spicy solution on the child's thumb. This serves as a trigger that reminds the child not to do that. What triggers can you give yourself to help you recognize when you're just beginning to create one of these smells?

See Appendix A for solutions.




Refactoring Workbook
Refactoring Workbook
ISBN: 0321109295
EAN: 2147483647
Year: 2003
Pages: 146

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net