views:

1337

answers:

20

Should I be backing up my "gold nuggets" of code to a personal drive? I would be hard-pressed to recreate some of this code if I was ever to leave my company.

Where's the line? Is it my intellectual property or the company's? Do I have a right to reference code I wrote while employed somewhere else?

A: 

It should be stated in your contract loud and clear :) If not - why not back it up for your own personal reviews? ;)

Per Hornshøj-Schierbeck
+1  A: 

Your contract would usually specify the conditions under which you are working, including the copyright of the creations you make for your employer. Usually these rights are transferred completely to the company you work for.

Evil Activity
+5  A: 

I have always taken a code snippet library of my own making with me from job to job. I have added much to my value as an employee this way.

Copying entire projects onto hard-drives and carting them around, though, is just not on and is effectively theft.

Galwegian
A: 

As a gut feeling i would say snippets = yes. Full source code = no.

Gary Willoughby
+2  A: 

I'm pretty sure your employer reserves all rights to your work. Anyway, as you go on you'll find better ways of doing things and think "boy, that code I wrote a year ago sure is crap, I should rewrite it".

auramo
A: 

At least at our workplace, the contract says, anything produced at work is the intellectual property of the company. And it should be, as they are paying for it.

In fact, I am pretty sure if you save something on your 'personal drive' and take it with you, it would be considered as theft by a lot of provisions on the law.

Vaibhav
A: 

MY current contract says that everything I do at work is the companies property. Don't worry so much about this, I make notes of the idea or the process that I found useful no specific syntax.

cjheath
+2  A: 

Work-for-hire generally belongs to your employer. Making personal copies and using them outside the scope of that employment would be copyright infringement.

If you go work somewhere else, you wouldn't be doing your new employer any favors by reusing your previous employers' code. You are just opening them up to a lawsuit if anyone finds out.

Those "gold nuggets" aren't really as valuable as you think. If you wrote that code once, you can do it again, and probably do it better.

Kristopher Johnson
+1  A: 

I think the common rule in most countries is, if you write your Apps of company hardware they own it. But as you authored it you can certainly reference the work as for using it in another commercial app you open yourself up to all sorts of trouble. If the company is a large agressive type they may well take action.

Crassusg
+1  A: 

As pointed out, there's really no point on keeping personal copies of anything that aren't small code snippets.

If you are a good developer, you'll find out in a few months that your "gold nuggets" aren't really worth a thing and you'll probably feel the urge to rewrite them in a better, clearer way.

Vicent Marti
+1  A: 

Very interesting topic. As far as I know, most companies do not make much effort to protect their code from the programmers themselves, the most important reason being that they are pretty much not able to do that at all.

I guess most of us probably take their work (thus source code as well) home from time to time. Now, how can you possibly, once you leave a company, resist using code you've already written? Honestly, I do not know where the line is. Each of us has the line set up a bit differently.

Using complete solutions is, however, plain stealing, which I do not advocate. Code snippets and portions of your code (if you write reusable code, then even whole classes) are, in my opinion, the line most people stop at.

petr k.
+39  A: 

Your code usually belongs to your employer and you can get in trouble for 'stealing' it if your security guys are really nasty. On the other hand the value of your code snippets is less valuable then you think and you will always write better and cleaner code later on when you will need to. If you found a solution to a particularly tricky problem - just write a blog entry about it and add some code to it. This way you solve your problem, make a note for future use and help the community.

Ilya Kochetov
I most definitely agree. Most of the time it's not really the code you want, well kind of... It's the solution to that particular problem, so it's nice to have notes on how to approach the problem without having actual hard answers. You always come up with something smarter the next time round.
Steve
Even better, turn your problem into a question and post to StackOverflow!
Aydsman
Roger that: Don't ever take a piece of code directly from an application that doesn't belong to you. Instead write a quick "how-to" describing the problem and solution and write a simplified version of the code that doesn't have anything specifically related to your employer's products.
STW
+3  A: 

Just one small clarification to add to this - in most countries, even if the contract doesn't mention it, work done while employed by a company is work for hire and belongs exclusively to them.

If this is the case the only way you can legally use it is under 'fair use' provisions which may allow you to quote, for illustrative purposes, small segments of code written by you - or indeed by anyone else. Fair use probably does not cover taking it away and reusing it at the next place you work.

Leigh Caldwell
That's completely wrong.
Developer Art
+4  A: 

Just random thoughts about that...

Officially, everything I code at work belongs to my employer. Everything I write at home is mine.

Now, most of the interesting code I write is done at home... It is a fact of life... :-)

If I bring it at work, this pasted snippet of code becomes "property" of my employer in the sense I have no right to take it back. Now, as this code was "copy/pasted" from elsewhere (i.e. my home, on my personal time), my employer have no right to stop me using the original code elsewhere. And if he/she's bright enough, she will prefer to have me silently update the at-work code with the bug corrections from the at-home code.

