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