11. Emergence - tuansondinh/clean_code Wiki

11.1 Getting Clean via Emergent Design

  • 4 simple rules for good design, which makes easier to apply principles like SRP and DIP

"1. Runs all the tests

  1. Contains no duplication

  2. Expresses the intent of the programmer

  3. Minimizes the number of classes and methods

The rules are given in order of importance." S.172

11.2 Simple Design Rule 1: Runs All the Test

  • "A system that is comprehensively tested and passes all of its tests all of the time is a testable system." S.172
  • "Systems that aren’t testable aren’t verifiable. Arguably, a system that cannot be verified should never be deployed."
  • tests pushes us to design clean, so we can test easier
  • use of SRP, DIP, dependency injection, interfaces and abstraction -> minimize coupling -> easy to test