For the Copy and Paste Programmers

One of the things that has been absolutely fantastic about the web is how much information we can publish and how much we can access it at any given time. I don’t know many who would disagree with that.

Even more so, for those who are interested in learning how to write software, there are various articles, podcasts, videos, tutorials, and so on all of which aim to teach a person the skills they need in order to actually get from not knowing how to write code, but knowing how to do so in a productive manner.

One of the downsides of this – and even more generally, open source – is that breeds this copy-and-paste mentality that completely undermines the very thing that it’s trying to teach: that is, how to write code.

Copy and Paste Programmers

This Paste. This isn't programming.
This Paste. This isn’t programming.

I think that anyone who has been programming for an extended amount of time knows that writing code – or software development – is ultimately about problem-solving.

The tools, languages, platforms, and all of that jazz transcend what it is that’s being done in order to solve a problem that either has yet to be solved in an academic sense, or that aims to solve a problem for someone else.

Whatever the case may be, one of the problems that comes with such wide information is that people will use-and-abuse it. To be clear, this is not a call to shut down QA sites, stop tutorials, or stop bloggers who share that kind of information, but is is a critique of those who take advantage of the system in order to “better” themselves when, in reality, ultimately hurt themselves and give professional developers a bad reputation.

1. Disrespect

When a person opts to copy and paste the solution to a problem that another person has provided without actually taking time to understand the problem at hand, it disrespects the time and effort others have put into learned the given system’s API.

This is not to say that using libraries, third-party tools, or sharing code is bad. On the contrary, really. This is about those who would rather right-click-copy and right-click-paste into their IDE without actually understanding what’s going on with the code.

2. Undermining

I think that most people who end up falling onto this slippery slope genuinely want to know how to write code, but it’s an intimidating thing to do, isn’t it? On top of that, it takes a long time to learn.

Regardless, when it comes to copy and pasting, you’re undermining your own ability to learn. Why not try to understand what the code is doing? Why not try to write it yourself? Study it, trace it, try to understand it, and – at the very least – ask a question as to how it works the way that it does.

Otherwise, you’re undermining your own ability to learn and to learn the very things that you might otherwise be able to turn into a profession.

3. Problem Solving

It’s already been said that so much of programming – or development – is really about problem solving, but if you’re in the habit of copy and pasting other people’s code into some type of workable solution for another person, you’re not problem solving.

You’re stitching together someone else’s solution and passing it off as your own.

Why do that? With things are the way they are right now, you have the resources and the ability to learn how to do this. Yes, it takes time, and yes it can be challenging, and yes it’s likely a never ending journey (ask anyone who’s a programmer right now), but the the thing is that you eventually find yourself at a place where you’re able to understand a problem and provide a solution.

Copy and pasting cannot do that.

Not About the Sites

I place no fault or blame on sites and services like this. After all, I’m all for educating other people in whatever way they learn best, and if we’re able to educate one another is proper ways to go about writing code or building software, then why not?

For whatever it’s worth, I love the plethora of sites and services that we have right now. I know it helps thousand and thousands of people educate themselves.

Instead, the people who spend more time browsing QA sites, tutorial sites, and open source repositories for the sake of trying to piecemeal a product of your own together without really understanding what it is that you’re doing hurts you, but also damages your credibility, and prevents you from being the type of programmer that you actually want to do.y

