I am working on a side project at work where I find it beneficial to use some of my code that I have developed personally (outside of work) to speed my development. My side project is developing a C++ GUI application to let our power users run queries (built by me) against databases on several different platforms (DB2, Oracle, SQL Server and MySQL). In the past, I would usually just run these myself on request or build an Excel VBA application for them. Now that I have built several VBA applications for several different people, I find the need to build one central application that just reads in custom .sql files and executes against various databases.

The application that I am building is in C++ and uses an LGPL cross-platform GUI toolkit. However, I have a lot of code that in my own libraries that I have built over the years on leisure, non-work related projects. Is it okay to use this code at work, thus saving me (and the company) time? If so, can I port any bug fixes and enhancements back to my personal library? There seems to be a line that I do not know when I am going to cross it.

I just want to add that none of the personal code has anything to do with any business logic. They are just basic utility classes/wrappers.


7 Answers 7


Is it okay to use this code at work, thus saving me (and the company) time?

Yes, it's ethical. In the case you describe that you own the code, so you can freely give it to your company. They hired you to write code so they trust your code.

If so, can I port any bug fixes and enhancements back to my personal library?

Your contract probably forbids this unless you get permission (check your contract).

The best solution is to talk to your manager. I can't see any manager refusing your request. It also makes you look good when you point out how your personal coding is helping the company.

  • If you do the bugfixes from memory and not by actually copying the code done at work (which could possibly be tracked), it's rather difficult to prove where the idea came from; it's just as likely you did the bugfix on your free time and re-imported it to your work code
    – Izkata
    Dec 7, 2011 at 22:19
  • 1
    @Izkata: The question was about ethics, not provability. Whether it could be proved that the backporting occurred or not, the asker would still be backporting. If, as Tom Squires (probably correctly) says, the contract forbids that, then no, it would not be ethical. Dec 23, 2011 at 13:22
  • @RossPatterson The second half, about backporting, was not about ethics, and Tom seems to have interpreted it the same as I - a legal issue more than an ethical one. Besides, if bugfixes are done from memory, the code is unlikely to be identical unless it was an absurdly simple fix - in either case, no ethics are involved, it's just convergent design.
    – Izkata
    Dec 23, 2011 at 15:02
  • 1
    The real question is not about being ethical or trust, it is whether you put the code under a suitable license before you even attempt to use it at work. Think about copyright, and think it both ways.
    – JensG
    Nov 25, 2013 at 17:41

Some companies lay claim to the work you've done out of hours too. It depends on the company, some of them are big on IP control.

Everything should be down in your contract. The worry is if they lay claim to your freetime work, which has been a horror of mine.

  • 2
    this is definitely worth looking at, there is a reasonably good chance that its already their code according to the contract, and adding it to their code base almost definitely made it their code.
    – Ryathal
    Dec 7, 2011 at 13:53
  • Claiming works you've done out of your job? Is it possible? I think it must depend on which country you're working in, because as far as I know, this would be illegal in France, even if writen in your contract. Dec 7, 2011 at 14:12
  • 1
    A lot of companies try this it is impossible to enforce, on account of almost every contract also states you cannot sue your employer.
    – Woot4Moo
    Dec 7, 2011 at 16:14
  • 1
    +1 @Raythal - unless the OP licensed his work to his employer, including it in their projects without notice could have made it a work product. He may have irretrievably contaminated his personal libraries if his company finds out and gets pissy.
    – DaveE
    Dec 7, 2011 at 17:11
  • 2
    IANAL, but many IP agreements claim IP in four situations: If the work was done on company time, if it used company resources (hardware, software, etc.), if it results from work performed for the employer (possibly by using protected company information -- proprietary algorithms, etc.), or if it is related to any current business of the company or actual or anticipated research or development. The last one is the most vague, as anything could be "anticipated". I'd be interested to hear if anyone has actually been sued for this in a situation other than directly competing with their employer.
    – Cliff
    Dec 7, 2011 at 21:21

Your company may have a dedicated IP department or specialist. Check with them. Your manager should be able to put you in touch.

Certainly it's ethical; I can't imagine your company would be sorry to have more access to your work and brain-power. You want to protect yourself from losing control over your own code. Some things you might consider doing first are to create an open-source project with your code in it, and assign it a license which is compatible with your company's IP policies.

Also, look into getting official permission to release any code you contribute to it. Some (many?) companies are fine with releasing code under open-source licenses so long as there is a clear separation between the open code and the company code. This may be true even if your contract says "we own everything you do even remotely related to work". In my experience, they're mostly worried about diluting their competitive advantage in their core business. This is another reason to package your code in a suitably licensed library instead of importing it directly.

Hope this helps.


It's totally ethical. I often research new technologies and different ways of doing things at home, and more than once I've developed something at home that I wound up using in my work. I also wouldn't have any problems with bringing fixes or enhancements back home (or bringing them from home to work).

I'd only be concerned if you intended to release your work independently. If that's the case, then I wouldn't bring it in at all, and I wouldn't even try to re-use the design. As others have stated, check your employment contract and discuss it with your manager. If you don't have one of those "you work for us 24/7"-type contracts, then you could consider releasing your code under some license and using only the released code at work. Then it wouldn't really be any different from using an open-source or free software project, which I assume you're already able to do.


I absolutely agree with the previous poster, ethics is not really a problem here in my opinion, unless you contract forbids you from using non in house developed scripts/software then you might have an ethical issue.

Your issue is actually property rights.

And here there are several issues you need to think about.

What does your contract say about intellectual property ?

Does your company retain rights to things you create?

What license does your company use when developing code?

Is it compatible with your own licenses ?

These are questions you need to have answered before you develop any code, allow already developed code to go into your company's repositories or taking development back...

  • 5
    you should edit you answer to include the name of the person who wrote the answer you agree with, posts don't stay in chronological order.
    – Ryathal
    Dec 7, 2011 at 16:14

As always, it depends. In this case, on what a) the license you put on the code says and b) on what your contract says. You might want to come up with a business deal with the company that covers code you wrote before you got there.

There's no general ethical problem with this, so long as you think about it beforehand.

  • the license you put on your code may or may not be relevant depending on what your contract says, if your employer claims ownership of everything then any license you put your code under would be void because you had no right to license that code.
    – Ryathal
    Dec 7, 2011 at 19:13

It is not ethical to steal from your company - and, if you agreed that all of your work, while at work, belongs to them, then it's unethical to surreptitiously move code back into your codebase.

Asking for your manager's permission may not be enough - he may not be in a position to negotiate this with you. So, depending on circumstance, asking may not relieve you from your commitment - and may instead earn you an accomplice.

The correct way to do this sort of thing, is to be clear that you're bringing an outside project you own into the company, and then sign (or verbally agree) on a separate contract or arrangement, specifically for the outside project. Do this in advance.

Note that the legal and ethical aspects are different and don't completely agree. Even if ethical, it's sometimes not legal to bring your code into work without a contract (while, under other circumstances, it's not legal for you to keep the code at home - you're legally bound to bring it in and use it, if you, to the best of your ability, think it would benefit the company).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.