Well I don't want to make it open-source! That's the problem. But I do want to use it on my current job. Company did not agree to sign any alternative license with me and told me to rewrite everything from scratch so they will own it. :(

So how can I do it in a safe way so later on the company don't come back to me and say that I am using the code I wrote for them, which will be similar to the first version I wrote and own the copyright, on my personal projects or even on another job?

How would you rewrite a second version of a hash map without making it look like the first version? This sounds kind of hard to me. :(

  • 12
    When I find some little snippet of code that I've accidentally written in two different places it's often nearly character by character identical. God I hope I never have to prove that in court.
    – psr
    Mar 14, 2013 at 0:10
  • 1
    @psr - That seems to imply that you either do is perfectly the first time, or you aren't growing in your ability and realizing that there is a better way to do some tasks that you didn't see before. Mar 14, 2013 at 1:04
  • 1
    Looks like you are facing a conflict of interest. The wise way would be to decline the assignment, but it is not an easy way if the risk is to be fired.
    – mouviciel
    Mar 14, 2013 at 5:41
  • 1
    @JamesBlack "little snippet" - some 5-line functions really are like that and can't be improved upon except by improving the language itself. I've come across the same in my own code on rare occasion.
    – Izkata
    Mar 15, 2013 at 2:04

4 Answers 4


You need to speak with an attorney who specializes in copyright. That's copyright, not intellectual property. "Intellectual property" is a false combination of patent and copyright, which are two completely separate fields of law.

I'm assuming you're in the United States for the rest of this.

My personal recommendation is that, before you go any farther, you take your current source and do a formal copyright registration on it, including filing a complete copy of your work with the US Copyright Office, just like with a book or a song. (Note: Filing a full copy of the work along with the registration application is required by law for registration.)

Every copyright attorney in the United States will tell you that there is no substitute for a copyright registration certificate. There has been exactly one case* in all of history where the guy with the copyright registration certificate didn't win.

Copyright registration is cheap.

After you have the copyright registration certificate in your hands, then you start doing their rewrite. You can start doing design work, but do not write a single line of their code without first protecting yours.

* (Specifically, that was the George Harrison "My Sweet Lord" case: although the Beatles did have the copyright registration certificate, the judge ruled that there was no possible way he could have completely independently reinvented the melody and organization from "He's So Fine" (The Chiffons): there HAD to have been copying, even unconsciously.)

  • That's great info, John. Are you saying that even if I unintentionally write a block of code that looks very much like the one I have a copyright registration, then in the event of a dispute I should be safe. That's awesome and give peace of mind! Amazing info, John! Thanks! Mar 14, 2013 at 1:12
  • 1
    @John I have corrected your answer because it was Georges Harrison, not John Harrison ;-) Mar 14, 2013 at 1:52
  • 2
    Great answer, but randomly CAPITALIZING words in the MIDDLE of the sentences seems.. very meh to me. Isn't that what bolding is for?
    – l46kok
    Mar 14, 2013 at 8:39
  • 1
    "filing a complete copy of your work with the appropriate agency" HORRIBLE ADVICE. You've just released your source to everyone in the world, 99% of which doesn't give a fig for you 'copy rights'. You'd have more rights if you open sourced it properly. Mar 15, 2013 at 0:16
  • 2
    @John R. Strohm - you are mistaken. "Copyright protection exists from the time the work is created in a fixed, tangible form of expression." Google it, that's the law. Mar 16, 2013 at 2:52

This is a great opportunity to use a pre-existing third-party open source solution, if one exists for your use case. Consider the advantages to both you and your employer:


  • No need to worry about messy IP.
  • You can learn an industry standard framework or library, which is something you can add to your resume.

Your Employer

  • No need to worry about messy IP.
  • No need to spend money paying an employee to write something from scratch.
  • The code is more likely to have been tested by multiple people in multiple environments, meaning it should be more stable and secure.
  • If the open source project is well known, it will be easier to bring in other programmers in the future.
  • 2
    Although a valid an interesting suggestion, it does not address the question. :) Mar 14, 2013 at 0:26
  • 7
    @chrisapotek - this answer does address your question. Namely - don't rewrite your code. Find another alternative.
    – user53019
    Mar 14, 2013 at 13:42

First, you should consult an attorney to find out what options you have.

But, a hashmap is a standard collection, if you have made one that has a specific purpose, change the data types it is working with, perhaps, and it will be different, especially if you can have some attributes in one program that isn't in the other.

And, if you sit down with a blank sheet of paper and rewrite the code, I expect it will be different, as you have probably learned some ideas since you wrote your original one.

IP is always tricky as they can't tell you to not use what you have learned, but don't copy from your own projects, just write everything from scratch, and it will help to alleviate these issues, I expect.

But, again, talk with a lawyer.

  • Thanks. The hash map was just an example. It is a low level framework. I wonder if it is ok to copy some blocks of code or blocks of logic. Probably not. But still. I wonder if there is some kind of SHARING license that SHARES the code between two people without making it OPEN SOURCE. If companies use open source, why would they not use that? I guess the problems will be the improvements on top of it while you are employed. :( But with open source the improvements also belong to the community. So my question now is: why would a company share with the world but not with its employee? Mar 14, 2013 at 0:27
  • Either you company will pay you to write it from scratch, so you just sit down and write the program, or, if they want to save money then they would need to make some deal so you can use what you already wrote. You could suggest it would save money if you use your code, but, you want to be allowed to take any improvements you make to the code to be used in your own projects (that would need to be in writing). Mar 14, 2013 at 1:06

Use a different language! Re-write your C in Java or vice-versa. That way there is no possibility of long sequences of code looking the same.

  • a bubblesort in any language is still a bubblesort Mar 15, 2013 at 3:16
  • 1
    @Dan Pichelman -- Copyright applies solely to the text (that is the actual typed characters) of the program. Algorithms and methods are covered by patents which is a whole 'nother bag of scorpions. Mar 15, 2013 at 3:57
  • @JamesAnderson As far as I remember, some other people on this site claim that a translated work would still be under copyright protection. I don't remember exactly what questions or answers though.
    – KajMagnus
    Mar 19, 2013 at 20:25

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.