Wednesday, February 15, 2017

Copy Paste - Blessing or Curse for Developers

Let's start this blog by asking a simple question to yourself.

Are you a Copy Paste Developer?

Most of the readers who are reading this post, will answer Yes for this question. We all are copy paste developer at one time. I am also a copy paste developer. I usually copy paste some lines of code from my old projects or from some blog post or from the StackOverFlow. All the developers to that at one point of the time. We do this to save our time and efforts. 

So now the questions are Does copy paste always works? Does it make your code better or worst? So in short it is blessing or curse for developers. 

Well, I would say that if you copy paste and do it wisely and with proper understanding then it's really a blessing for you but if you do it blindly you could end up in disaster. It will introduce so many other bugs in your code and eventually you have to start from scratch. 

What are the Good Things about Copy Paste?

Being a copy paster programmer at some time I would say in most of the cases copy paste is good for the developers. You don't have to rewrite entire code once again. With copy paste and little changes you can solve your problem easily. It saves your time and efforts and can solve your problems easily. 

I would like to share my experience here. When I started working on creating iOS app, I was not having enough knowledge of Objective C and all and still I created a full fledge iOS application with Copy Paste. I was working on application for motivational speaker. The requirement was to create app to list lessons of speaker and when user tap on lessons show details of lesson with videos and picture gallery. So what I did is I found open source application for food recipes. Application was very similar to what I was looking for. First of all list of recipes and then details of recipe. So I copy paste the code with views and controllers and all and instead of recipes, put motivational lessons and bingo the app is created. So here copy paste was blessing for me. I created entire IOS application in a week and with much less efforts.

So copy paste is always blessing for developers but you have to make sure certain things while doing copy paste. 

  • Understand the code which you are copy pasting
  • Modify it as per your coding standards and as per your code logic
  • Check for errors in the code before copy paste
  • Do testing after copy paste
  • Write comments in your code after copy paste

What are the Bad Things about Copy Paste?

Copy Paste could be disaster for your if you just do it blindly and you do not try to understand what you are copy pasting. Everyone copies code from StackOverflow or other forums from time to time. Hopefully, you do it sensibly, using it as a starting point for your own production code — working through what you’ve just pasted in to understand it, experimenting with it, modifying it, making it fit for your purpose rather than just blindly copy-and-pasting random code from the internet. It's possible that code which you are copy pasting may have errors or may have entirely different purpose than yours. So it can cause issues in your code and can break your code. 

So I would say only one thing, understand the code which you are planning to copy paste and then copy paste it. 

So it's up to you to turn copy paste into blessing or curse. If you do it wisely, it will always be blessing and there are very rare chance that it may turn into curse for you.

No comments:

Post a Comment