David Crow posts an article about
Simplicity Rules . I like number
10:
Simplicity is about subtracting the obvious, while adding the
meaningful
It reminds me of removing obvious comments from code and
refactoring code to make it meaningful and self-documenting.
Here are Kent Beck's criteria for evaluating the simplicity:
- Appropriate for the intended audience : No matter how elegant a solution is, if the people who need to work with it don't understand it, it isn't simple for them. Do the simplest thing that works for the audience.
- Communicative : Every idea that needs to be communicated should be represented in the solution. The code should express the programmer's intentions and should communicate to the readers.
- Factored : Do something once and only once. There should be no duplication. Duplication of logic or structure makes code hard to understand and modify.
- Minimal : Working within the above 3 constraints, the solution should have the fewest elements possible. If you ain't gonna need it [YAGNI], don't do it. Fewer elements means less to test, document, and communicate.