News for hackers. Stuff that matters.
Re:Don't DRY Your Code Prematurely by klyrs on Thursday May 30, 2024 @07:55PM (#40530091)
> Sometimes it's best to be DRY right from the start.

Never zealously adopt a programming practice that can be summarized in a headline!

Re:Don't DRY Your Code Prematurely by OJFord on Thursday May 30, 2024 @08:02PM (#40530147)
Yeah, don't be DRY from the start, YAGNI.
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).