| ▲ | trey-jones 5 hours ago | ||||||||||||||||
DRY is not to avoid writing code (of any amount). DRY is a maintainability feature. "Unless you're very familiar with the code" you probably won't remember that you have to make this change in two places instead of one. DRY makes life easier for future you, and anyone else unfortunate to encounter (y)our mess. | |||||||||||||||||
| ▲ | bluGill 4 hours ago | parent | next [-] | ||||||||||||||||
You are confusing DRY done as intended vs what DRY looks like in the real world to many people. | |||||||||||||||||
| |||||||||||||||||
| ▲ | colechristensen 4 hours ago | parent | prev [-] | ||||||||||||||||
Making maintainable code is a good goal. DRY is one step removed from that goal and people use it to make very unmaintainable code because they confuse any repeated code with unmaintainability. (or their theory that some day we might want to repeat this code so we might as well pre-DRY it) The result is often a horrendous complex mess. Imagine a cookbook with a cookie recipe that resided on 47 different pages (40 of which were pointers on where to find other pointers on where to find other pointers on where to find a step) in attempts to never write the same step twice in the whole book or your planned sequels in a 20 volume set. | |||||||||||||||||
| |||||||||||||||||