Using classes from internet sources

This page describes how we deal with sources from internet sources, like stackoverflow or some blog post etc.

Without a license we cannot use it

A license defines how you can use the given code. Without a given license, there is no license to the code and the code fragment cannot be used safely.

How to find the license

  • Often the license is official defined for some of the platforms. Here is what Stackoverflow says to that: https://blog.stackexchange.com/2009/06/attribution-required/
  • If the snippet is listed on the ticketing system of a library, it is safe to say that the patch/modification is licensed under the same license as the product/library.

What to do with copied code

  1. We explicitely tell that the code was copied from somewhere
  2. We explicitely tell what license the code is under
  3. We link to the homepage/page where we took the code from
  4. We name the author of the code (if at all possible) - even better we link to the authors profile

 

Example
/**
 * Pattern matcher for simple strings with '*' wildcard characters. The supplied template may take
 * the form "xxx" for an exact match, "xxx*" for a match on leading characters only, "*xxx" to match
 * on trailing characters only, or "xxx*yyy" to match on both leading and trailing. It can also
 * include multiple '*' characters when more than one part of the match is wildcarded.
 * <p>
 * <b>IMPORTANT:</b> The class code is copied/taken from <a
 * href="http://www.ibm.com/developerworks/java/library/j-dyn0203.html">IBM developers Works</a>.
 * Original author is Dennis Sosnoski. License info can be found <a
 * href="http://www.ibm.com/developerworks/apps/download/index.jsp
 * ?contentid=10908&filename=j-dyn0203-source.zip&method=http&locale=">here</a>.
 * 
 * @author Dennis Sosnoski
 */
public class SimpleMatchPattern implements IMatchPattern {

 

Important: Copying is not the same as modifying

  • legally speaking if you take the code (e.g. licensed by CC-ShareAlike like StackOverflow) and modify it, this is a modification of the given code and necessitates that the final code may be treated differently (in case of the CC-ShareAlike we would need to put the modification under a similar license again)
  • If possible just copy and do not modify
  • Note that the impact is most likely not life or die, especially as we are an open source project.