Coding Horror, almost two years back, christened a name for the principle variously known as “don’t repeat yourself,” “once and only once,” etc.: Curly’s Law. Excellent formulation of the principle. In sending this to my development team, I thought it would be useful to pull this from the abstract to the specific through a few questions:
- Can you identify something in our programming (any project we’ve worked on) that violates “Curly’s Law”?
- Can you think of one or more design patterns that we are using that have helped us to “obey” this principle?
- Do you think that following this principle will actually make you a better
programmer; put another way, do you think that following this principle will
actually result in code that… (if not, why not?)
- Has fewer defects
- Is easier to maintain
- Has better performance