Skip to content

Instantly share code, notes, and snippets.

@LNA
Last active August 29, 2015 14:18
Show Gist options
  • Save LNA/6451ee3251b6244ecfb7 to your computer and use it in GitHub Desktop.
Save LNA/6451ee3251b6244ecfb7 to your computer and use it in GitHub Desktop.
SOLID For #CodeNewbie
# Method should do just one thing at a time
# How can we flag methods that are doing more than one thing?
# Words like and & or should never be in a method. These words indicate that
# the method is doing more than one thing.
# bad
def bake_and_eat(cookies)
cookies.bake
cookies.eat
end
# good
def bake(cookies)
cookies.bake
end
def eat(cookies)
cookies.eat
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment