Take the 2-minute tour ×

I'm coding something for my job to copy directories and then use regex to make all the filenames uniform. I'm an undergrad student programmer for my university and I'm not sure what a professional coder would consider reasonable in this case. My job is mostly to implement mathematical research. The current assignment is outside what I've been doing and seems like it would be really useful to have some of the functions available in case I (most likely) encounter a similar assignment at some point in my career in the future. It's going to be really useful because the current filenames are so screwed right now that the admin assistants can't really keep up (and even trying to do so might just cause more human error). I'm thinking that it may not overall be useful outside the current assignment because the regex will be so customised to the way the file are incorrectly named.

I'm wondering if this is simple work for a pro coder, and therefore I'm making this program to be much more important in my head than it actually is, or if this is something that a coder would really want to copyright or otherwise retain the ability to use this whenever and wherever else they feel like. They've already told me that there is no question that I'll be given credit for the work, which I'm excited about. My only concern was whether I should be thinking about reusing this code later or if this task is so generic that a pro coder would laugh about keeping the rights to such code.

This thread was interesting but seems different from my situation:

How can I reuse generic code for consulting between companies?


Florida, USA

share|improve this question

4 Answers 4

up vote 9 down vote accepted

You can never not copyright code. Code is copyrighted as soon as it is written. The real question is who owns the copyright. The applicable area of law is known as work for hire and this is very subject to national variations.

Typically, when you work for some employer, all materials that you produce during the period of employment that is for the employer is owned by the employer (thats what you get paid to do).

If your employer licenses the code in such a way that you can use it elsewhere, then go for it. If your employer says "no, you can't use this code", then that is the answer.

Read your contract, talk to your employer and maybe talk to a lawyer. Don't reuse the code until you have done at least two of these things.

share|improve this answer
So I'm not sure what is different or the same code (going by variable names or structural similarities, etc.). Have you heard about a coder going to another job and then writing code to do a similar task but the code looks similar (because it's just the way that coder writes or has determined to be most efficient, etc.)? –  stackuser Aug 28 '13 at 23:02
I have heard of coders going from one company to another where they worked on very similar areas. When the two companies got into legal battles, the coder's new code was investigated to see if it was a copy of or derivative of the material he wrote for the first company. This doesn't come up until there is a legal battle. –  MichaelT Aug 28 '13 at 23:08
@stackuser That was more or less the heart of the Oracle Google suit. Google hired someone who worked on Java to work on the Android SDK. It was determined the amount, and type of code copied didn't amount to a violation. It very well could have turned out otherwise if it had been more or different code. –  stonemetal Aug 29 '13 at 14:47
@stonemetal I've also seen it with Sun and SGI (SGI had hired away some Sun NFS engineers - this one didn't go anywhere) and Netapp and Sun (the whole zfs thing). –  MichaelT Aug 29 '13 at 14:51

The other answers address the legal aspects of the problem & @MichaelT is (AFAIK) correct - it's a work for hire & your employer owns it.

From a practical point of view, you're right in thinking that this code is likely so simple and generic that it's not worth paying attention to who owns it. It's a minor part of an academic project where the 'real work' has nothing to do with file management. It's probably only about a dozen lines of shell script that nobody's ever going to notice.

As long as you don't try selling it as a product or publishing it publicly, keep it around for reference. Use it where you need to. Nobody's ever going to notice or care. It's the IP equivalent of jaywalking.

share|improve this answer

In the UK, the default owner of copyright is different from the accepted answer.

In the UK, copyright is, by default owned by the person who creates the line of code. However, if you are employed as a developer then:

  • It is normal for your terms of employment will include a clause to assign ownership of 'designs' to your employer.
  • If your contract does not state it explicitly, because these terms are a normal clause for software developers, they will still be deemed as 'implied' in the contract, unless you can get something in writing to counter this.

However, if your job role is not one that either does not have such a clause, or its not a normal for your job role to create intellectual property then you own copyright for your code.

It is often possible to get wavers of ownership from employers if you are contributing a to a non commercial project.

share|improve this answer

There are a couple ways you can handle this nicely:

a. Write the code, then get permission from your employer to publicly blog or otherwise make available the non confidential parts (exclude the regular expression for their particular file names for example).

Now, that code is in the public domain, you are free to copy and paste it later.

b. Create an exercise for yourself where you solve a similar problem. Write new code (don't copy what you wrote at work) to solve it. You now "own" your own solution to the problem which you can reuse anytime you wish.

In my case, I work on a lot of my own projects. While my company owns work I produce during work hours, if I create something similar for my personal use for something unrelated to work, they don't own it. At that point, if I happen to go work elsewhere, I'm certainly free to reuse my own independently written code.

*Note, I in no way suggest that you use anything designed specifically for your employer as your own! If confused - reread - it definitely says "create an exercise for yourself" which you work on on your own time. That's how you generate your own IP w/o having to get employer permission (caveat: don't run afoul of any non-competes).

share|improve this answer
as pointed in another answer, "Typically, when you work for some employer, all materials that you produce during the period of employment that is for the employer is owned by the employer". And in yet another answer, "It is normal for your terms of employment will include a clause to assign ownership of 'designs' to your employer." –  gnat Jan 28 at 17:40
@gnat, I don't think you understand. All materials that you produce during the period of employment while in the capacity of an employee belong to your employer. They don't own (mostly) stuff you produce outside of work hours. If I work for a rocket company designing rockets and in my spare time on the weekends, I build insulin pumps, my employer does not own my designs to insulin pumps. That would be ridiculous and laughed out of any court. –  iheanyi Jan 28 at 18:04
@gnat, furthermore, you are protected to some degree even if something you worked on is similar to work. Let's say at work, I came up with code to reverse the digits in a number. Then later at home, I'm participating in an online programming contest, and I come up with a completely different way to do it - not influenced by anything I did at work - that completely different way belongs to me. My "anti-compete" clause may keep me from using it for a certain period of time to earn money, but I still own it. –  iheanyi Jan 28 at 18:11
@gnat or here's another example. I need to write code to reverse digits. I look online, find a website that presents lots of different algorithms, and use it. That I used that code at my job doesn't preclude me from using it elsewhere. If you are under contract, you really need to review what you signed and make sure you understand it. –  iheanyi Jan 28 at 18:13
@iheanyi You mean I'm actually going to have to read it to you? [sigh]. Ok, here goes: "Few if any legal systems have a process for reliably donating works to the public domain. They may even prohibit any attempt by copyright owners to surrender rights automatically conferred by law, particularly moral rights. An alternative is for copyright holders to issue a licence which irrevocably grants as many rights as possible to the general public, e.g., the CC0 licence from Creative Commons." Public domain, by definition, does not require a license. –  Robert Harvey Jan 30 at 16:57

Your Answer


