4

Many books on computer programming publish source code listings and example programs as part of the printed book to demonstrate some aspect of the language. When I'm learning from such books, I typically copy one or more examples from the book into my computer in order to run them, study them, run them using a debugger, etc. I copy the version from the printed book and do not use any other included media such as CD-ROMs or Web sites. I had always assumed this sort of copying for personal use on my own computer would not be considered copyright infringement, but now I'm not so sure.

Sometimes, the book does mention an implied license near the beginning that clarifies how the source code can be used. In this case, the license normally allows copying for the sort of purpose I'm talking about. But in the large majority of cases, there is no license mentioned at all pertaining to how the source code included in the book may be used. If there are electronic media provided with the book (CD-ROM, Web site, etc.), the electronic versions of the source code typically do mention a license, but I do not typically make use of such media, so for the purpose of this question I want to ignore them.

In one unusual example, there is a well-known programming book that explicitly forbids any personal use of the source code in the book on a computer without first obtaining a license:

You must read this section if you intend to use the code in this book on a computer [...]. Without the license [...] this book is intended as a text and reference book, for reading and study purposes only.

It then goes on to clarify the granted personal use license:

If you personally keyboard no more than 10 routines from this book into your computer, then we authorize you (and only you) to use those routines (and only those routines) on that single computer.

However, I cannot accept this license due to the restrictions. For example, I may want to keyboard more than 10 routines. And I may want to use some method of copying other than to "personally keyboard" them (e.g. automatic dictation software).

My questions:

  1. For the case that a book does not include a license that mentions copying the source code from the book version, is it allowed for the reader to make personal copies of the source code to run on one's own computer?

  2. For the case that a book does include a license, but that license is found to be unacceptable by the reader, is it allowed for the reader to make the personal copies? Does the fact that there is a license offer that the reader does not agree to make any legal difference as compared with case 1 (no license offered at all)?

Assume that the source code to be copied would normally qualify for copyright protection (i.e. do not consider trivial source code examples that by themselves may not be eligible for copyright), and that the reader either owns or is borrowing (e.g. from a lending library) a legal copy of the book.

Brandin
  • 136
  • 1
  • 7

2 Answers2

5

Ignoring fair use, copying code in which copyright subsists would be copyright infringement.

... the owner of copyright under this title has the exclusive rights [...] to reproduce the copyrighted work (17 USC 106)

Code is eligible for copyright as a literary work.

Copyright protection subsists [...] in original works of authorship fixed in any tangible medium of expression [...] Works of authorship include [...] literary works [...] (17 USC 102)

Oracle v Google. (Fed. Cir. 2014):

It is undisputed that computer programs— defined in the Copyright Act as a set of statements or instructions to be used directly or indirectly in a computer in order to bring about a certain result, 17 U.S.C. § 101—can be subject to copyright protection as literary works.

One way that copying the code would not be infringement is under a scenes a faire or merger analysis. In some circuits (e.g. 6th Circuit), scenes a faire/merger can preclude copyrightability. In other circuits (e.g. 2nd and 9th Circuits), these apply as affirmative defences after an initial finding of infringement. In either case, just as in fair use, this would be a case-by-case analysis, so we can't provide a blanket answer.

1

The scenes-a-faire (required scenes, or literally "scenes to be made") doctrine recognizes that some aspects of a copyrighted work in some genre may be traits of the genre, and thus not copyrightable in and of themselves. Further, the merger doctrine says that if there only a very limited number of ways of expressing something, none are copyrightable in and of themselves. Many code examples in programming books, chip vendor data sheets, etc. are intended to show the essence of what would be expected in a generic application that performs a particular task. For example, a typical UART transmit routine would look something like:

void put_char(unsigned ch)
{
  while(!(UART0->TXSTAT & UART_TXSTAT_READY_MASK))
    ;
  UART0->TXDATA = ch;
}

using identifier names that match those given in the device manufacturer's data sheet or technical reference manual. While there might potentially be a small amount of creativity in the choice of whether to use the ! operator or compare the result of the bit mask with zero, how to format the dummy statement in the loop, etc. there are only a small number of ways of expressing something like the above without being gratuitously unclear.

In a sense, many programming examples in books are designed to show how a construct might be implemented in code if the programmer makes no attempt to be original. If an example intended to avoid being particularly "original", that would imply that the author was not trying to satisfy the copyright laws' rule that only original works can be copyrighted.

The fact that individual code snippets aren't copyrightable doesn't mean another author could simply copy all of them. If an author is seeking to make a number of programming examples fit together well for pedagogical purposes, minor differences that would be irrelevant when code is fed to the machine may make it easier or harder for readers to understand what is going on, and as a consequence the design of code snippets designed for teaching may require more originality and creativity than the design of snippets that are intended to direct machines to accomplish useful tasks.

supercat
  • 751
  • 4
  • 10