The internet became and still considered the largest library of any field of studies today including programming. Thus, developing any kind of application became quite easy today because of this. There are lots of source codes being shared by other developers through forums, communities, and blogs. And because of this, there are lots of developers/ programmers who became skilled on the copy-and-paste programming technique (if you can call it a technique).
Actually, there’s nothing wrong on copying codes specially if it is a very good solution to a problem. But, most of the published codes weren’t properly or completely explained. And I knew the reason for this. So, why? Because those codes aren’t meant to be copied completely. They want you to revise it to something that’s gonna be more useful and efficient for your program.
For example, a programmer shares his codes in a forum. Let say, it’s a function that reads a text file and returns a boolean value (TRUE if text file is not empty and FALSE if text file is empty). Some readers will just copy this function completely and use it without modifying anything inside it. Now, does it became useful? Hmm, maybe.
This is where we can see the importance of understanding each lines of codes. Yes, we already knew what the function does. It will read a text file and check if something was written on it or it’s empty. As simple as that, right? But in most of the times, if you just copy-and-paste, your code will became prone on errors, or, if there’s no compile error, your application became slower because your code was not optimized.
Impact Of Not Understanding Each Line Of Codes
As I mentioned, if you just copy-and-paste codes and don’t understand what each lines of codes does, your code became prone of errors or your application became slower. Why and how?
– Conflicts on variable names.
There might be instances that you declared a public or global variable on your program and that name were also being used as a private variable inside the function you’ve copied.
– Conflicts on data types.
This is very common. For example, you declared an integer variable, and you copied a function that returns a float value. Then, you will assign that function to the integer variable that you declared. EPIC FAIL!
– Redundant codes.
Because you just knew what the function you copied does, yet you don’t understand what’s inside it, there might be instances that there is/ are duplicate process inside it that you already have outside it.
– Might lead to Pokemon Exception Handling
If you do not understand the process inside the function you copied, it’s very difficult to debug. Thus, it will lead you to use a generic exception to handle all errors for your code. Yeah! Try or just Gotta Catch ‘Em All!
Just my two cents, it’s not bad to copy codes. Just make sure that you understand what it really does. Then modify and optimize it so it will fit for your application.
mavic cantes says
Right…It did happened to me and it all ended up in error..hahaha have to wait for someone to do it for me na lang…:D
Aj Banda says
well.. I always make sure that I understand the things I copy on the net prior to using it.. it’s hard to deal with some things that is hard to understand and yes, it always lead to conflicts :p