News for hackers. Stuff that matters.
Re:Hang your code out to DRY by gfunk911 on Wednesday January 12, 2022 @10:46AM (#29907976)
Exactly. I find it helps to also state that it doesn't mean "Don't Repeat Characters"
Re:Hang your code out to DRY by dllthomas on Wednesday January 12, 2022 @11:49AM (#29909258)
I've pointed out in the past that if the characters you're deduplicating don't actually have the same meaning, you're just compressing your code; I've been trying to popularize labelling that kind of aggressive misapplication of DRY "Huffman coding".
Re:Hang your code out to DRY by cogman10 on Wednesday January 12, 2022 @12:07PM (#29909563)
It's because you are using the wrong term that it's not caught on. Obviously this is run length coding or maybe LZ coding ;).
Re:Hang your code out to DRY by marcosdumay on Wednesday January 12, 2022 @03:13PM (#29912136)
On the other hand, if you keep repeating the same character sequence there is probably some structure on your code that you can also abstract away. You are not restricted to factoring business concepts.
Re:Hang your code out to DRY by dllthomas on Wednesday January 12, 2022 @03:53PM (#29912514)
There's clearly structure you can abstract away; doing so may be convenient, and that convenience may even make it a good idea. I contend, though, that if it does not represent a "piece of knowledge" that you're factoring out then you are dealing with concerns other than "DRY".

I do agree that a piece of knowledge may not be a business concept.