-2

I wrote a lot of code during my current job that I am now in the process of leaving.

Normally when I write programs, I refer to my old code all the time, I also have libraries of functions I include in many programs. I keep copies of those at home, and use them in my personal projects as well.

Is there any downside to reusing this code in my future job? If I do not, I would have to reproduce all of it from scratch, which would be a huge waste of time, but I know how to do it anyway. There is also absolutely no risk of future employers finding out I wrote this while employed at my previous job, since they would not have access to the previous company's resources.

What about open source and/or free code I wrote and published myself in my spare time? Do similar rules apply?

closed as off-topic by gnat, Chris E, jimm101, user42272, enderland Oct 29 '16 at 23:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking advice on company-specific regulations, agreements, or policies should be directed to your manager or HR department. Questions that address only a specific company or position are of limited use to future visitors. Questions seeking legal advice should be directed to legal professionals. For more information, click here." – gnat, Chris E, jimm101
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you write the code at come or at work ? – HopefullyHelpful Oct 29 '16 at 18:19
  • bob, is there a reason you edited out the information enderland added in? My understanding was that it was something you said in a comment, and the ownership of the code and your intended use both seem very relevant here. – David K Oct 31 '16 at 19:06
  • Yes, those parts were clearly added out of spite previously. I wrote the question and I want it to remain in its original form. I really hate the fact that others can edit my questions if they don't like it to put words in my mouth and/or put me in bad light. – bob glausl Oct 31 '16 at 19:09
  • 4
    @bobglausl enderland is a high reputation and very well respected moderator here, and I guarantee that he did not add the information out of spite. He likely just copy/pasted some of your comments to include them as they were relevant, but didn't edit them to flow with the rest of your question. Why do you not think the ownership of the code and your intended use is relevant here? – David K Oct 31 '16 at 19:17
  • 3
    And community moderation is one of the core principles of SE, so if you don't like that, then this may not be the site for you: Why can any user edit any other user's question or answer? – David K Oct 31 '16 at 19:26
10

I disagree with people saying you have to try and forget code you have written and rewrite it if you use it for something else. Most programmers I know have a bunch of snippets and code that they constantly modify, reference and reuse. It's just a more efficient way of doing things.

To my mind you'd be silly not to. Obviously not a whole project or anything like that, but useful functions seem ok. I'm not a programmer, but if I come up with a better way to solve an engineering problem I'll definitely reuse it. This is something I learnt, this is the 'experience' an employer is paying for. I'm not about to throw hard won knowledge away for some arty farty concept of intellectual property, I'm no one's slave and I'm not going to reinvent the wheel each time.

So I see nothing wrong with reusing relatively insignificant code in a different context for the sake of efficiency, although obviously using a sizeable chunk would be different. I'm expecting to garner a bunch of downvotes here though.

Many laws are open to interpretation and biased away from the individual, some are outright so vague that they can mean anything. What happens when you use code you originally made for a personal project on a work project? Does the employer now own the intellectual whatever to it? It's murky, and intentionally so in order to give employers an almost unlimited range of ownership over an employee even when he leaves.

26

I keep copies of those at home, and use them in my personal projects as well.

On the assumption that your employer owns the code you write (which will be the case unless you know otherwise), this is theft, pure and simple. You do not own this code, so you have no right use it in your personal projects.

The same applies doubly so to using it at your new employer. If you use stolen code in your personal projects, only you are going to get in trouble. Using it at your new employer means they could get into legal trouble. And don't think people won't find out - these things have a way of coming out.

  • Since you seem to be particularly picky about code being written in working hours being your property, the following might be of interest to you: workplace.stackexchange.com/questions/78614/… -- point being, things are not always so cut and clear as they might appear to be – Jivan Oct 30 '16 at 23:29
15

Consider this: Your employer paid you for doing your job. Part of your job was writing code. That code was written as a "work for hire", which makes your employer the copyright holder and effectively the "owner" of the code.

You have as much rights to this code as you have rights to the code that any of your colleagues have written: None.

PS. I hear what you want. My daughter wants a pony, guess what, she isn't getting one. Hearing that you are not just making a mistake, but that you insist that you are right, I'd be very wary of hiring you. Your argument that your employer still has his copy and you keep yours shows either intentional ignorance or complete disrespect of copyright law.

On the other hand, if you learned things during your employment, and you would now be able to write certain code very quickly because you did something similar before, that's absolutely fine.

