Skip to main content
13 events
when toggle format what by license comment
Apr 9, 2019 at 16:29 comment added John Dvorak @CodesInChaos you should be able to abstract that into a function that takes a callback argument. Ruby does that with file handles - if you pass a function to the opening routine, it calls that function and then closes the file for you.
Apr 17, 2014 at 15:03 history edited niahoo CC BY-SA 3.0
typo
Feb 18, 2013 at 17:17 comment added CodesInChaos I cut&paste withing a project all the time to move code around. Copy&paste is rarer but still happens occasionally. In most cases I change the code directly after copying, because the desired expression is similar but not identical.
Feb 11, 2012 at 10:44 comment added user1249 "From one project to another": You need to resist temptation to move common code into utility projects where they will live for ever, until you are absolutely certain you will use it a lot and you have gotten the API right. A few iterations through projects will help, without you having to be 100% backward compatible.
Feb 7, 2011 at 14:54 history made wiki Post Made Community Wiki
Feb 7, 2011 at 13:50 comment added jzd @Chris, good point, I edited the answer to clarify that exceptions can exist in the second case.
Feb 7, 2011 at 13:49 history edited jzd CC BY-SA 2.5
Added in comments about exceptions to second case.
Jan 16, 2011 at 15:28 comment added Chris @Loren Pechtel: Nonetheless it still involves the act of copying and pasting code.
Jan 16, 2011 at 4:17 comment added Loren Pechtel @Chris: Copy and modify the heart of it is very different than simply pasting it as is.
Jan 15, 2011 at 16:10 comment added Chris When writing database code, I usually cut and paste some of it into a new function and modify the sql itself to obtain desired result and need not concern myself with re-typing some of the prerequisites to make said database calls. Although in general I agree with both remarks.
Jan 15, 2011 at 7:11 comment added John MacIntyre +1 Yeah, I've done both these things. I haven't done cut & pasted code from within the same project for a heck of a long time (although I'll confess to rarely doing it under extreme pressure with logged bug to comeback to it). As for utility classes, my project to project copying is now isolated to copying complete files.
Jan 15, 2011 at 0:15 comment added Rob Perkins Generally this is true, unless you're writing code which requires anti-patterns, as might be the case with antitampering code, such as for software licensing.
Jan 14, 2011 at 23:27 history answered jzd CC BY-SA 2.5