Day in and Day out, Rajesh was writing code. He was hard working, so he wrote code all the time. But whenever his manager asks him to change some functionality, he takes a long time. Manager becomes frustrated because he was not getting the output fast enough. As days passed by, outputs became that much longer and the quality also reduced. Rajesh was also frustrated. He was always hard working, but had to work more and more harder as days passed by even to make small changes. What was the reason? Rajesh’s friend Vaibav came to help. He found that Rajesh was not reusing the code that he wrote earlier, thereby duplicating code across the project. Over a period of time, maintenance became difficult for Rajesh. Then Vaibav suggested “Rajesh, always follow the DRY principle“. Rajesh didn’t know what it was. Vaibav suggested “Don’t Repeat Yourself 🙂 Always try to reuse code you or someone wrote earlier, because if you don’t, it is a waste of time for everyone”
MORAL: DON’T REPEAT YOURSELF.