Created
July 27, 2011 20:26
-
-
Save nicholasjhenry/1110289 to your computer and use it in GitHub Desktop.
Sandi Metz - Less - The Path to Better Design
This file contains 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
# Sandi Metz - Less - The Path to Better Design | |
# http://vimeo.com/26330100 | |
# http://less-goruco.heroku.com/ | |
# | |
# Abstractions are more stable than concretions. | |
class Trip | |
attr_reader :bicycles, :customers, :vehicle | |
def prepare(preparers) | |
preparers.each {|preparer| preparer.prepare_trip(self)} | |
end | |
end | |
class Mechanic | |
def prepare_trip(trip) | |
trip.bicycles.each {|bicycle| prepare_bicycle(bicycle)} | |
end | |
end | |
class TripCoordinator | |
def prepare_trip(trip) | |
buy_food(trip.customers) | |
end | |
end | |
class Driver | |
def prepare_trip(trip) | |
vehicle = trip.vehicle | |
gas_up(vehicle) | |
fill_water_tank(vehicle) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing!