Hacker News new | ask | show | jobs
by goblin89 4403 days ago
IMO, as it often turns out to be, whether or not the code is copied and pasted doesn't matter by itself.

A competent programmer borrowing code would likely factor it in in a way that won't present maintenance burden later on, and first of all would know when borrowing is appropriate. An incompetent programmer may produce problematic code even regardless of whether it's borrowed or original.

(Though I'd agree that incompetent programmer borrowing chunks of code from different sources without thinking is ‘worse’ than same programmer just writing bad code by himself—more predictability in the latter case.)

In my case, I regularly see borrowed code in projects that I maintain. As long as it's contained in an isolated module, documented (unless it's short and obvious) and used appropriately, I don't see a problem.

Interestingly, front-end code I work on seems to suffer from much worse-quality borrowing—it's like Python people lose all their discipline once they turn to JavaScript.

1 comments

Agreed. I do actually copypaste code in some very specific scenarios. For instance, writing a string capitalization function for Javascript and not needing a whole string processing library.

Sure, you copy paste a line of code after inspecting it, and save yourself some half hour of time on a piece of code that is not core to the problem you're solving.

But I have never seen a programmer who says "I am in the business of getting shit done, so I copy paste code" to produce good code. Anecdotal evidence and whatnot, and my argument could be a bit of a strawman, but this is the sort of canary in a gold mine that I've found.

When a developer on my team says "I just want to get shit done", is when I start preparing for a lot of internal screaming down the line. Happens every single time. Every. Single. Time.

So no, while copy-pasting on its own is not the problem, it is a good symptom to look for.

I actually had someone bitch me out on StackOverflow for having an answer that wasn't useful to him, and it was slowing down his "above-industry average productivity rate". I had a damn good laugh about that one.