Skip to content

Emergence

Getting Clean via Emergent Design

According to Kent, a design is “simple” if it follows these rules:

  • Runs all the tests
  • Contains no duplication
  • Expresses the intent of the programmer
  • Minimizes the number of classes and methods
  • The rules are given in order of importance.

    Simple Design Rule 1: Runs All the Tests

    Simple Design Rules 2–4: Refactoring

    The fact that we have these tests eliminates the fear that cleaning up the code will break it!

    During the refactoring ,We can increase cohesion, decrease coupling, separate concerns, modularize system concerns, shrink our functions and classes, choose better names, and so on.

    the final three rules of simple design: Eliminate duplication, ensure expressiveness, and minimize the number of classes and methods.

    Avoid Duplication

    Expressive: express your intent with code.

    Minimal Classes and Methods :write classes and methods as small as possible .