Hacker News new | ask | show | jobs
by Spoom 4400 days ago
Sometimes copy paste is unavoidable, but a lot of times it can be replaced with a loop over a constructed array of "things that change" that achieves the same goal. I've been trying to do this recently in the spirit of DRY; it has the side benefit of often making the code quite a bit more readable.
2 comments

Yes, and sometimes you want to loop over something that can't be expressed with existing syntax. That's the benefit of Lisp-style macros: http://www.paulgraham.com/avg.html
I find it ironic that we use programming editors that are extremely good at copy-pasting (vi, emacs for instance) only to avoid using those features because we know they are somewhat evil (introduce those kind of bugs, "prevent" proper factoring).