Copying and pasting from…

Yes, like you read it, copying and pasting.

We all do that, all coders in the world do it, a piece of code here and there. Owned code, others code, and it could be a line, a snippet or an entire piece of functionality but trust me we all do it, it's functional and most of the times it works like charm.

But what I would like to discuss here is that even we all do it, not all of us evaluate the cost and implications of doing it. For many of us is more important to have our problem solved fast and don't have to look back at it anymore (keep moving forward) but guess what?, in many cases you have to go back because the piece of code you pasted, yes that one that solved the problem the other day super fast, that one introduced a new problem and now you have to go back and this new problem is sometimes bigger, sometimes unrelated, sometimes completely different and most of the times more difficult to debug because you pasted it from somewhere.

There's a lot of things you can do to avoid this and it depends on how you like to do things and get them done. The easiest is keep copying and pasting and not learning anything from it, is valid, or you can try doing some work before the paste part. Let's say you just find some solution online to your big problem, it looks nice, you pasted it and it works fine, cool, but how about if you just don't stick with this one, let's try to find a couple more, maybe there is no other solution, maybe there is a ton, but for sure they are similar.The less effort you can give here is at least understand how the solution you find works and learn from it. But what I think will give you an edge and a difference is that you take into consideration not only the solution but, all the requirements and constraints of your problem, of the software you are developing and then evaluate the solution you are pasting and see it if complies and meet them, if you find more than one solution choose the one that is closer to meet your application requirements, then check if the code used is somehow compatible with your coding style or if at least is well written (memory and resource wise) check if it has dependencies, if so, check them, go back and evaluate them to see if they are a good fit for your application, do you have them already? Same version? Do they cause conflicts or instability with any component of the application, it gets complex right? Yes I know but if you are up to the task, this is just some of the considerations you may have to have in order to copy and paste a code.

Learn something out, rise the bar

How about finding a solution or a set of solutions and look into them in great detail, process them and then when you have a good understanding of the logic used and the solution itself, why not code it your self, using your own terms, your own requirements, constraints and style. In this case you will end up with more than just a solution for a problem you had, you learned something, maybe something new, maybe just a different way to do something you already knew. If you are learning how to code or a new technology you just acquire knowledge and did some practice, if you are already a seasoned developer you get more experience in any case you are rising your game

By the way, I just pasted this post form somewhere else…

Facebook Comments