PPS. "I completely disprespect copyright law" makes you pretty much unemployable as a software developer, since any employer hiring you knowing this would be completely liable for anything you do in their employment.

  • @gnasher729 from the accepted answer - "What happens when you use code you originally made for a personal project on a work project? Does the employer now own the intellectual whatever to it?" - interesting point... – Jivan Oct 29 '16 at 19:29
  • 1
    +1. There are exceptions when you've made specific arrangements with your employer, of course. A coworker of mine insists on having the right to bring a set of reusable code in with him and to take it (and any additions) with him when he leaves. But this is something he negotiates before taking a job. – jpmc26 Oct 29 '16 at 21:57
  • @Jivan It depends. The simplest way of avoiding any issues there is to release it to the company with a specific license (preferably something simple like MIT). If your company is okay with other code under that license, I don't see a problem. If they don't usually accept code under that license, then sit down and work out the details with them directly. In other words, deal with this before you use the code. – jpmc26 Oct 30 '16 at 0:01
  • @jpmc26 agreed in principle. But in most companies (we're not talking NASA or SpaceX here, which must have very specific chunks of very sensitive code), isn't this whole idea tending to micromanagement over insignificant details? I mean, most code snippets are just commodities today. Caring about their intellectual property feels to me like caring about how much toilet paper you would use more than you coworkers (and possibly having problems with budget department about this). For most code, the value is not in the code per se, it's in what the company does with it. – Jivan Oct 30 '16 at 6:01
  • @jpmc26 and of course by saying that I assume that the OP is talking about kind-of-simple chunks of code, like a 50-lines routine to send an email from a REST backend, or a 100-lines script to set up an application on a brand new server. Those scripts are commodities. Obviously my position wouldn't be the same if the OP were talking about a whole 25'000-lines domain-specific module which takes DNA as input and performs complex ML analysis before delivering isolated genes in output. – Jivan Oct 30 '16 at 6:08
9

I recommend that you discuss this with your employer. Consider agreeing to open source your code then both you and your employer can continue to use the code and improve and contribute to its improvements in the future. See https://opensource.org/licenses

  • Great idea, this way it would benefit not only me and the companies I work for, but also possibly other coders – bob glausl Oct 29 '16 at 9:41
  • yes exactly, and it will prevent the employer from forcing you to stop using the code on other projects. – user59397 Oct 29 '16 at 9:49
5

Use the new company's code base not your code base

The new company you are going to should already have a baseline of code available for you to use. If you have an awesome utility function that you love and add it into the company's code base, you could have easily created technical debt, unnecessary code complexity, or other bugs. This is because:

  • The company might have already had a utility function that did the same thing, and now they have two utility functions that do the same thing.
  • There may have been a reason why they did not do it your way, like special cases which are going to break on your code.
  • When you added your little function, was there any refactoring done across the entire project to make sure that it is used everywhere it can be benefited from? If not then you created technical debt, if yes then you have spent company time on something that was not broken.

Learn the new company's code base don't bring your own.

Legal issues

I am not a lawyer, but I have worked with multiple contracts, and have seen the legal barriers pop up time to time. Anything you write at work is owned either by that company or by the customer. When I say at work that includes if you did work from home for said company. Since the company or customer owns the code you wrote, you must ask for permission to retain any copies of it.

Example of customer ownership of code in action:

While I was doing government contract work, we had an awesome set of common utility libraries we created for a contract with US Government agency A, and the customer owned the code. I still had access to that baseline, but was now on a contract for US Government agency B. Even though I still had access to the first code baseline, I could not legally copy any code over even the rather useful libraries, without written authorization from Agency A, despite it being for the same government which already paid for it.

3

By the contract you agreed to when you were hired the owner of work you did for the company is the company, not you.

If you take it elsewhere without permission, that is a contract violation, whether you agree with the concept of intellectual property or not. There is absolutely no way to defend this; you are breaking your word.

If you don't like that conclusion, you should have objected when you signed the contract. That would have been ethically defensible. It would have resulted in your not being hired, of course, but you're free to try to find a paying gig which doesn't have this requirement, or to find a different kind of employment. Pick one; you don't get to unilaterally change the contract after signing.

  • No one's going to find out anyway. Why would I even mention this when trying to get hired? Are you trying to convince me to purposefully sabotage my chances? For what? – bob glausl Oct 29 '16 at 14:39
  • 3
    If you are saying "no one is going to find out" you are explicitly conceding that ethics is no longer a concern. If that is how you are willing to live your life, I can't offer anything but pity. – keshlam Oct 29 '16 at 14:42
  • 2
    I can save ethics for when I'm dealing with humans. When it's individual vs corporation, it is always the individual that matters more. Corporations don't need to be approached with "ethics" - they don't apply any when dealing with you. – bob glausl Oct 29 '16 at 14:45
  • 2
    @bobglausl then why are you asking here if you've already decided you'll just get away with it? Go away and do whatever you were planning to do in the first place. You probably make something around six figures, I don't see why you're just going to bet that to save a few hours of typing somewhere else on the chance that old company doesn't aggressively prosecute this, like many companies do. – user42272 Oct 29 '16 at 21:23
0

This is not about what you believe about software copyright, software ownership and your respect about copyright laws. Dura lex sed lex: by adding this code in the codebase of the new company you expose them to potential lawsuits.

You say that nobody will find out - this also confirms that you recognize it's fishy - but that's not your decision to make, the same way a recruiter cannot chose to discriminate against brunettes and arguing that nobody will find out.

I would have to reproduce all of it from scratch, which would be a huge waste of time, but I know how to do it anyway.

Again, I can't imagine a company taking the risk to save a couple of days of work. Besides, I'd be thrilled to have a chance to rewrite any piece of code - improving the architecture, better tests etc. Perhaps this time start it as an open source project (doesn't have to be on personal time either as it's not rare for companies to have open source projects) - that way you'll avoid having the same dilemma in the future and potentially help others.

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