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

Four Design Rules

Four Design Rules

Talk about Kent Becks four Design Rules:

- Passes the tests
- Reveals intention
- No duplication
- Fewest elements

Claudio Altamura

December 21, 2021
Tweet

More Decks by Claudio Altamura

Other Decks in Programming

Transcript

  1. Claudio Altamura Four Design Rules Kent Becks Design Rules •

    Passes the tests • Reveals intention • No duplication • Fewest elements
  2. Claudio Altamura Four Design Rules What's so special about it?

    • easy to remember • improves code in every language • helps to keep the design simple • leads to a good design
  3. Claudio Altamura Four Design Rules What is a good design?

    • high cohesive • loosely coupled • expressive names
  4. Claudio Altamura Four Design Rules Passes the Tests • the

    code must work • tests help to communicate the design • tests make refactoring safe
  5. Claudio Altamura Four Design Rules Reveals Intention • code as

    easy as possible • expresses every idea • meaningful names • brings clarity • maximizes cohesion
  6. Claudio Altamura Four Design Rules No Duplication • DRY •

    SPOT • everything should be said once • leads to a good design • minimize coupling
  7. Claudio Altamura Four Design Rules Fewest Elements • what is

    not useful should be removed • fewest possible classes and methods • don't add code for future requirements • complexity makes code harder to modify
  8. Claudio Altamura Four Design Rules Intention vs Duplication • doesn't

    matter which comes first • both rules help to redefine the code • these rules lead to a simple design • most problems are naming problems