News for hackers. Stuff that matters.
Re:Don't DRY Your Code Prematurely by barfbagginus on Friday May 31, 2024 @02:10PM (#40538474)
I feel like the "sometimes" suggests that in most cases we should zealously not dry things, but in some cases we might want to. Doesn't that make you curious what cases those might be?
Re:Don't DRY Your Code Prematurely by klyrs on Friday May 31, 2024 @02:52PM (#40538924)
> Doesn't that make you curious what cases those might be?

I've been programming for nigh on 40 years; I'm not terribly curious because I've seen successes and failures of pretty much every development paradigm firsthand. But since you ask, my comment above was a self-referential whimsicalism.

I DRY my code in phases. A rule of 3 is decent (e.g., if you've copied a chunk of code three times, give it a think; if you've copied it 9 times, give it a good hard stare).