Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am a developer in a good company. I was given a task by my company to accomplish within a week however I finished the same in 4 days, my boss, the client, and other team members all are happy by my work; even I was! However suddenly I got a thought in my mind: "For my work I took some code from internet and mixed it up with my programming and gave the result faster however, my worry is that I should have done the task all of my own so that I would have a better understanding of it (even which was taken from internet)".

Can anyone tell me if I am ruining my programming career this way (I mean by using others code)?

share|improve this question

closed as not a real question by Walter, Bill the Lizard, Jim G., ChrisF Aug 15 '12 at 8:08

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

9  
Depends on if what you did was illegally garnered and used against its license. –  Rig Aug 14 '12 at 18:30
    
Rig, Thanks a lot for the comment. However the code which was used was totally licensce free. The question is about my carrier if this kind of behaviour can destroy my programming carrier. –  Raj Aug 14 '12 at 18:34
3  
Cut-and-paste? Oh, the joy when you have to change it... –  user1249 Aug 14 '12 at 18:50
3  
License free sounds to me as if you're not allowed to use the code. If I show you some code I've written, you're not allowed to use it unless I license it to you, or give the rights for the code to you. –  Buhb Aug 14 '12 at 22:41
1  
99.999999999% of us will live our lives without a single unique own thought. Every little idea, every thought is practically copy-pasted. So relax and carry on. –  SK-logic Aug 15 '12 at 7:42

4 Answers 4

up vote 25 down vote accepted

Probably not. Getting parts of solutions online is not that uncommon. If you don't understand what you are copying and pasting from the internet, you will eventually run into trouble. If you take a little bit of time and effort to learn about the code you find and how to adapt it better to your own circumstances, that is fine!

share|improve this answer
18  
+1 for "if you don't understand... you will run into trouble." That's the key to the whole thing. Some code makes sense once you see it, even though you didn't think of it yourself. But if it looks like "magic" to you, figure out why it works before committing yourself to using it. –  Mason Wheeler Aug 14 '12 at 18:43
    
Yes I do agree with you mason. Thanks a lot for the suggestion..... –  Raj Aug 14 '12 at 19:02
    
How many upvoters use libraries and compilers downloaded from the internet. What about tools? Are all upvoters here honestly saying that they understand every detail of every piece of code the use. Are you all suggesting that writing 1000's of line yourself is more reliable than using pre-canned source code? Some of you may be good, even exceptionally good, but I very much doubt any of you are that good. –  mattnz Aug 15 '12 at 1:42
    
@mattnz I suppose the droves of nobody who have suggested anything of the sort (except you, of course) gave you this impression? All of the upvoters, myself included, are probably just acutely aware of how valuable peer collaboration can be as a teaching tool. –  satyrwilder Aug 15 '12 at 2:38

I always try to avoid copy-pasta from Internet, unless the code is exactly what's needed, is an industry standard/best practice, and is free of any licensing issues.

The copy pasta code usually is:

  • out of date
  • bloated
  • adds additional dependencies
  • has unknown bugs

It's better to understand the idea. Then write your own solution with code style that matches the project, doesn't add extra dependencies, is simpler, more modern, and better known.

Also, sometimes ideas can be encumbered with patents, so you should be aware of that as well.

share|improve this answer

Licensing issues aside, I don't think there's a real answer to your question.
If you have a lot of time and think that writing some piece of code by yourself will be useful to you in the future, do it. Otherwise, don't. Or maybe you can copy some piece of code but still take the time to understand it. That might be the best thing to do, or it might not be the best thing to do. It depends on the situation, and you can't really tell for sure until it's over.
It all comes down to making judgments. You can't make the right judgments all the time, but you can avoid doing things dogmatically, without looking at the specific situation that you're in... Although, overthinking can be another pitfall.

share|improve this answer
    
Oh yes ! Now I do understand that I can take the code from internet however I should take some time to understand the same(which i usually do). and s I do agree with your point "Although, overthinking can be another pitfall.". Thanks a lot for the answer...... –  Raj Aug 14 '12 at 19:14

There are two sides to this issue that you need to watch out for. On the one hand, don't reinvent the wheel. On the other hand, avoid licensing traps.

The internet is a great resource for getting code to do things quickly. There are all kinds of useful libraries and other utilities that make life easier. The issue of developer knowledge is certainly important and you do not want to be unable to withstand a code review because your code is replete with someone-else's. As Brian Kergihan once said: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Using code from people more clever than you are may well (and likely will) result in the inability to debug said code efficiently or effectively.

This leads me into my second point. Almost all code on the internet is licensed. Either explicitly or implicitly by copyright or similar. Certain licenses are very permissive as to what you can do with code, others much less so. The GNU GPL is famous for rendering any code it touches open source by default. Even one function could potentially render you obligated to release your codebase as open source software. Even Stackoverflow and the rest of Stack Exchange is licensed.

So by using other people's code willy nilly, you run the risk of both technical and legal shibolleths, the likes of which you may not understand.

share|improve this answer
1  
People who complain that debugging is 2x as hard as writing the code should get their act together and read some debugging resources. If debugging is harder than coming up with a good spec and implementation, YOU'RE DOING IT WRONG!!! Debugging is easy, it has always been this way. –  Coder Aug 14 '12 at 20:47
7  
@Coder: If you think that, I can only assume that you've never had to debug a truly difficult problem. Even with the best of tools, debugging the truly tricky stuff like race conditions or other intermittent errors can leave you pulling your hair out. –  Mason Wheeler Aug 14 '12 at 21:06
1  
@MasonWheeler: I have, there are debug heaps, step by step walks, automatic debuggers like WinDbg with !locks, and so on. It's a piece of cake compared to coming up with good thread safe algorithm, where you have to prove to yourself that every possible timing condition will still work. Designing safe multi-threaded algorithm is harder than debugging it. It will wither lock on deadlock, corrupt shared data, and then you know it's not protected, or crash with access violation, if some pointer is updated concurrently with actual data without common lock. Easy! –  Coder Aug 14 '12 at 21:10
    
@Coder Are you saying Brian Kernighan should have got his act together? Wow :P –  Andres F. Aug 14 '12 at 21:14
    
@AndresF.: Times have changed, we no longer work with guesswork when working with modern tools. Anyone who complains about debugging nowadays should get their act together. The last part about "always been this way" was an exaggeration though. –  Coder Aug 14 '12 at 21:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.