Copy and paste programming – When to and when not to

Copy and paste programming – When to and when not to

copy and paste programming

Share on

Copy and paste programming is the process of producing highly repetitive code by copying existing code and pasting it into a new one. It’s often done by developers who don’t want to or don’t have the time to start writing code from scratch, so they turn to a pre-written solution.

But, if you don’t understand the code you are copy-pasting, then you won’t notice bugs or even security issues it might invoke. 

Not only is this damageable to your code and software, but it also complicates it unnecessarily, because it often contains additional lines of code that you don’t need. In the long run, it’s not optimal or smart, so that’s why we turned to our developers to check what they think about this practice. Mateo, Luka, and Andrea decide to share their stance on this topic and bring you closer to understanding why should be avoided in some situations.

What is copy-and-paste programming?

M: It is the process of reusing someone else’s code by copy-pasting it into your own project.

L: It is copying and pasting snippets of code from one place to another without actually understanding what it does.

A: It’s “programming” where a developer uses someone else’s code with the minimum knowledge of how it works.

What’s your stance on it?

M: I do not support this practice. I could partially approve this at a point where a developer is still a novice, but it is definitely not a good practice.

L: Definitely not good practice. As a programmer, of course, you will copy and paste some valid solution for your problem, but you have to understand that code and adjust it to your own needs.

A: I believe that it’s not generally a good practice, especially copying without understanding. I think it’s good to explore existing codes so every programmer, that’s learning, could see different ways of solving problems and get their own or improve ideas.

Is it potentially bad to use copy-and-paste programming in custom software development?

M: It surely is, especially when dealing with large-scale projects which require long-term maintenance.

L: Of course it is. It is bad for any kind of development. You must understand what you are doing.

A: Copy-and-paste programming, without understanding the code, is definitely a bad solution that can bring more damage than good. You should always try to understand each line of code.

Are there any benefits?

M: The person who does this can think that the benefit is the speed since it is faster to copy and paste the code, but in the long term that will come back to that person when the code gets more complex and he/she doesn’t understand that part of code.

L: No benefits at all if you blindly copy and paste. But if you use copied code, understand it, think about it, and then adjust it according to your specific case.

A: Copying without understanding can have an advantage in terms of speed if it won’t cause problems later on. If we encounter problems, we might spend more time fixing them than we would’ve if we initially put more into the starting solution. If we use copy-paste in a way that we understand the code, so we can modify it to our wanted solution, it can be beneficial in terms of learning new solutions we haven’t thought of before.

Did you use it and when?

M: I don’t use this practice.

L: Almost never blindly copied and pasted code.

A: I did use it, but only in some situations in college and I’m not particularly proud of that.

When should developers definitely avoid it?

M: Developers shouldn’t use this practice in any situation.

L: Always. 😀

A: If it’s blindly copy-and-paste, the answer is always.

Do you think that copy-and-paste programming brings a bad name to a developer?

M: I don’t think it brings a bad name, but it certainly doesn’t help developers improve their knowledge and progress in their careers.

L: If you understand that term, I wouldn’t say it brings a bad name. As a developer, you must think about the problem and make an adequate solution. It doesn’t include copy-paste solutions.

A: I wouldn’t say that it brings a bad name, but it doesn’t help developers acquire new knowledge and develop ideas on how to solve problems.

Conclusion

Essentially, we avoid copy-and-paste programming at all costs since tailor-made software doesn’t allow for such practices. The integrity and success of software rely solely on the skills of developers to deliver immaculate and correct code. Often, in tailor-made software, you will encounter legacy code, so it’s vital that it’s done precisely and in a way, that future developers that come onto the project understand every single line.

More from our updates:

Our Work

Explore our recent work

Services

Explore what we offer

info@deegloo.com | Zadarska 80, 
1000 Zagreb, Croatia

© Deegloo. All rights reserved 2022.