Software Design/Always use the same way to do a thing
Checklist questions:
- When there is more than one way to do a certain task, is the same way used throughout the codebase?
Examples edit
Collections.emptyList()
vs. ImmutableList.of()
in Java.
Why edit
- Consistency
- Easier to refactor
- Performance: less code is used => less code cache misses
Related edit
Sources edit
- Zen of Python