Copying code

  • I have a question that is up for debate here at work. I have been coding and working with SQL for more than 10 years. In all of this time, I have never searched the internet for code and copied it. I utilize the internet for research if I am faced with a particular problem that I don't know the answer to. But a co-worker of mine (and another at another software shop I worked for a couple of years ago), insists on going to the internet, copying other code (freeware, open source, whatever it is called) and then working that code to their needs.

    To me this is a bit unethical and I feel better at the end of the day knowing that is my code and my product. My co-worker says that is a waste of company time.

    Who is right? Am I wrong in thinking that copying code is unethical?

  • There is an article by Brad McGehee at http://www.sqlservercentral.com/articles/Editorial/66637/%5B/url%5D (Online T-SQL Scripts and Copyright) which discusses exactly the issue you're asking about.

    You might find helpful answers in the article or in the discussion ( http://www.sqlservercentral.com/Forums/Topic700079-263-2.aspx%5B/url%5D).

    From my personal point of view a person who's responsible for SQL code (especially in production environment)

    has to know (or at least should know) how the code he/she implemented works and why it works the way it does.

    Assuming this, the person in charge most probably would have come to the solution based on internet code snippets sooner or later by him/herself.

    By using the internet the solution might be available faster (depending on how long it took to find it vs. write it on your own).

    This would be benefitial for the company since you can get more stuff done than without the internet.

    On the other side, 3rd party code (what I consider internet source code belongs to) takes more time to be checked and tested than the code written by yourself since you need to get familiar with it.

    The more complex the code gets the longer it will take to understand and modify it.

    So, I think, -aside of the copyright issue- the answer is "It depends".

    I, personally, do use code snippets from the internet to get some ideas on how to solve problems I'm confronted with.

    However, those code snippets will not show up in production. I always rewrite the code.

    I also do keep personal records where I got the idea from (usually a link to the related url).

    If the code is marked as GNU/LPGL I might even add the link to the final/productive proc.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • i personally see nothing wrong with taking code off the internet and making it work for my purposes.

    i'm still gaining an understanding of how it works.

    not that i actively go out of my way to find such code but if someones written it up as a documentation then i'll copy it and have a play around.

    i find i can learn extra things when playing around with someone elses code because it might not just be a piece of code that does the one thing that i'm looking for.

    it may hold secret goodies 🙂

    having said that, the code that i copy and rework and understand is only small pieces. its not pages and pages.

  • If people are posting code on the net, it has to be with the expectation that it will be used by others. I know that's the assumption that I have to work under when publishing code in a book or an article.

    When not looking at publishing code, I have no issues finding someone else's work and applying it to the problem I'm facing. Why re-invent the wheel if you don't have to. When publishing code, I'll put my own together, even if it's not as good as other people's solutions because I hate the concept of plagiarism.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • You can take code off the Internet, IMHO, and use it in your systems, but I would not think that you can take it and resell it, meaning put it into software and sell that.

    It might be splitting hairs, but technically the author still has copyright. They might allow you republish it, or use it in your work with credit.

    There is plenty of code that is fairly trivial, written for demonstrations, that doesn't include error checking, etc. Using the idea there for your own code seems fair. that's often why authors publish things: so you will build on their work.

  • Steve,

    Thanks for the reply. Myself being a published author of fictional works, I agree and maybe that is why I have the mindset that I have. I just like working through my own problems (sure, it might add a bit of extra time to a project) and writing my own code. Then I know that product is mine; I feel like I really haven't cheated. Sure, there have been a couple of instances where I might have copied a small bit of code and then reworked it the way I needed it, but I have seen co-workers copy large amounts of code.

  • I personally don't have a problem with copying code and tweaking it to my own ends. I see code and a work of fiction as two completely different things. Code is functional, designed to serve and purpose and the mark of good code is its efficiency. Literature of course is almost the opposite. It is expressive and written with the narrative in mind, as well as the enjoyment of the reader. A good story is not an efficient story necessarily. In addition to that, there are many many ways to write even the most basic story. Despite similarities in key plot details, no one would accuse one story of copying another just because both the key characters get the girl at the end. With coding, yes, there is more scope for innovation the more complex the code, there are still only so many ways to get the right end result and anything you do write on your own will likely be less functional, less suited to purpose and less efficient than code found and tweaked online.

    I suppose I see code as merely a means to an end, while a piece of writing is an end in itself, I therefore see no problem with copy and paste as long as you understand what you're copying and you tweak it to suit your needs rather than leaving in superfluous code not necessary to your requirements

  • Do you use Linux or any other open source programs? If so, in your terms, aren't you cheating? Yes, those programmers made their product available for use, but according to your 'definition' it's still cheating.

    Programmers, such as those on this site, make their code available so that it can be used as is or improved upon. It is considered good manners to give credit to the programmer when you use a large amount of code from them. What's a large amount of code? That is up to an individual's perception, however I have seen code snippets where the programmer said "if you use this, please give credit to the original programmer".

    So my opinion is, if it doesn't say this code is copyrighted, then it is free to use in its entirety but credit should be given to the programmer. It doesn't take much work to put something like this inside the code you use:

    /* This code was provided by Jane Doe

    1 January 2009

    SQLServerCentral.com

    */

    -SQLBill

  • Brad,

    I too am a fictional writer, so I understand the pains you're going through. However, most people who publish code solutions on the internet usually do so with the expectation that someone will use it or re-use it.

    The caveat is that most of these coders expect to be credited for their work if their code is used and they don't expect other people to be making money off it. I'd also think if someone didn't want their code to be used, they'd a) Say so specifically and b) not post it to begin with. I've often not published code because it doesn't belong to me and simply pointed people to webpages or told people the English language version of getting to where they need to be.

    Like many people here, I step through code line by line until I understand what it's doing, then alter it to suit my purposes. Sometimes it's faster than figuring it out on my own. Other times, I have better ideas than what I find on the internet.

    Lastly, as other people have said, never ever stick code from the internet into your systems that you don't understand. Not only could troubleshooting it cause you problems, but if you truly don't understand it, you could be inadvertantly sticking malicious code into your systems.

    Hope this helps,

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply