Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming

Use Code From Stack Overflow? You Must Provide Attribution (stackexchange.com) 303

An anonymous reader writes: Have you ever used Stack Overflow to answer a question about some code you're working on? Most people who write code on a regular basis have done so, and this sometimes involves copying code snippets. Well, starting on March 1, copying code from Stack Overflow will require you to attribute that code. Code published by contributors to SO will be covered by the MIT license. Users copying that code don't have to include the full license in their code, as it usually requires, but they do have to provide a URL as a comment in their code, or some similar level of attribution. This change applies to other sites in the Stack Exchange network, as well.

The SO community is widely criticizing the change, citing problems with the decision-making process that led to it and complications that may arise from mandating attribution. Why did SO make the change in the first place? They say "it's always been a little ambiguous how CC-BY-SA covers code. This has led to uncertainty among conscientious developers as they've struggled to understand what (if anything) the license requires of them when grabbing a few lines of code from a post on Stack Exchange. Uncertainty is a drag on productivity, for you and for us, and we feel obligated to make code use more clear."

This discussion has been archived. No new comments can be posted.

Use Code From Stack Overflow? You Must Provide Attribution

Comments Filter:
  • No. (Score:5, Insightful)

    by Anonymous Coward on Friday January 15, 2016 @10:23AM (#51307199)

    If I offer you some code in an answer, that's for you. I'm not going to require you credit me or some site for the few fucking lines that would come through on stackoverflow.

    So instead of dealing with that bullshit, I just won't use stackoverflow again.

    Fuck them. Fuck their CoC. Fuck their SJW bullshit, too.

    • Re: No. (Score:5, Insightful)

      by Anonymous Coward on Friday January 15, 2016 @10:45AM (#51307369)

      Anyone intelligent enough to provide useful solutions already knows anything they post on something like stackexchange is public domain. If contributors wanted money and or attribution, they wouldn't have posted a solution to begin with.

      This is idiotic and overly complicated. I want to meet the "developers" concerned about the 'foggy' licensing terms for code/solution approaches posted on stack exchange.

      Goodbye stack exchange. You've shot yourself in the foot.

      • Exactly right, not to mention a large portion of the code from SO was copied from somewhere else to start with. Simply find your answer there, spend 2 seconds looking for the same answer somewhere else and copy that instead. Assuming anyone is paranoid enough to think there will be any consequence for a breach that can't possibly be monitored.
      • Re: No. (Score:4, Interesting)

        by SumDog ( 466607 ) on Friday January 15, 2016 @03:41PM (#51310107) Homepage Journal

        I typically put

        #taken from http://stackoverfl......

        in my code anyway, just as a reminder of where it came from, but only if it's particularly complex. I don't always of course. This change is kinda retarded though. I don't want to be forced to do that every time.

    • Seems to me... (Score:4, Insightful)

      by sycodon ( 149926 ) on Friday January 15, 2016 @10:48AM (#51307405)

      ...that if they require this, it is edging towards some kind of implicit acceptance of responsibility for that code.

      If I use code from a forum, offered freely, and burn down my stuff, it's on me.
      If I use code from a paid source and it burns down my stuff, it's on them.
      If I use code from a forum, but I have to attribute that code in mine, then ???

      I would dismiss that conclusion right off the bat. But you give some lawyers even the slightest rationale, it's off to the courts you go.

      • Re:Seems to me... (Score:5, Informative)

        by Anonymous Coward on Friday January 15, 2016 @11:02AM (#51307533)

        From the MIT license (similar wordings can be found in other licenses)

        the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

        I'm pretty sure no damn lawyer can get around this. No sane lawyer anyway.

        • by sycodon ( 149926 )

          I have a feeling that sometime in the future, language like his will be found to be invalid.

          It's about the same as selling a car and claiming that you can't be held liable if there is something wrong with it. If you are paid money for code your wrote to perform a function, and it fucks up and wipes out something else, it should be on you. sure, it's a bit more complicated than a car, but the principle should be the same.

          • I agree to a certain degree, but you're not paying for anything on StackOverflow, at least not that I've seen.

          • Non-dealership personal sales of cars, unless explicitly stated in a contract, are sold caveat emptor.

            This is the exact same thing as using code from some random area on the 'net. The car may look like it should last, but if you didn't either check out the engine yourself or take it to someone who can check it for you, you can't complain about how the transmission fell out and the engine stopped working by the time you got halfway home... you bought it "buyer beware". It is on the buyer / recipient to mak

            • by sycodon ( 149926 )

              So...Microsoft is the same as a sleazy used car dealer? :-)

            • Non-dealership personal sales of cars, unless explicitly stated in a contract, are sold caveat emptor.

              They're sold with basic protections in place, and sellers are required to:

              Not intentionally misrepresent the car - no rolling back the odometer, no claiming it's got features it doesn't have, no falsely claiming you put in a new transmission last month, etc.
              Disclose anything they know of that is a safety issue - no selling a car with no brakes without disclosing that.

              Even when you throw in "as-is" on a ad / contract / bill of sale, the seller is still forbidden from committing outright fraud and can still b

  • by Anonymous Coward on Friday January 15, 2016 @10:23AM (#51307215)

    You should be anyways, but not for the reasons that you might think.

    I always include a link in comments to the source of the borrowed code (or approach), because the relevant discussion will illuminate the how and why far better than a large block comment.

    • by vux984 ( 928602 ) on Friday January 15, 2016 @11:57AM (#51308049)

      I always include a link in comments to the source of the borrowed code (or approach), because the relevant discussion will illuminate the how and why far better than a large block comment.

      5, 10, or 15 years from now a 404 error illuminates nothing.

      If the snippet really needs/benefits from the explanation/discussion, I usually save the page / article to PDF, with url in the header, and include that in the project, and then reference that file in the comments.

      I've run into enough 404 errors over the years, where the site I originally referenced is gone, or reorganized (Microsoft for example) or have gone to a paywall model, or even cases where the article has been edited or altered; or taken down by the author so he could posted an updated one or any other reason.

      I don't object to the concept of linking to the live article, but I'm not willing to take the chance that it won't be there if i ever need it.

      I've never really considered whether the practice raises its own copyright issues. It probably does... so I guess it won't work where the source is being redistributed. Which is unfortunate really.

    • I agree. In fact, when I read the summary I was dumbfounded by the idea that someone would grab code off the Internet without adding a comment along with it explaining what it does and its origin. What happens when you look at the code again in 6 weeks, 6 months or another developer comes along after you and has to maintain/modify it?

      I find this also very helpful in the case where the borrowed approach is not otherwise consistent with the style and architecture of the project.

  • by __aaclcg7560 ( 824291 ) on Friday January 15, 2016 @10:23AM (#51307217)
    I usually put the URL into a comment when I use a particular piece of code from Stack Overflow. More so for future reference than attribution.
    • by BenBoy ( 615230 )
      Right with you ... this was already standard practice for a lot of developers. Some of the supporting comments can be pretty intricate and long ... not something I want to repeat in my code comments, but something I want later developers (or later me) to have access to.
      • by Gr8Apes ( 679165 )
        SO is a short cut for me which usually leads to the exact portion of whatever documentation I need to review to implement a specific solution. Anything I "copy" from such a source is usually too modified to ever be traceable back to the original, because "surprise" the problem isn't exactly the same, the naming and code formatting almost never matches the current policy not to mention what is actually being done, etc etc etc. So it really becomes code inspired by whatever was found, or that was used to lea
  • by 91degrees ( 207121 ) on Friday January 15, 2016 @10:25AM (#51307227) Journal
    Nobody will come after you if you use code from Stackoverflow without attribution. The code isn't worth enough and the ownership is not obvious enough.

    People and companies that have a policy of sticking to the spirit of a licence agreement as well as the letter will appreciate having some rules to know that what they're doing is acceptable.
    • by c ( 8461 )

      The code isn't worth enough and the ownership is not obvious enough.

      In many (most?) cases, the only reason the code could even be on Stackoverflow is that the snippet would fall under fair use.

      And, in the cases where the ownership can be traced to somewhere else, why couldn't someone attribute it to the original source rather than Stackoverflow?

    • I doubt it'll impact me in the slightest. I use it to find workarounds to consuming complicated APIs and even the stuff I paste gets refactored beyond recognition from the original. To me, how to integrate with Oauth is a statement of fact with hundreds of examples, and by the time I've customized it for my needs good luck finding anything that might be its source.

  • by xxxJonBoyxxx ( 565205 ) on Friday January 15, 2016 @10:29AM (#51307259)

    Here's an actual debate on this topic on SO:
    http://meta.stackexchange.com/... [stackexchange.com]

    Accepted answer: Anything that you post to Stack Overflow will be under the terms of the Creative Commons license

    Top comments seems to be about using "Unlicense" (instead of "Public Domain") and to just avoid cut-paste (good luck with that if you're dealing with an offshore team). I pretty much use #2, renaming everything and usually swapping some of the decision logic to create something that looks original enough to pass a smell test when I cut/paste. It's work, but it's still significantly less work than writing it from scratch.

    • Yeah, I almost always change variable names to match my conventions and will add some extra validation usually.

      I am not sure why SO needs to specify this at all though. I mean, people are putting code out into public space with the intention that others will copy it... that's the whole point...

      That said, I usually do keep any comments that were in the code snippet to begin with.

      • by PRMan ( 959735 )
        Exactly. If you don't want people to use it freely, then don't share it on a site where the whole point is for people to use the code freely.
    • Anything that you post to Stack Overflow will be under the terms of the Creative Commons license

      But which Creative Commons license? They range from CC0 (effectively Public Domain) all the way down to CC-BY-NC-ND, which is one step short of "all rights reserved" and not really a contribution to the commons in any meaningful sense. The one thing they all share is that you can distribute the work non-commercially with attribution in its original form—which is rarely a useful set of terms when applied to incomplete snippets of source code.

    • by Jahta ( 1141213 )

      Here's an actual debate on this topic on SO: http://meta.stackexchange.com/... [stackexchange.com]

      Accepted answer: Anything that you post to Stack Overflow will be under the terms of the Creative Commons license

      Top comments seems to be about using "Unlicense" (instead of "Public Domain") and to just avoid cut-paste (good luck with that if you're dealing with an offshore team). I pretty much use #2, renaming everything and usually swapping some of the decision logic to create something that looks original enough to pass a smell test when I cut/paste. It's work, but it's still significantly less work than writing it from scratch.

      There's a quote from Jeff Atwood in that debate that I think is very relevant - "I would hope that people are not posting giant blocks of code at SO, making it more of a quote / fair use type situation.".

      That's the way I view anything I post on SO; they are just code fragments to illustrate a concept or a language quirk and not something I feel the need to claim ownership over. And that's also how I read SO; I'm looking to learn, not copy/paste big chunks of code. If folks are really posting blocks of code

  • by Etherwalk ( 681268 ) on Friday January 15, 2016 @10:33AM (#51307289)

    This is about money and maybe ego. A combination of what some shortsighted idiot thinks of as free advertising and maybe some ego-hungry folk involved in the decision-making who feel the need to be cited.

    And it will start moving every major company away from stackoverflow. You can't be putting snippets of other people's code in your product with attribution because you're going to be making lawsuits and licensing that much more complicated. People who worry about those things will use stackoverflow less and less.

    Stackoverflow has a great network effect from all the users. But stuff like this will make anyone who brings another game to town look a lot more attractive.

  • by Todd Knarr ( 15451 ) on Friday January 15, 2016 @10:34AM (#51307301) Homepage

    For me it always came down to what kind of code it was. If it was "I know what I want to do, what's the right/best way to express that in $LANGUAGE / using $FRAMEWORK?", we're talking about just mechanics. If I was looking for how to do something, where I needed the actual algorithm or data structure rather than just "What's the syntax?" or "Which operator's best?", that's getting into the creative side where you need to at a minimum do attribution. Almost all of what I get off of SO falls into the first category.

  • by celest ( 100606 ) <mekki@@@mekki...ca> on Friday January 15, 2016 @10:50AM (#51307427) Homepage

    Perhaps it's because I'm an academic and my use of Stack Exchange relates to my research projects, but I'm having a hard time understanding why people would object to citing the source of a snippet of code. I have always cited and linked to the profiles people who were kind enough to help me with my code on Stack Exchange, not out of license obligation, but out of professional respect.

    In academia, citing the work of others is commonplace. It's super easy to insert a comment in your code with a link. Putting the licensing and legal interpretations aside for a moment, why wouldn't you just want to do this out of respect for another professional?

    Reply to This Share Flag as Inappropriate

    • by pjt33 ( 739471 )

      The objection is not to citing others when you use their code: the objection is to the way Stack Exchange is requiring you to license your code. The most repeated theme of the criticism is "If you're going to change licence, change to a proper one rather than a kludgy homebrew variant which allows people to just copy the code, add a URL, and call it attribution".

    • by Okian Warrior ( 537106 ) on Friday January 15, 2016 @11:41AM (#51307921) Homepage Journal

      Perhaps it's because I'm an academic and my use of Stack Exchange relates to my research projects, but I'm having a hard time understanding why people would object to citing the source of a snippet of code.

      I take the opposite position - I wonder why people even bother with attributions for little scraps of paper, half-formed ideas, and answers to questions.

      For one thing, if it's on StackExchange it's common knowledge. Do you cite Newton or Euler when you solve an integral in your paper?

      Secondy, StackExchange doesn't cite *their* scraps of code. That 6 lines of code that connect to the SQL server - it's just information from the manual that the reader could have gotten for themselves. Does StackExchange cite the manual?

      Thirdly, it generates fear and doubt in the minds of pointy-haired bosses, thinking that an external license reference will dilute the software value. Possibly require the company to publish the code for anyone else to copy. (Whether this is true is irrelevant - it's the perception of many people.)

      Fourthly, the attribution is extra administrivia and work that adds nothing to the code. It has to be ignored and skipped over by everyone who reads or maintains the code in the future, it goes into backups and changelogs. It's litter for programs.

      Fifthly, there's no possible way that value or esteem can attach to the writer. Having some sort of value or utility is the reason that rational beings do things, so why should anyone bother doing something that could not possibly reward the writer?

      Perhaps it's because I've read too many papers that are a thicket of cryptic citations referencing everyone else's work, but with very little to add. For example, see Crumbum and Whoodle (1985), but Finnaster and Welsch (1992) take a counter position that might throw more light on the subject.

      For a relatively complete overview of the theory and reasoning behind citations, see Finbum.

    • by Kjella ( 173770 )

      The short version is that the company doesn't care who wrote the code, they care who owns the code. All work for hire is copyrighted by the company, having who wrote it in source control is just to aid the development process or place blame. That means everybody can grab any piece of source and do whatever, very rarely do you see inside sources mentioned. Once you have code that is not yours and not distinctly separated in a third party library as being someone else's you have to keep track of it. What if a

    • by mark-t ( 151149 )
      I think that the loudest objections to this are coming from people who feel that what Stack Overflow is requesting here is not unlike a computer science department in a university stating that all examples that their professors may write on the blackboard are copyrighted by them, and any use of those examples outside of the classroom must be attributed or they may get sued for copyright infringement.
    • by AmiMoJo ( 196126 )

      I'm having a hard time understanding why people would object to citing the source of a snippet of code.

      They are embarrassed that they had to look up the answer on Stack Exchange and don't want other people seeing the code to know. Personally I don't care, it shows I saved time by no re-inventing the wheel, and provides a helpful reference back to discussion and notes that might be useful later.

      • by dgatwood ( 11270 )

        Citing the original source of snippets in the source code is fine, and is actually pretty useful, because when somebody goes and reads the source later, it helps explain why somebody did something. It also gives the creator credit in front of people who would actually appreciate and understand why their snippet is cool.

        Citing the original source of snippets in a closed-source app is more problematic, because it tells the end user absolutely nothing other than that a tiny snippet of code exists somewhere i

    • by jdavidb ( 449077 )
      I don't cite my college professors when I write code. To me on Stack Overflow we are teaching each other. If I teach somebody how to do something, now they know, and they can go do it. I don't expect them to cite me. Of course I'm not gonna complain if somebody wants to cite me, give me an award, send me a check, etc.
  • by BitZtream ( 692029 ) on Friday January 15, 2016 @10:54AM (#51307465)

    99.999999% of the code posted to StackOverflow didn't originate with the person who's posting it.

    Most of it is just someone spitting out what they learned from someone else, and in most of the situations, the most upvoted answer is the common sense and only real solution to the problem presented, thats why it gets voted to the highest/accepted as the answer.

    SO doesn't really have the right to force a license on the code posted there, they are pretending to worry about people using the code, but ignoring the broken part of the people posting the code.

  • They just want the link to drive more traffic to their site.
  • Who owns the code posted to Stack Overflow?
  • This doesn't sound onerous to me at all. It doesn't require anything in public documentation, help pages, or otherwise like the MIT license. It simply requires a single URL in a code comment.

    This sounds perfectly fine to me--in general, I and my team already does this because it's helpful to know WHY we chose a course of action, especially when it was complicated enough to require SO's help.

    http://meta.stackexchange.com/... [stackexchange.com]

    What is reasonable attribution?

    A URL as a comment in your code is reasonable attribution.

    There are certainly other forms of reasonable attribution, depending on use, and you are welcome to go above and beyond what’s required and include username, date, and anything else if you like.

    You are also welcome to use the MIT License as it is traditionally interpreted: by preserving the full license with relevant fields (copyright year and copyright holder) completed.
  • In many cases, there is only one correct way to do a thing. This is similar to Google's argument regarding Java APIs: if you want to write compatible code, there is only a single way it can be done. It isn't creativity, it's plain mathematical necessity. Many of the people didn't write the language interpreter they are providing an answer about, so they have no rights to claim in answering trivial syntax questions (no more than a person can claim Rights to a section of Harry Potter because they discusse
  • by shog9 ( 154858 ) on Friday January 15, 2016 @11:19AM (#51307691)
    Before you freak out, you should read the license that's been in place on Stack Overflow since it was founded. [creativecommons.org]
    Guess what: it requires attribution.
    It's not totally clear how that's supposed to work when applied to code, but it's crystal clear about the requirement itself. The proposed MIT change is aimed at making this more obvious, but... If you aren't already giving credit where it's due, then that's on you - the license has always demanded that.
    You might wanna read up on the "share alike" bit too...
    P.S. I work for Stack Overflow.
    • by Sklivvz ( 167003 )

      I, for one, welcome our Stack Overflords.

      PS: I, too, work for the beast^H^H^H^H^H Stack Overflow

  • It's about SO trying to more eyes on the site and raise their ad revenue further.

    "Hmm, where did the dev get this code? Oh, I see, from SO. Let me go to the link and see what else was said..."

    Anyone who buys that "we're only thinking of the code submitters' rights" crap is just fooling themselves.

  • /*!
    @attributions
    - The C Programming Language 2nd Edition
    by Brian W. Kernighan and Dennis M. Ritchie
    for help on the printf statement.
    - Linux man-pages project for parameters to the
    strftime function.

    - Professor Steve Sherman for the first class using C.

    - Professor John Wirth for general programming
    skills being taught.

    - Bill Joy for developing the vi editor in which this
    code was produced.
    */
  • When I write up a code snippet to answer a question on a website, I get to decide how I want to license that. Not the website... And almost this exact argument has gone to court, BTW - Adobe can't claim any rights whatsoever to Photoshops just because their creators used an Adobe product to make them. Call me crazy, but somehow I doubt the courts would consider the use of a text input box to write a forum post as granting more rights to the tool-maker than they do with Photoshop.

    And when I write up a
  • And professionalism. Then again, most programmers aren't professionals so the whining is not unexpected.

  • When I copy code from StackOverflow, if it's more than one or two lines, I include a reference to the source page. If only so the programmers who work on my code after me know where it comes from and why it is the way it is.

  • Comment removed based on user account deletion
  • for copyright. Therefore the license and their requirements aren't relevant.
  • So,

    you "copy/paste" code from the internet and never did attribute/mention the original author?

    And now a web site makes it a requirement in the "terms of usage" that you do so?

    And: you never figured before hand that this is
    a) the polite thing to do
    b) the fucking law
    c) in every damn book where people "quote" something "under fair" use for "science" or "educational purpose" the author is mentioned (otherwise it would be no fair use anymore), but if you copy/paste from SO or similar you don't think it would b

  • I don't know how many times I've seen piss poor code upvoted as the correct answer. Sure, most of the time it works but will have obvious errors, poor coding, men leaks, etc. In almost all cases I end up rewriting the code anyway.

  • SO is implicitly claiming rights in the code posted by its users. I'd check their terms of use.

  • by tomxor ( 2379126 ) on Friday January 15, 2016 @01:26PM (#51308851)

    Authors of the code snippets who understand that (regardless of ideology) this is not practical for most people who code for a living... can just re-post a link to their code as a gist, pastebin etc with an MIT / BSD / WTFPL license.

    For those wondering about derivative license compatibility issues: remember that as the sole author you have the right to use as many licenses as you like unless exclusivity is part of your job/contract. I don't think Stack Overflow can force this requirement on a user without breaking their rights in most countries.

  • ... if I pull code or a solution from an Internet source, I always include the attribution. I don't do it for the author's benefit. I do it because it can be helpful to someone else reading my code in the future.

  • I figure if I had to go to Stack Overflow for something, it's likely something that some future reader (or myself) may want more context/explanation on, and the Stack Overflow discussion generally contains a lot more than whatever snippet I happened to take. So I tend to include the URL in a comment.
  • by GiganticLyingMouth ( 1691940 ) on Friday January 15, 2016 @04:19PM (#51310379)
    Well, the original meta post got heavily down-modded and has since been updated it with:

    Update: January 15, 2016 Thank you for your candidness, patience and feedback. We're going to delay the implementation for now - we'll be back soon to open some more discussions.

    So it's not been taken off the table, but it probably won't happen anytime soon.

news: gotcha

Working...