24 Replies to “For the Copy and Paste Programmers”

  1. What surprises me, is the number of people who will just willy nilly drop large chunks of code and libraries into their own projects, without even bothering to read through it line by line. The first thing I do, is to check everything for quailty, in particular checking for performance and security problems. Not doing this is how problems like the TimThumb debacle came into being. As soon as I saw the code, I realised it was weird, so never used it. Those who jump dump the code in and use it never noticed that it had problems.

    1. What surprises me, is the number of people who will just willy nilly drop large chunks of code and libraries into their own projects, without even bothering to read through it line by line.

      This. This is exactly what I’m talking about. Not only does it cheat the person out of understanding and becoming a better developer, it potential introduces side effects in the code that you’d didn’t know even exist.

      The first thing I do, is to check everything for quailty, in particular checking for performance and security problems.

      Agreed.

  2. We all go looking for code snippets to solve tricky problems, and hopefully they lead to aha! moments that make you better as a developer.

    I’ve always been a little paranoid about using large code chunks or libraries. They are more problematic to quality check and test. The feeling that I didn’t write it or it doesn’t have a large user-tested community involved in it, makes me a bit uneasy. And so it should. I guess the reason that it doesn’t make copy & paste “programmers” uneasy is because they aren’t really programmers; programmers who jealously guard the integrity of their code and are jealous of their reputations, or afraid of a lawsuit.

    The dead giveaway is always: “Where do I paste this code?”

    1. We all go looking for code snippets to solve tricky problems, and hopefully they lead to aha! moments that make you better as a developer.

      That’s the key!

      There’s nothing inherently wrong with copy and pasting, but it’s the lack of interest in learning from what someone else has does.

  3. When I have a specific problem I need to solve and I’d like to see how others approach it, my favourite thing to do is dig into the source code of some open source plugin or theme by a programmer whose work I respect. It’s a phenomenal way to learn. It is of course far more challenging than just hitting Google with a search phrase, but it forces you to understand what you’re reading. And most of the time, I come away with more than just the answer to my question.

    1. my favourite thing to do is dig into the source code of some open source plugin or theme by a programmer whose work I respect. It’s a phenomenal way to learn.

      Agreed! It even prompts one to ask questions as to why they opted to do one thing versus the other.

      And most of the time, I come away with more than just the answer to my question.

      And it’s a beautiful thing, isn’t it?

  4. Goodness, so us vs. them :) “Thank you Lord that I am not like them, even those who copy and paste …”

    Hey, seeing someone else’s snippet of what I’m trying to do is often how I learn. Or it jogs my memory. Or sparks thought.

    Starting (not ending, starting) with someone else’s code is a great way to learn. And it’s the very essence of open source. Just because you copied it out of a code repository as part of a complete file doesn’t mean that you didn’t copy it, ya know.

    1. Goodness, so us vs. them :) “Thank you Lord that I am not like them, even those who copy and paste …”

      No – it’s not us versus anyone. That was never my intent, and if I came across that way, then that was my fault and I take responsibility for poor writing on that.

      Hey, seeing someone else’s snippet of what I’m trying to do is often how I learn. Or it jogs my memory. Or sparks thought.

      You’re right! The essence of open source is that the code is widely available to all to study, learn, and to progress from there. But that’s not all that everyone does. A lot of people do that and I applaud and respect that.

      There are also people who give it a bad name by looking for the quickest ways to get from A-to-B by copying and pasting the solution having no desire to understand what it is they are doing. If it works, that’s good enough.

      That’s not development.

      Starting (not ending, starting) with someone else’s code is a great way to learn. And it’s the very essence of open source.

      Agreed.

      Just because you copied it out of a code repository as part of a complete file doesn’t mean that you didn’t copy it, ya know.

      Yes. I know. I never claimed that to be the case, though. It’s those that copy, paste, and move on without making any effort to study and understand what’s happening.

      1. You seem to have misunderstood the point Tom was trying to make.

        Probably so. Happens to me often :)

        Basically, I think it’s more of a continuum, than “copy/paste programmers” and “not copy/paste programmers”.

        I suspect that many people begin by pasting together bits that they don’t quite understand, and then they gain degrees of understanding over time. I suspect that route of learning may be even more common than the “lesson 1, lesson 2 …” route.

        I also think there’s a continuum even within the same person in roughly the same point in their career. For example, there are times that you just need to fix what’s broke, now, and you don’t completely understand the fix, but you know enough to know that it isn’t making things worse (and it isn’t phoning home to malware central, etc.).

        And then too there are things as banal as (say) pasting in the document.ready syntax, without keeping all those braces and brackets straight in your head or typing them in from scratch every single time. I don’t think that means you aren’t a programmer. It means you have better things to do with your brain. (Though yes, you should wade through it at least once, to understand what it’s doing. But after that, it’s enough to know that “the stuff between those executes after the document is ready”.)

        If that’s the point being made, then I heartily sign on :) If not, then it’s just an orthogonal point that I am adding to the discussion.

  5. “Copy and Paste Programmers” “are” “absolutely fantastic”

    I made the above comment by copying and pasting parts of your blog post, primarily to use humor to make a point. When people copy and paste code without taking the time to understand the original authors intent, they might come up with something that seemingly “works” on the surface under standard best use case scenarios, but that has consequences that the original author did not intend and that the paster likely didn’t anticipate. Robust code more then “just works” in the best expected use case scenarios, it can recover from and deal with things when they go to hell.

    1. I made the above comment by copying and pasting parts of your blog post, primarily to use humor to make a point.

      I see what you did there! ;P

      When people copy and paste code without taking the time to understand the original authors intent, they might come up with something that seemingly “works” on the surface under standard best use case scenarios, but that has consequences that the original author did not intend and that the paster likely didn’t anticipate.

      Right on – it’s not the act of copying and pasting that’s really the culprit. It’s not taking time to understand what it is that the code that’s been pasted is doing (and even if it can be refactored to be cleaner or leaner).

  6. I have to admit I’m as guilty as the next gal/guy when it comes to instant gratification by copying and pasting to see how something works but I have to admit when it comes to learning about the code manually entering the code is the best path to understanding. I think the very act of actually creating the code is what does the trick IMHO.

  7. I am a Web Developer from 8 years and I have made only projects from scratch. My opinion is that the open source projects has created the copy / paste programmers (because is a framework with the same code) and killed the progress of web development . The prices for creating a website has dropped so low(that I am sorry that I do not choose another business) , because anyone can install a wordpress, joomla,drupal ,prestashop for free. Only large companies can develop their one platforms , not small or medium companies ,because the market for custom projects does not exists anymore, because of the open source projects.

  8. Reusing code without permission an a way that violates it’s license is unethical and by all means, its within your rights to peruse those who would abuse your generosity by borrowing shared code without attribution.
    However, the lesson about cut-and-paste programming really has everything to do with reusing existing code rather than rewriting it, not the other way around. “Cut-and-paste programming”, originates from computer science and it means the reuse of code by copying that code within the same project rather than creating a function, class or module and referring to it by reference. In other words your code with in a single project or system should be DRY – Don’t Repeat Yourself. In modern web development much of this is handled by the design of web browsers , operating system and higher level programming languages.
    It has nothing to do with reusing code between projects or reusing and customizing code snippets, or practicing idiomatic programming all of which, done correctly, are good practices.
    It’s much better to use code through API’s that are designed for that purpose but it’s better to reuse code through copy-and-paste that you know works rather than rewrite similar code.
    When you write fresh code you understand it’s intention but very little about it’s actual performance.
    You can’t reuse code through cut in paste if you don’t understand it’s purpose and function, how to incorporate it with other code. Otherwise what you have is a bug not functioning code.

    The valuable lesson about reusing code in an organized way is an argument that I see misunderstood and then re-appropriated to look down on others, who are operating at a higher level of abstraction and perhaps at a higher level of productivity, at least for their own purposes. While I like to write code, and sometimes can’t avoid the urge to rewrite code by others to fit my styles preferences, I don’t look down on those that reuse code through cut and paste. In many ways it’s the same sort of obnoxiousness where C and Java programmers are condescending toward PHP “scripters”. There is more than enough room for everyone at this party and no one needs to be judgmental of others in order to feel superior.
    One may reasonably read the WordPress Main Loop to better understand the context of theme code but how about also understanding the details of all the code that goes into PHP’s dynamically typing, HTTP protocol, CGI, sockets programming, built in global variables and automatic side effects? Not necessary, but some might wrongly argue that you don’t know what’s really going on with a single line of your PHP code.

    1. Reusing code without permission an a way that violates it’s license is unethical and by all means, its within your rights to peruse those who would abuse your generosity by borrowing shared code without attribution.

      Definitely, though depending on the nature of the discretion, it may be more time than it’s worth to chase it down. Again, though, it completely depends on those involved, the license, and the severity of what’s taken.

      Cut-and-paste programming”, originates from computer science and it means the reuse of code by copying that code within the same project rather than creating a function, class or module and referring to it by reference.

      Yep – I think this is something that anyone who was worked on in-house software with cube-mates or deskmates or whatever will be familiar with; however, with the Internet becoming what it is, I think the term depends on the context in which it’s used.

      Sometimes, you’re going to copy and paste from one place in a codebase to another; other times, it’s from the Internet into whatever it is that you’re working on.

      It has nothing to do with reusing code between projects or reusing and customizing code snippets, or practicing idiomatic programming all of which, done correctly, are good practices.

      I don’t disagree, but the point that I’m trying to make doesn’t even to do with that. It has to do with those who piecemeal together an application by spending more time googling for code, pasting it into an editor without using any real architecture and without really understanding the nature of what they are doing so long as it “works” (where I define that as doing at least what they want it to do).

      As far as saving and reusing routines, I’ve got a big collection of gists (many of which are shared here) that I use in projects because there aren’t always unique problems. Solve it once, do it elegantly, save the code, and reuse it when needed – but understand what the code does.

      It’s much better to use code through API’s that are designed for that purpose but it’s better to reuse code through copy-and-paste that you know works rather than rewrite similar code.

      I agree with “that you know works” but I think that if someone is working to becoming a serious programmer (by profession or hobby – doesn’t batter), then it’s also important to understand how it works.

      And, depending on where you grab the code from, it’s possible that there are better solutions than the ones that just work, but that’s really starting to split hairs at this point, I think :).

      The valuable lesson about reusing code in an organized way is an argument that I see misunderstood and then re-appropriated to look down on others, who are operating at a higher level of abstraction and perhaps at a higher level of productivity, at least for their own purposes.

      If that’s how this article came across, either I did a poor job of communicating my point, or you misunderstood said point (though it’s probably the former).

      I certainly don’t aim to look down at anyone writing code much less try to set myself up to do that. Programming is one of those things that you realize how much you don’t know by learning more an more and learning what others know. I think it’s key to constantly be looking into how others are doing things, understanding how they are doing things, and all that jazz because it helps to improve what it is that you’re doing.

      There is more than enough room for everyone at this party and no one needs to be judgmental of others in order to feel superior.

      Completely agree.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.