+ 4

What does DRY mean to Programmers???

Programming Terms

7th Sep 2019, 4:33 PM
Basman
Basman - avatar
8 Answers
7th Sep 2019, 4:53 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
+ 6
Repeating a code is quite problematic. Here's why - We ll have to write more code obviously, but this is not the main problem. - Main problem is maintaining those codes. Suppose we have to make some change then we ll have to apply that change on all the repeated places. It's a big headache. That's why programmers sometimes goes to great lengths to keep it DRY using various complicated design patterns. I have a simple example here to demonstrate the benefits of keeping it DRY. In this code we can clearly see DRY is missing and same function is repeated, hence the long code & painful future efforts to add colour. https://code.sololearn.com/WFc1NNwxG2q8/?ref=app But a refactoring attempt with DRY in mind can greatly reduce the effort ( future efforts too). https://code.sololearn.com/WJPh1bqz0VFd/?ref=app Ending Notes: Although writing DRY codes might look easy but it ll come with practice , study, knowledge of language & design patterns. DRY principle is applicable to all programming languages
8th Sep 2019, 7:13 AM
Morpheus
Morpheus - avatar
+ 4
Even the simple use of functions/methods is an example of DRY I believe.
9th Sep 2019, 5:51 AM
Sonic
Sonic - avatar
+ 2
It's for all languages
8th Sep 2019, 7:55 PM
Š’Š°Š“ŠøŠ¼ Š©ŃƒŠŗŠøŠ½
Š’Š°Š“ŠøŠ¼ Š©ŃƒŠŗŠøŠ½ - avatar
0
not wet
9th Sep 2019, 2:57 AM
slick
slick - avatar
- 1
Don't repeat yourself: used to help programmers save on memory by not writing the same code over and over
9th Sep 2019, 10:48 AM
Da Ven
Da Ven - avatar