Skip to content

Instantly share code, notes, and snippets.

@nthx
Created January 11, 2012 14:45
Show Gist options
  • Select an option

  • Save nthx/1594970 to your computer and use it in GitHub Desktop.

Select an option

Save nthx/1594970 to your computer and use it in GitHub Desktop.
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