Last active
August 29, 2015 14:18
-
-
Save LNA/6451ee3251b6244ecfb7 to your computer and use it in GitHub Desktop.
SOLID For #CodeNewbie
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
# 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