I have taken a small chunk of open-source code, around a hundred lines, and found that for whatever reason, I have modified it so drastically that my end result has essentially no resemblance to the original. Maybe a line or two, and a few variable names, are carried over, but the diff is just one or more big chunks of - followed by big chunks of +.

If I'm now distributing my code, it seems clear to me that I should globally credit the original author for providing a foundation, and include the license under which I acquired the code. I'm wondering what my responsibilities in the social or technical dimensions are to mark specific changes, though. Am I rudely misrepresenting the original author's work when I say that mine is derived from it without pointing out the particular lines that were carried over? Is it helpful for another coder looking at my version if I include comments annotating what I've kept and why?

I've used someone else's code as a starting point, taking primarily the ideas and not the substance. Ignoring any legal aspects,* what kind of precise, targeted change documentation should I ideally provide?

What is proper etiquette for releasing a complete rewrite of an existing project? is closely related, but I've already chosen option 1. Best practices when forking code base is also related but doesn't address the specificity of attribution.

*Various aspects of which have already been covered here.

  • what exactly is 'for whatever reason'? i think answering this in your mind will clarify your next step. Oct 4 '13 at 23:53
  • @AndyzSmith: In the particular case that prompted this question, it was speed. I think I ended up lowering the time complexity of the procedure, which meant using different framework classes, altered loop conditions, and so on. But I was interested in the general case, if that exists.
    – jscs
    Oct 5 '13 at 6:01
  • so this leads me to suggest: so yours is different, with different module dependencies, different performance characteristics, possibly superior, possible inferior in cerain respects. this should guide you as to whether to: replace, inherit from, use as a replacable strategy for, call the original, etc. IE - you may want to leave the original, add a template pattern and allow future implementors to choose the best option for them. you could slightly modify the original to fit a confirming interface that both routines would subscribe to. Oct 5 '13 at 7:15
  • Note that these suggestions are part of a more general case. EG if your code signifiantly changed the 'intent', inputs, and outputs, conceptual basis of the code, your options are quite different. even though you 'started' from the same place and 'derived' your code from the same original. the mechanism and intent of your manipulations and resulting deviation from the base-line of should guide your approach to integration Oct 5 '13 at 7:22
  • That's useful advice, @AndyzSmith. What could you suggest for a case where I'm not intending to re-integrate my revisions? The code that prompted this is a stand-alone method -- the hundred or so lines are all there are to either version.
    – jscs
    Oct 8 '13 at 7:42

Your basic obligation is to follow the original author's license terms. But beyond that, it's a good idea to mark off the section with comments that indicate the original source of the code. That allows others to follow the chain back to its origin, and bugs in one might be present in the other.

That said, there are many examples of open source or free software where this isn't the practice. In fact, the larger the project, the less likely it is that you'll find such micro-attributions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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