Don’t Don’t Repeat Yourself
Summary
- “Don’t repeat yourself” (DRY) is a widely accepted programming principle, but it has several limitations
- An alternative derivation of DRY is presented, that aims to alleviate some of these limitations
- Programs are made up of functions, and to make functions maximally reusable they should:
- Have the most lenient preconditions
- Have the most strict postconditions
- Perform the smallest amount of non-trivial work
If you think this article is too long, you can skip to Should I refactor my code…