I've been writing a docking framework in JavaFX. This is a new library with original work. However, I have been reading the source code of a few other open source docking projects to get some hints on how to go about this - some of which are licensed under LGPL.

I was wondering exactly how different I need to make my code in order for it to be considered unique. Can include small chunks of code (say 10 or 20 lines) from other sources if there is really not a better way to write it? Can I copy the general concepts being used as to how the windows are laid out? Can I use the same or similar name for my variables? I'm thinking of eventually releasing this code under Apache 2.0, so being able to extract it from LGPL would be helpful.

Can [I] include small chunks of code (say 10 or 20 lines) from other sources [without respecting the license] if there is really not a better way to write it?

The simple answer is No. If you copy code and that code is protectable by copyright, you must adhere to its license. There is no specific amount of code as a number of lines that would say whether a piece of code is copyrightable or not. As an example, suppose the program you copied looked like this:

printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");

Suppose you copied these 10 lines, and then decided it is better to express this repetition using a for loop and a variable i to keep track of the iteration number:

for (int i = 0; i < 10; i++) {
    printf("Hello, world!\n");
}

If the 10 lines were copyrightable, you've still copied the 10 lines and produced a derivative work. Rewriting it as a for loop, and the fact that it is now 3 lines long, does not change this. However, for this example it's not likely that the example is copyrightable. It is not original and there are only a few ways to print the string "Hello, world!" ten times.

But suppose the ten lines were this:

printf("It was the best of times,\n");
printf("it was the worst of times,\n");
printf("it was the age of wisdom,\n");
printf("it was the age of foolishness,\n");
printf("it was the epoch of belief,\n");
printf("it was the epoch of incredulity,\n");
printf("it was the season of Light,\n");
printf("it was the season of Darkness,\n");
printf("it was the spring of hope,\n");
printf("it was the winter of despair,\n");

Is it copyrightable? It appears to be an original expression and creative. You may recognize the words as a copy of a portion of a work by Charles Dickens. The fact that I wrote it as C programming statements does not change that I took it directly from the famous work, even if I have memorized these 10 lines and recited them from memory. In this case, the work is now in the public domain so no copyright infringement is possible. Even if it were still protected by copyright, you could make an argument that I am using it as a fair use or fair dealing if applicable. But that would depend on the reason for copying, the effect on the market by my copying and so on.

Can I copy the general concepts being used as to how the windows are laid out?

Concepts are not copyrightable. They may be patentable though. Algorithms are generally not copyrightable, but a specific implementation of an algorithm is. Here is a famous one:

def gcd(A, B):
    if B == 0:
        return A
    else:
        return gcd(B, A % B)

It is an implementation of Euclid's algorithm for computing the greatest common divisor written in Python syntax. As an example, if you write your own implementation of Euclid's algorithm in another language, or if you write your own implementation in Python and it happens to be exactly the same as mine, you have almost certainly not infringed my copyright on this implementation. How many ways really exist to write Euclid's algorithm? You could write it recursively as it was done here, you could write it iteratively, you could change the names or syntax and so on. Ultimately there are very few ways, so this is an example of something that you could use without worrying about copyright. But if you consider all the computer source code that exists, the vast majority is probably not like this, so you have to assume it is protectable unless you have a reason to believe otherwise.

Can I use the same or similar name for my variables?

Names are not copyrightable. That said, if your idea is to copy code and change all the names of variables, don't do that, as it won't work.

If I obfuscate someone else's source code, can I avoid copyright infringement?

If you copy a work and change all the names, you've still made a copy (a derivative work). Look at the above gcd example. If you decide to name 'gcd' something else, or name the variables something other than 'A' or 'B', you've still made a derivative work. Of course, in that example, it doesn't matter. But for a larger example, simply changing all the names to try to pretend that you aren't copying someone else's work will probably become fairly obvious if someone looks closely.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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