Identity Island Blog Identity Island Blog

The Dangers of Copy & Paste Programming

Posted by Zane Harnish under Development


As time goes on, the demands for more advanced functionality in websites rises. Web browsers are becoming more and more powerful as people expect more and more power from them. This can leave web developers in an interesting position. Many have only mastered the art of HTML as well as basic CSS, but when a client is looking for a website with a higher visual appeal or more advanced functionality, that isn’t enough. Learning more advanced CSS is now more important than ever, and jQuery is growing ever more important. Unfortunately, developers don’t have time (or desire) to learn new languages that will only add complexity to their work. This inevitably leads to one thing when certain features are sought after – copy and paste.

In reality, copy and paste is a great thing, especially with the growing availability of open source jQuery and CSS to simply copy and paste right into your code. More and more developers are resorting to such measures in order to build sites that work the way their clients want. What they don’t realize is just how dangerous it is. Now, to be sure, I am not in any way saying that open source code is a bad thing – in fact, used in the right way it is a great resource. The problem is most people aren’t doing things the ‘right’ way. So, what is the right way of doing things? Well, I guess there technically is no one right way, but I do believe there are some guidelines to follow before you ‘ctrl+c’ and ‘ctrl+v’ yourself all the way to a nice new website.

First, I think you need to carefully analyze exactly what it is you need. Is it something too complex for you to build quickly on your own, yet something that is a common enough need that there are available open source plugins that will do the job for you? If so, this is when you should be looking to do some of your best copy and paste work. Far too often, developers look for a way out of any writing any code they don’t have to (bad idea). Just because you can copy and paste doesn’t mean you should. Every site is different, and therefore, the code behind every site will have to be a bit different, so you can’t expect someone else’s code to fit your situation perfectly. One example of overused open source plugins is with responsive design. As it comes into high demand, developers want to be able to design responsive sites without doing extra work. But building a responsive site around a pre-built plugin or frame is like chaining yourself to a wall. It simply doesn’t make sense unless the plugin fits perfectly into what you are trying to build. Which sort of brings me to my next point: plugins will rarely work exactly how you need them to right out of the box.

Just face it, after you copy and paste, there’s some tweaking that will need to be done. This is really where most developers get themselves into trouble. They don’t understand the code that they are putting in their site, they just know it does what they need it to. Maybe this doesn’t seem dangerous to you, but if you ask me, it is one of the worst possible situations to be in. If part of a site you are building runs on code that you have never touched (or you don’t even understand in the first place), you are asking for big trouble. Suppose something goes wrong, or a client needs a slight change to the way the code operates. Now what? You don’t even know how the code does what it does, much less how to make modifications. This is why any time you copy and paste code into your site, you should look over it until you have a solid understanding of what each line of code is doing and why. Even if you don’t know the language it is written in, you should have a good enough knowledge of programming in general to be able to figure it out. If you don’t, start learning now, because web development is only becoming more code-intensive.

So, in the right situation, copy and paste can save a lot of time and effort, but be careful how and how often you do it. It can also be devastating when bugs arise. It is hard enough to debug code you wrote yourself, so have fun debugging code you don’t even understand. Still, many developers will continue with their ways of copy and paste without thinking twice about the code they’ve never even looked at thoroughly. But don’t worry, they won’t last long. The need for custom yet powerful functionality in websites will continue to grow, leaving them in the dust.

Related Posts

A Call to Arms
Use Your Resources