I'm not clear on what counts as a "copy" in the case of code.

If I read your code, that was MIT licensed, implement a similar logic on my own and use no code fragments from the original author, does that constitute a "copy" without attribution to the original author and therefore a violation of the MIT license if I release the code under my own copyright?

  • 2
    I would vote no, because the MIT license licenses the code itself, rather than the logic behind it, but that's not much more than a semi-educated guess.
    – freginold
    Mar 22, 2018 at 11:00
  • 2
    Also, extremely relevant for the U.S.: "The Abstraction-Filtration-Comparison test (AFC) is a method of identifying substantial similarity for the purposes of applying copyright law. In particular, the AFC test is used to determine whether non-literal elements of a computer program have been copied by comparing the protectable elements of two programs."
    – apsillers
    Mar 22, 2018 at 13:06
  • 1
    What you are describing does not sound like copying. Copying means copying and/or modifying. For example if you copy a program but translate it to another language, it is still copied and a derivative work, even if you've physically changed every word of the source. Writing an original program which implements the same algorithm or idea would not be a copy. An original program will have certain elements that will happen to be similar with many other computer programs. Those likenesses are not copies, either.
    – Brandin
    Mar 23, 2018 at 10:58
  • 3
    This will probably be considered "reverse engineering" of the MIT-licensed code. There's a lot of good material about that on the EFF site at eff.org/issues/coders/reverse-engineering-faq In addition to the AFC test mentioned above, read about the "Compaq Computer Corp. v. Procom Technology, Inc." case, where some specific values were carried over and it was found to be infringement: "Use no code fragments" can be a hard standard to meet. Mar 24, 2018 at 16:18
  • 3
    @rootavish The question is about copyright, which is intellectual property.. Copyright law applies whether source is open or closed: without a license, it forbids various things, including certain forms of copying. If you’re acting outside any applicable license, it doesn’t matter what inapplicable licenses say, you have to stay within the copyright limitations, e.g. fair use. Mar 26, 2018 at 9:27

3 Answers 3


Reading code and then writing it down from memory, whenever you're writing down the exact code or not, can be considered "derived work" and thus could be subject to copyright (IANAL, but as far as I can recall the definitions of derived work and fair use remain fuzzy and subject to interpretation; in this specific case, and particularly if the resulting code keeps a similar structure, I would find it quite hard to claim fair use of the original work).

Your best approach to ensure that the work cannot be considered derived work is to use the clean room design technique: have one person read the code and produce functional specifications, then someone else who've never even glanced at the original code write his own implementation, thus ensuring no code from the original work can even accidentally taint the resulting project.

This of course offers no protection from patent infringements if the algorithm is covered by valid patents.


You're okay to independently and entirely re-implement an existing algorithm, and then copyright your code, as long as the algorithm isn't patented.

For example, the lzw compression algorithm used by gif was patented (the patent expired ~2004). And therefore, (a) you couldn't copyright an independently-written gif generator or viewer, and (b) you couldn't even write one without copyrighting it, and just give the code away.

And assuming no patent, then to be completely safe about copyright violation, you'd be best off reading a textbook discussion of the algorithm in a cleanroom-like fashion, e.g., https://en.wikipedia.org/wiki/Clean_room_design , rather than poring over already-copyrighted code for long hours.

  • 4
    1. The patent you mention was only regarding the LZW compression, not GIF itself. For example the statement "you couldn't copyright an independently-written gif generator or viewer" is wrong; libungif is an example of a program that avoided the patent problems (by not offering compression). 2. Patents don't inhibit your ability to copyright your code. Suppose you write a program and unknowingly violate a patent in doing so. You still can copyright your code; in fact it is copyrighted automatically.
    – Brandin
    Mar 28, 2018 at 10:35


The terms of MIT license state:

Permission is hereby granted [...] to modify [and] sublicense [...] copies of the Software, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

If you memorized the entire text of the original program, and then wrote a similar program that did not include any of the original text ("portions of the Software"), then in my opinion the attribution requirement would no longer apply and you could put your own name on the reimplementation and not credit the original authors.

Your reimplementation would still be a derived work of the original program.

  • 1
    To my knowledge, memorizing a text and writing it down again from memory is considered the same as making a copy. To really sidestep copyright issues a clean room design is needed, where the person reading the code is someone else than the person writing the new implementation and they communicate only via a specification that reflects the ideas but not their implementation. May 16, 2020 at 8:44
  • I did not say write the original text back from memory.
    – D. SM
    May 16, 2020 at 15:30
  • Even a non-literal copy is still a copy. May 17, 2020 at 6:51
  • Is "non-literal copy" the kind of copy that is not a copy?
    – D. SM
    May 17, 2020 at 15:00
  • 1
    No, it's the kind of copy that may well be infringing.
    – MadHatter
    Nov 25, 2020 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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