Created
January 11, 2012 14:45
-
-
Save nthx/1594970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RunningABikeUseCase | |
| def execute(player) | |
| player.wakeUpAndRide #looks nice to read, but hides important | |
| player.rest #detail on what "wakeUpAndRide" really is | |
| end | |
| end | |
| class RunningABikeAndFailingUseCase | |
| def execute(player) | |
| player.wakeUpAndRide | |
| player.crashIntoTree | |
| someone.help(player) | |
| end | |
| end | |
| class RunningABikeAndHydrating | |
| def execute(player) | |
| #player.wakeUpAndRide -- cant be used as it does bit different thing.. | |
| player.wakeUpAndHydrateAndRide | |
| player.rest | |
| end | |
| end | |
| #why must I define those.. | |
| #it's too early.. | |
| #it's hard to tell if those fns should yet exist, and in this shape.. | |
| #I'd stay with former example and | |
| #not try to extract a duplication so hard | |
| def _wakeUpAndGetTheBike | |
| player.wakeUp | |
| player.getTheBike | |
| end | |
| def wakeUpAndRide | |
| player._wakeUpAndGetTheBike | |
| player.ride | |
| end | |
| def wakeUpAndHydrateAndRide | |
| player._wakeUpAndGetTheBike | |
| player.hydrateFirst | |
| player.ride | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment