

Ask HN: Using personal code at work - jskopek

I'm developing a number of web applications for my university over the summer months in PHP. I've been working with the language for years, and have developed a number of custom database and template handling classes that I can hardly live without. I want to integrate these into the projects I’m developing over the summer, but I don't want to get bit in the ass if I use them in a personal project in the months ahead.<p>Has anyone here run into the same sort of issue as me? Is it a legitimate concern, and is there an easy way to address it? I'm perfectly fine with opening up/sharing my code with the rest of the world if that might solve the issue. Would a simple confirmation with my boss hold up in court?
======
bbuffone
I would publicly open source the code, placing it in either Google Code or
Github with a BSD or Apache 2.0 license. Doing this will protect both you and
the university from using random (though your) unlicensed code in the project.

Placing the code in Guthub or Google Code will make it much easier to validate
that it is truly open source and will allow the next developer on the project
to download the latest updates.

~~~
Tichy
That's what I would do, too, but also verify with the employer over the summer
that he is fine with open source code to be integrated into the project.

Also it might happen that while integrating it, improvements to the open
source code come to mind. Then it should be clear from the start if it would
be OK to feed improvements created during employed time back into the open
source project.

~~~
delano
I agree and I would also check the contract for an "Entire Agreement" clause
which basically says that side agreements, whether verbal or written, are not
considered part of the agreement.

------
russell
I have done it before. I put my personal copyright in the code. Then I ask
permission in a letter to to include it. I have never had a problem. This was
in the days when every line of code was part of the crown jewels. It is a
legitimate concern, but easily handled, very unlikely to appear in court.

You do need to give them pretty much open ended permission to use the code. A
BSD license might make it easier, because they know how to deal with licenses.

If the code is closely related to their core competencies, it is much more
complicated. For example, supplying trading algorithms to a bank.

If your code is really generic, maybe all you need is a comment telling where
the code came from. Still mention it to your manager.

Aside: I consider it good professional practice to mention in comments the
source of an algorithm or code snipit. Future maintainers will appreciate.

------
dctoedt
It wasn't clear whether the university is your employer, or whether you're a
student. Some general thoughts:

A) Double-check your employment agreement for clauses that might give
ownership of the code to your employer, even though you thought you were
developing the code on your own time. (In some U.S. jurisdictions, overly-
aggressive clauses along that line may be unenforceable.)

B) If you developed the code in question before going to work for your
employer, keep an eye out for ways to demonstrate that fact. (In court, truth
is always the goal, but what actually matters is admissible evidence.)

C) "Playing nice" is usually the best approach.

D) It's almost as important to be able to document that you played nice --
without being too self-serving in your writing -- as it is actually to play
nice. That's because in court, judges and juries can sometimes be skeptical of
the testimony of witnesses who have interests to protect; contemporaneous
written documentation is often regarded as more reliable.

E) Assuming your employment contract doesn't contain any special language
giving your employer the ownership of your code, a simple exchange of emails
-- which you'll want to keep in your personal files -- may well do the trick.
At a minimum, it would make a lawyer for your employer think hard before
recommending taking any action against you.

F) If you're a university student, vice employee, the ownership issue might be
a bit more complicated, but OTOH the university may be less likely to care
about ownership than a company would.

(Usual disclaimer: Don't rely on this as a substitute for legal advice,
consult a lawyer, etc.)

------
pj
I would suggest reading about "Work for Hire" it's a legal term. I'm not a
lawyer, so don't take what I'm about to say as legal advice, just my personal
experience.

In my understanding, in general, if you are paid to do it and there is no
explicit contract that says the employer owns your work, then you own the
work. However, you must look at your contract with your employer. I am
guessing you signed something saying the University owns what you do while you
work there, most do. Universities are smart like that. It may be a sticky
issue to say who wrote what and when, so probably best to avoid using your own
code at work if you want to retain ownership of it.

<http://duckduckgo.com/?q=%22work+for+hire%22>

If I were in your situation, I'd take the opportunity to solve the problem in
/another/ way, one that may be better. Worst case scenario, your brain gets
bigger and you can still do things the way you were doing them before you
wrote the new way for the university.

------
JimmyL
Talk to you boss, and look at your contract (assuming you have one that covers
this). Most will have some clause in there saying that if you use code that
you created before your employment, by using it at work you're giving the
University an unlimited and irrevocable license to use that code.

