Simple Design
To Kent Beck, a design is “simple” if it follows these rules:
- Runs all the tests
- Expresses the intent of the programmer
- Contains no duplication
- Minimizes the number of classes and methods.
The code must work. The code must pass all the tests. After the code is made to work, it should be made expressive. It should reveal the intention of the programmer.
Duplication is the primary enemy of a well-designed system. After we have made the code as descriptive and expressive as possible, we hunt for and remove any duplication within that code. Move an extracted method to another class. That elevates its visibility.
Decrease the number of structural elements, such as classes, functions, variables, etc. The goal of Simple Design is to keep the design weight of the code as small as practicable.
Pass all the tests. Reveal the intent. Remove duplication. Decrease elements.[¹]
–
[¹]: Robert Martin(2019): (Clean Agile: Back to Basics (Robert C. Martin Series))