This strategy is useful when you have code that is easy to test sandwiched in the middle of hard-to-test code.
These are some steps you can follow in a ‘extract function’ refactoring. What order should you do the steps in? Re-order them in your own copy of the list.
This picture visualizes the Peel strategy:
The function you’re trying to test begins and/or ends with a line that is difficult to test. You want to peel that part away to get to the testable middle. Use an ‘Extract Function’
One way to solve TirePressure is using Peel. You can also do it on ‘getScore’ in IceCreamScores
When should you use the ‘peel’ strategy? Are there any disadvantages to using it?