Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Writing testable code

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Writing testable code

Avatar for Rodrigo Boniatti

Rodrigo Boniatti

November 30, 2019

More Decks by Rodrigo Boniatti

Other Decks in Programming

Transcript

  1. Conditionals • Smell: • High cyclomatic complexity score; • How

    to solve? • Replace Conditional with Polymorphism;
  2. Life cycle events • Smell: • Hide code behavior; •

    No execution order; • How to solve? • Single flow;
  3. Principles of testing • Test in isolation; • A lot

    of setup == smell; • Hard to test == smell;