Skip to content

Instantly share code, notes, and snippets.

@xplayer
Created July 3, 2014 15:55
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xplayer/aff5d74fb913401f0708 to your computer and use it in GitHub Desktop.

#Functions ##Functions should be small Four to six lines long

  • "A long function is where the classes go to hide"

##Functions should do only one thing

  • "if a function manipulate more than one level of abstraction, it's clearly doing more than one thing"
  • "in order for a function to do one thing, it must not cross level of abstraction"

###Extract 'till you drop! But level of abstractions are fuzzy... is there a deterministic way to decide if a function is doing more than one thing? Extract 'till you drop!

"If you can extract one function from another, this means that the original function was doing more than one thing by definition"

"I look at braces as an opportunity to extract!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment