I have written a small library of classes in my preferred language (PHP, but it doesn't really matter), and typically use them in most of my projects.

Until now, the projects have been personal, or small stuff at my part time job that isn't really a commercial product. Neither of these things worry me as far as the freedom I have to reuse those same libraries later. [On that note, should I be worried about the part time job uses? Could those cause issues with my libraries later?]

Soon, however, I expect to enter into more serious free-lance/contract work that I have no doubt will use the libraries I've written.

Do I need to make sure the contract or work terms explicitly allows me to use my previous code in the project and - more importantly - after the project, or is a Github history showing that it was clearly developed long before any contract enough?

What are the legal troubles with code like this (libraries, code reuse, open-source, etc.)?

3 Answers 3


It is good to think carefully about these issues ahead of time, even though you seem to have everything in hand.

  1. You do need to make the employer aware that you are going to be licensing this code to them (sourcecode license, in perpetuity, for derived works etc).

  2. You should document that licence explicitly (by reference) in the source code and possibly the user interface, and in a signed agreement with your employer.

  3. That gives them an opportunity to make an informed choice.

  4. Be very careful about and talk to your boss about derived works that you make on their behalf (they would naturally/legally own all derived works made on their behalf, they may be unhappy or surprised to see derived works on github).

  5. It would be a lot be easier for you to fully open source the code first, then you can say in the agreement that contributions/enhancements to your project x are expected, and contributions are explicitly under the same open source license.

  6. You might need to talk to a lawyer in terms of evening work that you do on the project, I often see language in contracts that doesn't allow you to own your IP created while an employee/contractor of a company (even in the evenings).

Talking to your employer about this might be a good thing, or could label you a pedant (like most programmers) so tread lightly.

My wife went through this when she started teaching. She brought her teaching materials into the school. So she got her contributions documented at the start so she can use them in future.

  • Thanks for the answers, guys, I picked one arbitrarily, because they both have valid info. Thanks again!
    – rockerest
    Jul 12, 2011 at 4:22

Typically, I would suggest that you discuss this with your employer. They typically provide you with a form that let you declare any IP that you possess prior to entering into the contract. If better you declare your work before hand, or they can consider you produce such work within the duration of the contracted work.

You mentioned about the time stamp on GitHub, but why getting yourself in the position of having to prove your innocence when you could have just declare it before hand?

  • Why? To cover your ass. Let's say one of those part-time jobs, who has the library and thinks they own it, develops it further and it becomes wildly successful. Then they see his new job using their what appears to be their code. Now all eyes turn to rockerest demanding an explanation.
    – Philip
    Jul 11, 2011 at 14:48
  • Philip, you are actually proving my point. I was saying that it is nice to have timestamp from GitHub to cover your ass, but if you can, come clean and declare your IP before entering the contract, so you won't have to waste time trying to defend yourself. Not sure about other companies, but when I joined Microsoft (not with MSFT now), I had to declare a list of my IP and previous works, so to avoid confusion. That's why I suggested OP to discuss with his/her employer beforehand.
    – Antony
    Jul 11, 2011 at 20:39
  • Thanks for the answers, guys, I picked one arbitrarily, because they both have valid info. Thanks again!
    – rockerest
    Jul 12, 2011 at 4:22

In addition to the other points raised, don't assume you only have to have one license.

You could happily release one version to the public under GPL and have another which you license to your commercial customers with support. My answer to another related question might be interesting to you.

  • There are important questions with a dual licencing approach, as in expectations, code ownership and governance. Jan 14, 2014 at 8:36
  • Which is why @AndrewRussell the answer of mine, which I reference in my answer, specifically has a section on Dual License Contributor Agreements. Since the original question doesn't mention anyone else contributing back to the project, I didn't feel that was necessary here.
    – Mark Booth
    Jan 14, 2014 at 13:30

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.