In a similar way, I started writing an HTML document with my "C++ tips, knowledge, etc." My employer was interested in it (adding it to the internal Wiki), so I have added a Creative Commons to the document (and have had removed a license on the Wiki saying everything inside was my employer's), and I only work on it at home, but for the more trivial modifications (i.e. typos, etc.). As already mentioned before, a good way to be sure everyone understands who's owning what is to publish the document on the Internet before giving it to. Anyway, the wiki version is always one or two (or more) steps behind the original HTML version...

As for snippets of code, like "an empty Visual C++ DLL project" or "my split function to split a string into a vector of string", it could be both easily reproduced at home (i.e. not patentable), and mostly not an industry secret, so I guess no one really cares about that.

Now, should I bring back home a full strategic source code, on which my employer is supposed to have an edge over the, like the "in-company XML engine" or "tax optimizer engine", I believe my employer would be rightly pissed off. And I could well be rightly sued and condemned for that.

So... Don't bring home code that is among the "edge code" or the "business code" of your employer. Anything else he/she won't care, I guess. The whole game is finding what is business code, and what is "generic code".

Now, I am not sure, but some employers use copy/pasted sources without keeping the licenses (this is evil, but, hey... Not everyone is as law-abiding as you and I). If you find yourself working inside one, just remind the potentially pissed-off employer that they are less than pristine in the copy/paste sin. He/she has a lot more to lose than you have if he/she sues you for your little "split" function only to be counter-sued by the author of the XML parser whose license disappeared from the sources.

paercebal
A: 

Depends on the country of origin, and the terms of your contract.

As an example, my current contract says that all code I write belongs to the company (or in most cases, to the company's current client who has commisioned the code). However, that is just the code I have actually written. The ideas that went into it aren't and can't legally be covered, so they continue to belong to yourself.

That's the law in the UK though, and it is explicitly stated in my contract about the copyright terms of my work. With such a question, the laws of the country of origin take precedence.

workmad3
+3  A: 

Here's one approach I have used to navigate the gray area of "gold nuggets". Blog them. Put your brilliant coding ideas on the internet, on behalf of your employer. Put a generous license on it.

Now, when you are no longer employed there, you have access to the code same as anyone else.

In this approach, everyone wins. You get to share your ideas with your peers, and have access to them in the future. Other programmers benefit from them, too (can you say gift economy?). Your employer looks good for contributing to the state of the art.

(Obviously, you need your boss's approval for this to work out.)

Jay Bazuzi
+21  A: 

Since I'm new to the site I can't yet comment on other user's posts, but I absolutely have to point out some flaws in the so called "answer".

Your code usually belongs to your employer and you can get in trouble for 'stealing' it if your security guys are really nasty.

First off, it's not the security guys you need to worry about, it's the legal guys. As stated multiple times in responses to the question, if you are work-for-hire or are employed by the company there is almost always a contract in place that states any and all work produced by you is the sole property of the company. If there is not a contract in place there may be a local or state law. Check your statutes. Also, taking the code from your employer when it is their property constitutes theft of Intellectual Property. You can be both sued in civil court and/or charged with a crime.

Additionally, if you take that code with you to a competitor, and you signed either a "non-compete" agreement or a "non-disclosure" agreement with your company you can can be held personally liable and again taken to court.

On the other hand the value of your code snippets is less valuable then you think and you will always write better and cleaner code later on when you will need to.

It depends on the snippet of code. If you work for a financial institution and that snippet is a key part to evaluating a security for a particular strategy.... well thats huge. If it's a snippet that iterates through a tree quickly, that's nothing.

If you found a solution to a particularly tricky problem - just write a blog entry about it and add some code to it. This way you solve your problem, make a note for future use and help the community.

In this last part I've highlighted the problem. Posting a general approach to a problem is not likely to be seen as malicious or in violation of the contracts you've signed. However, posting code for it... that might take it farther than the lawyers defending the contracts would like. Especially when you post it on a public forum such as a blog or say even this site. That is worse than keeping a copy for your own personal use.

All in all it's an ethical decision that must be made based on your own risk preference in regards to lawsuits, the jurisdiction you live/work in, and the contracts you may or may not be committed to. I like to say that if you have to stop and think about whether or not it's ethical to do something, it's probably not.

randy
You're right -- just because its a blog post doesnt' mean you can copy up the code and its now "clean" for all to use.
quip
you could post it in another language or in pseudo code though
brice
A: 

If you were an employee, or an independent contractor performing "work for hire" (explicit written clause), the employer/client owns the copyright for the code.

Jen
A: 

Code snippets are yours and just yours. The overall solution, code base, versions etc. which comprises an unit for a competitive edge to your employer is his. Yet if you work for some open source project and your employer encourage you to adhere to the community ( those places are getting even more popular ) is quite the opposite.

YordanGeorgiev
A: 

It depends on the type of work you're doing whether you'd even want to or would be able to reuse any of the code, right? If you write business logic all day specific to the domain of your employer (and you don't leave and head straight to a competitor with the whole darn app, which would obviously be stealing and against your NDA/contract/state and federal laws/etc.) what good are the classes and modules you built, in terms of reusability?

If you are fortunate enough to write useful libraries that you could imagine would be useful in general projects (like: why isn't this dialog box or smart picture control part of the .NET framework?) but those libraries are not related to the core value of your employer's software, you may be able to ask your boss about reusing them in the future for personal projects. This will obvious vary for your situation, but as others have mentioned, the sort of 'snippets' of stuff you would hope to come across in the course of development, or find on SO, for example, may qualify for future personal reuse. Maybe you asked a question on SO and then answered it yourself with a snippet of code. Your boss and your legal department would be a good place to check but if you (1) know the tone of your company and (2) don't misappropriate their entire IP and especially (3) don't walk off with the source straight to a competitor, you're more likely to be safe. IANAL and YMMV.

Jared Updike