views:

277

answers:

5

I have a book on data structures and programming, and I referenced it to implement a B-tree insertion function. I copied most of the algorithm and variable names from the code samples in the book, but adapted it to match the structures I had already prototyped.

I'd like to release my code under a permissive license (e.g. the MIT License), but I don't know whether or not I'd be plagiarizing.

I have seen citations like this in open-source code before:

// See Knuth, Volume 2, section 4.3.1, Algorithm D.

Note that the book I referenced is not Knuth. The copyright notice on the cover of my book says:

All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher.

That said, would it be legal for me to release code, under my own copyright, based on code samples found in a book? Am I required to add a citation like the Knuth example above?

+2  A: 

You could always try mailing the author/publisher to request permission to release the relevant sections along with your modifications to it (assuming no IP problems with you releasing your code).

Its at least a place to start.

GrayWizardx
I'll bet you dollars to doughnuts you'll get a response from the publisher that, distilled, reads "No." I doubt the publisher is set up to analyze such a request properly, and will simply see "copy" and reflexively deny the request. They make books, not software.The author, however, may give you a useful answer, since they understand the issues and (supposedly) own the work.
Mike D.
+9  A: 

A book on data structures is published with the purpose of teaching you how to best implement the algorithms. Given that premise, I don't think it's a problem to reproduce the code found in the book. You'll probably have to adapt it to fit your circumstances, and in doing so you'll end up with your own implementation of the original algorithm. This is important since ideas (algorithms) do not fall under copyright. Copyright only applied to a concrete expression (code). That being said, when there is no originality involved in the translation of an algorithm into code, then that code may itself be copied. After all, there can only be so many ways to insert into a B-tree.

The copyright statement you quote is a standard statement inserted by all publishers and I would interpret it to cover the body text, not the already-known algorithms which were themselves published long ago in scientific papers. Those papers almost certainly had a similar copyright statement attached to them... :-)

By the way, putting in a citation has no significance when it comes to copyright -- though it is nice for future maintainers to know where to look up the algorithm.

Martin Geisler
+1 for being what I wanted to hear :)
Joey Adams
A: 

Well copyright (I'm not a lawyer) is very specific about actually copying the exact text. That's very different that copying an algorithm from Knuth for example; his books don't publish the algorithms in usable code, but his own pseudo code, so you have to recode it and that's something that you product. The algorithm (independent of the code) is not subject to copyright. However if you are lifting the exact code from the book, than you are most probably violating the copyright (unless you can make a case for fair use). While you may be able to get away with that, or even get permission to use it from the publisher, you certainly cannot assert your own copyright over the material. I would check with other books that publish their algorithms in code designed to be actually used and see what sort of statements they make about being able to use them for your purposes.

Francis Upton
+5  A: 

I'm not a lawyer either, but a few points:

  1. Plagiarism and copyright infringement are two different things. Plagiarism is passing off someone else's work as your own. You're clearly not doing that: you've acknowledged your source. Copyright infringement is publishing something you don't have a right to publish, or "offering" rights that aren't yours to offer. You are possibly in danger of doing that, and at the very least you should to make clear that your work is derivative from a copyrighted work with all rights reserved, and that what you are placing under a permissive license is your modifications.

  2. Without seeing the particular example, I wouldn't begin to venture an opinion on whether what you've produced contains enough of someone else's copyrighted material to infringe their copyright.

  3. Note that if you had come up with the same thing independently - without seeing the prior work - there would be no copyright issue. Unlike patents, copyright provides no protection against independent invention.

  4. There is, therefore, the question of how much orginality there is in the work for which your source is claiming copyright.

  5. In short, it all gets pretty tricky. This stuff is usually a judgment call.

  6. Just as an aside: you can plagiarize without infringing copyrights and vice versa. If you published a speech by Abraham Lincoln as your own, you've plagiarized, but since the work was in the public domain you haven't infringed copyright. If you publish a substantive piece of Microsoft's proprietary source code, identifying it as such, you've almost certainly infringed their copyright, but haven't plagiarized, since you never said the work was your own.

I hope some of that helps a little, I'm aware it's not exactly an answer.

Joe Mabel
+1  A: 

An interesting, pertinent question.

If the new library "as a whole, represent[s] an original work of authorship" (17 USC 101) it's clearly a derivative work and violates copyright law. (I think a reading of a GPL-like license would also reach this conclusion.) Are you releasing a library of functions that operate on trees, pretty much like that chapter of the book? Pretty clearly a derivative work. Is it an application that simply uses a tree to store some info, and could just as easily have used a red-black tree, heap, treap, whatever? Not a derivative work, but still possibly infringing.

Assume the algorithms themselves are public domain. The book copyright then applies to normal, creative, copyrightable stuff: the order that functions appeared, commentary, that sort of thing. Then if you copied the algorithms, it's just like Feist v Rural; there is no infringement, the creative parts of compiling the collection of information would define the work.

It's a little different with source code instead of a telephone book... are comments copyrightable? Probably. Then any copied comments would infringe. What about variable names? These are insignificant as far as the computer cares, but quite useful to humans, some creativity goes into naming them. Were those copied directly to your library, or obfuscated?

No matter what, add a citation so it's not plagiarism.

Releasing your library probably violates copyright, but I would argue that it's definitely not a "problem". ;-)

Robert Karl