Skip to content

Instantly share code, notes, and snippets.

@ericroberts
Last active August 29, 2015 14:01
Show Gist options
  • Save ericroberts/1c0e2804c58f0a458568 to your computer and use it in GitHub Desktop.
Save ericroberts/1c0e2804c58f0a458568 to your computer and use it in GitHub Desktop.
Conditionals are Code Smells: Programming Without "If"

Conditionals are Code Smells: Programming Without "If"

If/then/else is one of the first things a new programmer learns. But, like any tool, it can be overused. Too much conditional logic makes your methods hard to understand and reason about. What if we started thinking about our code differently? What if we started telling our code what to do instead of asking it what it can do? This talk will go through a real refactoring from a method with more than 30 if/then/else statements to a solution with no conditional logic whatsoever.

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