Re:Don't DRY Your Code Prematurely
by Stratoscope on Saturday June 01, 2024 @07:36AM
(#40544857)
That is a great insight.
As always, "You don't know what you don't know."
One time the guy who wrote the original code asked, "Why do they have towers at airports? Aren't the controllers down underground looking at radar screens?"
It took two of us who were pilots to convince him that yes, the tower is up there so the controllers can see the airplanes with their own eyes. And yes, they are provided with binoculars.
We all form mental models of the world around us. The best we can hope for is to update those models as we receive new information.
If you do what this guy did and are wrong, it looks like yes obviously it was the same thing and you should have DRY right from the start.
If you DRY from the start and are wrong, someone writes a blog post about not DRYing from the start.
It's a bet on which mistake is worse, because you will be wrong sometimes. DRYing from the start IMO is a worse mistake than duplication.