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

Primer on the 4 Rules of Simple Design

Marty Haught
September 15, 2016

Primer on the 4 Rules of Simple Design

A short introduction to the 4 Rules of Simple Design given at Boulder Ruby in 2015 and 2016.

Marty Haught

September 15, 2016
Tweet

More Decks by Marty Haught

Other Decks in Technology

Transcript

  1. Origin • Introduced by Kent Beck pre 2000 • via

    Extreme Programming (XP) • Associated with “Do the simplest thing that could possibly work.”
  2. 1. Tests Pass • Need to verify that your code/system

    works • Automated tests are the fastest way to verify
  3. 2. Expresses Intent • Intention revealing • You can quickly

    look at it and know what it does • Not bad naming, unclear or inaccurate • Does the method/variable match the language you use to describe it?
  4. 3. No Duplication • DRY - Don’t Repeat Yourself •

    Commonly thought of as repetition in code structure (lines of code) • Also knowledge duplication • "Every piece of knowledge should have one and only one representation."
  5. 4. Small • No extraneous parts to the code •

    Does everything there have a purpose? • Is it still being used? • Did I extract too far?
  6. Resources • Corey’s Book: http://bit.ly/4rules-boulderruby • XP wiki: http://c2.com/cgi/wiki?XpSimplicityRules •

    JB Rainsberger: http://www.jbrains.ca/permalink/ the-four-elements-of-simple-design