News for hackers. Stuff that matters.
Re:I hate cut-and-paste by robomc on Monday October 24, 2011 @06:46AM (#3149017)
Worth noting though that this can go too far the other way. I've definitely written things where, in my refusal to repeat myself, I've made a hard-to-read mess.

Here's an example from when I was very first starting out with ruby:

http://pastie.org/2749772

This is a pretty hard to read piece of code, despite my rambling comments. All done to avoid copying and pasting the same easy-to-follow method ~10 times.

Re:I hate cut-and-paste by yxhuvud on Monday October 24, 2011 @03:29PM (#3151158)
But the problem with this code isn't that there is too little duplication! The trouble wass that your grasp of the language wasn't that good and didn't have any idea of how to organize the code.
Re:I hate cut-and-paste by robomc on Monday October 24, 2011 @11:43PM (#3152735)
So, would you have solved it by a more readable form of metaprogramming? Seems to me it's either that, or copypasta.

(Could still be me being a noob, but I can't see some other architectural means of avoiding a choice between either duplication or tricky-to-read metaprogramming in that case.)