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

6c08c67898c066cb61225eeb965275e6?s=128

Claudio Altamura

December 21, 2021
Tweet

More Decks by Claudio Altamura

Other Decks in Programming

Transcript

  1. Four Design Rules Four Design Rules

  2. Four Design Rules • Java, Microservices, Cloud • @AltamuraClaudio •

    claudioaltamura Claudio Altamura
  3. Claudio Altamura Four Design Rules Kent Becks Design Rules •

    Passes the tests • Reveals intention • No duplication • Fewest elements
  4. 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
  5. Claudio Altamura Four Design Rules What is a good design?

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

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

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

    SPOT • everything should be said once • leads to a good design • minimize coupling
  9. 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
  10. Claudio Altamura Four Design Rules Priority Reveals Intention Priority No

    Duplication Passes the Tests Fewest Elements
  11. 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