In terms of saving your ass for the future, I'd put a note in the source of
the file saying where it came from initially, and keeping a copy of the email
from your boss saying that it's OK to use that code (and expressly
acknowledging that it's your code that you wrote before being employed with
them).

Do watch out about transferring the other way, however - if you use these
libraries and add to/modify them, you can't then add that new function to your
"clean" version to use in the future (it belongs to the employer, even if you
type it into your clean version off the clock). Also check the part of your
contract/clarify with your manager about what happens to code you write for
personal projects while employed - some companies have especially onerous
policies about them owning that code, even if you weren't at work when you
wrote it.

------
corewarrior
You need to check any contract you might be under with the University. If your
code was developed on university time with university resources it probably
doesn't belong to you! If you open source personal code then add it to the
University code base you may be creating a problem if the code will ever be
sold. Sadly you need to realize that todays market doesn't automatically
assign ownership rights to your code even though you created it. In most cases
ownership will be governed by any contracts or license restrictions you might
be working under. Study everything very carefully!

------
pedalpete
As far as the 'court' thing goes, I'm not sure why you would be concerned, as
long as you can prove that you wrote the code before joining the company.

Seeing as you are open with sharing your code, you can do it in such a way
that it builds your cred as a coder, and it could even be a bit of PR for your
boss (if you want it to be).

But I'd definitely sit down with your boss, and explain the situation. If
you're with a small company, I don't see why it would be an issue.

Best of luck

------
owinebarger
How much money will you be saving them by using your pre-existing work? I
realize you're a college student with a summer job, but it seems that you've
got the situation backward.

~~~
jskopek
I'm being paid considerably more then my co-workers mainly because I've
demonstrated the ability to complete projects very quickly. To a certain
extent, this code is one of the reasons I was hired; that said, I'd still like
to be able to use it when I eventually move on to other, even more exciting
projects

~~~
owinebarger
If you own the copyright to that code, it's not clear to me why putting it in
the code you're giving to them would necessarily even give them the right to
use it, much less give them the copyright to it.

Meaning: if I were your prospective employer, I'd be more

(a) concerned that your work product contains code that I do not have clear
title to than

(b) hopeful that I will somehow grab the copyright of your pre-existing work.

You'll be a lot better off if the arrangement is clear beforehand, and don't
sign anything that would alter or undermine that arrangement. People will have
more respect for your being above-board and straightforward, and for the fact
that you have enough self-respect to assert your proper rights while making a
fair bargain.

------
radu_floricica
The law usually says work done while you're employed belongs to the employer.
Off topic: at least in my country this is a special exception to the general
"author" legislation, which says for example a painting you make for a buyer
will forever be "by you", and even after selling it you still retain some
rights. In software, what you write belongs to the company, period.

Now depending on the specific wording of the law and in your employment
contract you may or may not be able to work on something related on your own.
The only solution I can think of which would not require a lawyer and/or
reading a lot of legalese is making a piece of paper in which you grant the
company the right to use your software and the company agrees it's yours, and
get your boss to put the company's stamp on it. That would work in pretty much
all cases I can think of, and it's reasonably easy.

------
otto
One important distinction to make is:

Are you considered a contractor or an employee?

I'd recommend talking to the legal department, or contacting someone you know
in IP law(an actual lawyer, not some random HN reader).

------
edw519
I have run into this before and I have never put someone else's code,
including my own, onto a customer's or employer's computer.

What I have often done, however, is write another version of basically the
same thing, but only what I need for the job at hand. I never use the same
program or variable names. I want it to look like I wrote it just for them,
which technically, I did. Sometimes I bring a hard copy and sometimes I cut
and paste a little from my gmail account, but usually I just rewrite most of
it from memory (which is good practice, too.)

They're paying for me to write them software, they're getting it, and I keep
what is already mine. Winners all the way around.

~~~
davidw
> They're paying for me to write them software, they're getting it, and I keep
> what is already mine. Winners all the way around.

Except that you just took money out of their pockets to write something that
you _already had_.

~~~
randallsquared
If they're happy with the software they got at the price, the labor (or lack
thereof) that went into it doesn't matter. Of course, if he's being paid by
the hour, it might be different, but I'm sure he wouldn't be padding time like
that if he were.

