📎 Webclip
Simple Design
Simple Design is presented as a priority order for code. First, code should pass all tests. After that, it should express the author’s ideas clearly enough for future developers to understand it.
The text treats duplication and small size as lower-priority concerns. DRY applies only when it does not break working code or readability, and reducing classes, methods, and modules comes last if the first three rules are already satisfied.
Reading notes#
- Kent Beck’s four rules are also called The Four Commandments or the XP Simplicity Rules.
- The highest priority is that the code works, which XP developers verify through automated unit tests.
- Code should be clear, consistent, and expressive so future developers can understand the author’s intent.
- DRY is described as the third rule, but it can be set aside if it would harm working code or clarity.
- Minimizing classes, methods, and modules is the lowest-priority rule and should only be pursued after the first three are met.
- JB Rainsberger offers a similar view with the four elements of simple design.
