4 ms·
The OS/SDK/Browser/Protocol/Firmware which you used to type this comment is a compiled copy/paste of a zillion lines of code, of which you probably typed none.
by bikamonki 11y ago
The OS/SDK/Browser/Protocol/Firmware which you used to type this comment is a compiled copy/paste of a zillion lines of code, of which you probably typed none.
If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. Now, if a programmer decides whether or not study and understand the pasted code has nothing to do with the quality of the final product.
Furthermore, IDEs by design encourage copy/pasting to speed development, most offer functionality to store code snippets. In that sense SO is like a web extension of IDEs.
- jnardiello 11y ago> Now, if a programmer decides whether or not study and understand the pasted code has nothing to do with the quality of the final product. I deeply disagree with this and for such obvious reasons.
- deleted 11y ago[deleted]
- bikamonki 11y agoWhy? A widely accepted answer(many points) is most likely correct/best practice/bug-free.
- pavel_lishin 11y agoIt may be bug-free, but it may not be the correct solution for the specific problem the programmer was trying to solve. It may also not do what is expected under different circumstances. It may be a hammer when you're looking for a screwdriver.
- OliverJones 11y agoThis is like the car mechanic who goes to the used-parts dealer (the junkyard) and grabs the first part with the same size screw holes as the broken part.
- oldmanjay 11y agoAll I can say in response is I sincerely hope we never end up working together
- bikamonki 11y agoDon't worry: we won't. You, me and the rest of us are going obsolete ;)
- ehnto 11y agoI disagree that they encourage copy and pasting, what they really encourage is auto completion of well structured code. Even if you find yourself copy and pasting your -own- written code, you should question why you're having to do that. Is what you're doing perhaps better abstracted to somewhere else? Be that in an abstract class, a helper class, or even in a separate library from which you can reuse it. IDEs excel in understanding your code, which helps finding where you've stored something and allows auto-completing access to it, which is almost definitely their most important strength.
- lmm 11y ago> If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. No, it's the opposite. The whole point of DRY is you don't copy/paste, you put the thing in a common place and have references to it. Many SO answers are good enough to be libraries. But they should be libraries, not snippets that are copied and pasted. Fortunately we're moving in that direction - our library infrastructure is becoming good enough that it's worth releasing even small pieces of code as reusable libraries, and people are.
- drdeca 11y agoI'm not sure how linking (as part of compiling) works. I thought how it worked was by copying the compliled thing from other files into the same executable. Is this not the case?
- lmm 11y agoOld-school static linking works like that. Dynamic linking no, though I guess you could argue it's copied in memory at runtime. But even if there's copying going on at the implementation level, it's an important conceptual distinction to make.