Skip to main content
Notice removed Comments only by CommunityBot
Post Unlocked by CommunityBot
Notice added Comments only by ChrisF
Post Locked by ChrisF
edited tags
Link
Thomas Owens
  • 84.2k
  • 18
  • 206
  • 302
Tweeted twitter.com/#!/StackProgrammer/status/106209312304668672
Source Link
Incognito
  • 3.5k
  • 2
  • 27
  • 38

Why is DRY important?

Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks?

I'm unlikely to need to edit this again any time soon.

It looks like a lot of less work to just go...

function doStuff1(){/*.a.*/}
function doStuff2(){/*.b.*/}
function doStuff3(){/*.c.*/}

And if I ever need to add something...

function doStuff4(){/*.d.*/}

And if I need to remove it, I remove it.

It's harder to figure out how to make all of those into one straight-forward pattern that I can just feed data into and deal with all the cases, and make a bunch of changes I don't feel like I'm ever going to have to do.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?