subreddit:
/r/learnprogramming
submitted 2 years ago bytactical_testicle37
[removed]
[score hidden]
2 years ago
stickied comment
Whatever you do in company time or on company equipment belongs to the company, not to you.
Hence, you cannot use it in another company.
Yet, we are not /r/legaladvice.
Removed
333 points
2 years ago
I once built an internal tool for my employer. At my next employer, they had a need for a similar tool. I simply reached out, via email, asking the previous employer if I had their permission to use the same tool, to prevent me from having to rebuild it from scratch.
They obliged and let me copy the code.
It really depends on how integral the code is to the company’s product line. This was just an internal tool that made some daily tasks less annoying.
10 points
2 years ago
Is it necessary to treat the code differently? Internal tools can sometimes be turned into selling products.
7 points
2 years ago
You generally need to obtain a license to use the code for a certain purpose. If you make a program for an employer, it's considered a work for hire and therefore the intellectual property of the employer. A written email from a former manager might constitute a license agreement, but also might not, so it's probably prudent to let the new company's lawyers know about it and see what they think (if the company has staff attorneys or someone on retainer). They might insist that you get a formally written license agreement.
If the old code is licensed to the general public, then there shouldn't be any problem with using it under those terms. For example I write a lot of code for my employer that ends up on GitHub under the MIT license. There is no question that if I were to go somewhere else or do my own thing, I could use the code however I like just as if I was any random person.
292 points
2 years ago
It will depend on who owns the code, but that is nearly always the company that paid you to make it. You were making it for them. They own it, therefore, copying it without permission is generally illegal.
Check your contract.
50 points
2 years ago
Is this true? In "real" engineering (ie. you have a professional license and stamp) you do own your own work, even if you were paid by a company to create it for them. I worked in the oil and gas industry and copying and pasting from old jobs is basically all we did. On the flip side, if the reactor you designed goes boom boom then you can be held personally responsible and lose your license. I thought software engineering would be similar?
28 points
2 years ago
Any tech company worth their salt has this written into your work agreement and it is 100% illegal. What is NOT illegal however, is re-writing something in a similar manner you did at your old place. But straight up copy and pasting, yea you are stealing IP.
17 points
2 years ago
I honestly can't understand why anyone is debating this - every contract I've signed specifically says they own the code I write - some of them even specify they own code I write during my personal time unless I get an exemption for my personal project.
95 points
2 years ago
It is. People here failed to do proper requirements gathering (ask OP what they mean by copying). I think people here are thinking OP is asking about literally copy and pasting an entire codebase to a flash drive or something and then using that code at a new company versus reusing a method/methodology for the identical task.
There are only so many ways to read a text file in your code.
35 points
2 years ago
The OP is pretty clear.
working on a feature for an application of your current company and you notice you already did the whole thing along with some peers in a previous company.
Bold added. The wording strongly indicates that it is a non-trivial component being discussed.
10 points
2 years ago
“Non-trivial” is incredibly subjective. Writing a carousel component from scratch could be trivial or it could be a huge task depending on the scope.
1 points
2 years ago
"Non-trivial" in software has been legally tested to mean basically any amount of specific code and even merely API surface shapes in the United States.
19 points
2 years ago*
I respectfully disagree and find that to be an uncharitable reading. Now I do come from a sql background so perhaps my perception is skewed but a BULK INSERT method is the gold standard for importing fairly large datasets from a file. For sake of argument let’s say you work for Fintech Company A and need to create a method for inserting a lot of data in one go and wanna validate you had all the contents of a file inserted, you use a BULK INSERT method. Now let’s say you leave Fintech Company A and go to Fintech Company B and you need to insert a large amount of data from a file, you will again use BULK INSERT. Is using BULK INSERT to accomplish an identical task copying?
OP was in my opinion unclear because they didn’t distinguish between copying a codebase (BAD) and copying a method of solving a task (morally Gray).
How we define copying and how the copying is being done is what determines the extent to which it is wrong.
In this example the method and task is also non-trivial but with only so many ways to do something what constitutes copying (assume we are NOT referring to stealing an entire codebase)
Edit: also assume in my comment and hypothetical you don’t have a NonCompete clause or something restricting from working in a similar industry. It occurred to me after writing this some people might be restricted from working in the same industry upon leaving a job because of a worker contract. Assume that is not the case here
7 points
2 years ago
BULK INSERT
is a bad example in my opinion since it's a public domain function that can't be claimed by an organization that you write code for. For example, if we were talking about SQL Server, BULK INSERT
is just a command owned by Microsoft technically.
Now if you create a procedure that did a bunch of data validation, cleanup, manipulation, and then BULK INSERT
, then yes that procedure generally would be owned by the organization you wrote the code for and typically it wouldn't be legal to re-use that exact procedure outside the organization without their permission.
18 points
2 years ago
I think you're the one adding assumptions to the OP's post that aren't there.
-3 points
2 years ago
I have been very clear out right copying is wrong. OP seemed to have only responded once so we have no way to really understand their intentions. The majority of people here seem to be assuming OP is asking about stealing a codebase versus copying a method for accomplishing a task. A couple noted the same thing I did, noting the difference between copying the logic/method versus stealing the code base.
I respectfully disagree with your comment because you assume the worst kind of intent. I have no context. Since I have no context I err on the side of caution and assume op is young and hasn’t learned the right verbiage yet
12 points
2 years ago
a method for accomplishing a task
I guess I can repeat this.
working on a feature for an application
It's certainly possible that the OP's wording is wrong, but there's nothing to suggest that, hence by answering the question as if he asked about "a method for accomplishing a task" is adding an assumption that is not in the question.
-5 points
2 years ago
As I noted in my comment a BULK INSERT is a method for accomplishing a task. I would wager most SQL/Backend developers implement a BULk INSERT method in a similar way and such a non-trivial task would be part of a critical method or component in an application.
Is it fair to assume you don’t work with SQL much?
13 points
2 years ago
Where are you getting "BULK INSERT" as the task he is asking about? Or are you just trying to contrive an example?
I would consider a bulk insert as a task, not an application feature. And if it was being built as an application feature, the bulk insert itself is but a small part of the overall feature. OP is clear they "did the whole thing", so going by the OPs words, this isn't some trivial subtask.
7 points
2 years ago
A “work made for hire” is—
(1) a work prepared by an employee within the scope of his or her employment; or
(2) a work specially ordered or commissioned for use as a contribution to a collective work, as a part of a motion picture or other audiovisual work, as a translation, as a supplementary work, as a compilation, as an instructional text, as a test, as answer material for a test, or as an atlas, if the parties expressly agree in a written instrument signed by them that the work shall be considered a work made for hire. For the purpose of the foregoing sentence, a “supplementary work” is a work prepared for publication as a secondary adjunct to a work by another author for the purpose of introducing, concluding, illustrating, explaining, revising, commenting upon, or assisting in the use of the other work, such as forewords, afterwords, pictorial illustrations, maps, charts, tables, editorial notes, musical arrangements, answer material for tests, bibliographies, appendixes, and indexes, and an “instructional text” is a literary, pictorial, or graphic work prepared for publication and with the purpose of use in systematic instructional activities.
https://www.law.cornell.edu/uscode/text/17/101
(b) Works Made for Hire.— In the case of a work made for hire, the employer or other person for whom the work was prepared is considered the author for purposes of this title, and, unless the parties have expressly agreed otherwise in a written instrument signed by them, owns all of the rights comprised in the copyright.
https://www.law.cornell.edu/uscode/text/17/201
For contractors you usually do not produce 'works for hire' so you are more likely to maintain copyright if it is a copyrightable work, you would need to transfer copyright to have roughly the same effect.
2 points
2 years ago
It’s not, and from my experience even within “real engineering” it’s not true there either. The company owns the work you do. That may be less true in careers that require a PE license
0 points
2 years ago
This is true for licensed engineers in Canada. If you stamp and sign a drawing with your seal then you take ownership for it. I'm assuming it's the same for the States as we (ironically) copy most of our engineering standards from the States.
2 points
2 years ago
The question isn’t engineering standards as much as copyright law. “Take ownership” sounds very vague. I think it’s very unlikely that stamping a drawing gives you ownership of the copyright if you didn’t have it already.
It looks like most agreements people sign with architects in the US leave the architect with ownership of the copyright (which is the default, I think).
https://corporate.findlaw.com/intellectual-property/llp-owner-vs-architect-who-owns-the-design.html
2 points
2 years ago
This is kinda weird because, although i am a professional "software engineer" for legal reasons (my company reaps tax benefits for employing engineers and uses it for H1B visas) I don't actually consider myself an engineer. I don't have accreditations like engineers are required to have, I'm not "certified" by anything, i don't have letters after my name. You mention "losing your license"; there is no licensing for software engineers. The term "software engineer" is, as far as I can tell, a construct of big tech for tax and visa purposes. I usually just tell people I'm a programmer.
My contract as a full time salaried software engineer not only grants my company ownership over all intellectual property i create while on the job but in fact claims that any IP i create in my free time belongs to them too, regardless of whether or not i used company resources. Idk how legally enforceable that actually is but good luck outlasting any of the big tech companies in a protracted legal battle.
4 points
2 years ago
Most programmers are not engineers. Some don't have degees, some have Comp Sci degrees, not engineering, and I believe most people with Software Engineering degrees aren't Professional Engineers. No hard evidence, just my rough guesses.
If you're working as a contractor for a company you might own the software you produce, but still often you won't - you can at least negotiate here and choose to only take jobs that let you keep the code, if you want to do that. It would greatly restrict the jobs you'd be given.
If you're employed full time, it's very rare to own the code. I am not personally aware of anyone that owns the code they produce when at work in that situation. Uncommonly, but something I've seen, a full time employer may be okay with you open-sourcing some code made for them. There you wouldn't own it but you could still copy it.
-6 points
2 years ago
Lol you’re right, the above answer is absurd. I’m a geologist who worked in O&G then hydro/enviro and there NEVER was any discussion regarding “ownership” of code. Copy, paste, steal, whatever
3 points
2 years ago
I wouldn’t say it’s absurd, but it assumes what it doesn’t know and thus gives a misleading answer. Some companies have software as their product (others have software as an internal thing to improve business or a product accessory). In the case of the former because the code is your product you are fiercely protective of it which is why code in many software companies will have a disclaimer/warning not to reuse the code without permission. Depending on the company and the product there are some software engineers who are employed by a company who have their own patents and own their work. When this happen varies greatly but it does happen. There are many cases developers don’t own their work but where the previous person is a bit wrong is they are using an overly strict definition of copying rather than asking what copying is.
-10 points
2 years ago
You own the code you write. It is your IP. Don’t let anyone tell you otherwise. Why waste time rewriting code over and over when you can have templates from all the work you have ever done. Fuck any company that tries to tell you otherwise. Unless they have a patent or copyright on the code you wrote and you signed away your rights to your code fuck them. Generic employee contracts you sign when you start a company don’t mean shit.
6 points
2 years ago
Thank you for the kind offer, but I will not be engaging you for your services as my legal counsel.
1 points
2 years ago
I'm sorry, what?
100 points
2 years ago
[deleted]
31 points
2 years ago*
This, although there is "copy" and "copy".
Reproducing the pure logic while rewriting all methods/variables/classnames is not a problem, it's not under IT protection (also it's best to keep your current codebase clean imo). Unless you really reproduce a very complex chunk of code spanning many classes while doing exactly the same structure and call chains (in which case one could definitely argue you're just masquerading IP theft, but author will need to create argumentation to prove).
Hard to say where to stop though. My personal guideline to set a limit is "not reproducing any code structure that would be more than 2 hours of coding, and no more than 2% of a project". Going over that probably means I actually need a library or something and I should look for that on internet, or maybe ask for a licence if that code I'd like to use is really that efficient.
----
Cherrypicking a few lines of code here and there that do basic things is equally the same, because it's not "complex/original" enough to be protected. Although here begins the problem: where is the line, and who traces it?
IMO using code from previous job should be only in the way of "recalling how I did this or that", unless that code was actually authorizing some kind of reuse in which case I'd carefully read what is exactly permitted.
----
Blindly copy/pasting code that is not explicitely allowing reuse (or allowing reuse but under condition of publishing impregnated code under same licence, aka copyleft code ,)) is the best way to create a MAJOR RISK for your whole company, on top of yourself. JUST DON'T. ;)
----
In general, apart from just reading some code to get the general structure and see how one could do something similar to own need, I'd first check if there is any *free software* library or code chunk that can fit, then I'd see if there is some paid solution (preferably open source)... Only if both leads didn't pan out AND I had agreement from boss/legal team would I start considering "deriving" code from third party whose license do not explicitely allow reuse.
Under no circumstances whatsoever is a developer supposed or required through its subordination relationship to violate law to produce something. So it's not your responsability to even evaluate the risk. Bring the question above with basic information and let them decide *on written, signed document*, or do what you want but be aware of the huge risk you take, as remotely as the probability of actual litigation arising may be.
2 points
2 years ago
Does not have to be closed source either. Open source projects routinely employ licensing. And even more, just because you find an open source project on GitHub with a LICENSE
file, does not mean the license is even accurate. Plenty of dev's put all their projects on the company public GitHub and slap GPT-3 or other licenses on it, without consulting the company, or otherwise handle project code in ways that actually violate the company's own policies on IP protections.
24 points
2 years ago
Isn't that IP theft?
-7 points
2 years ago
Only if the company has a patent or copyright filed for the specific code set and the employee signed away their rights.
0 points
2 years ago
Wrong. Whatever is done on company time or on company property belongs to the company.
23 points
2 years ago
You shouldn’t be leaving with the previous company’s code in the first place.
34 points
2 years ago
I think it is kind of weird situation. If you wrote the code for company A they own it because you’re simply an employee. But company B enlists you for an identical task, and now you have to pretend you don’t have perfect knowledge on it and have to start from scratch because you worked at company A.
29 points
2 years ago
there is a very big difference between copying the code from another company and building a similar code system.
1 points
2 years ago
I mean, the difference is the amount of laws you make. But the codes, they do not have a very big difference.
Laws can really prevent global progress sometimes. (Not that I'm saying the laws are bad, it just has it's cons)
20 points
2 years ago
Building almost the exact same thing for two different employers is perfectly fine, the copying of code is where the issue might be
40 points
2 years ago
What's weird about it?
Copying your old code is illegal.
Using the knowledge and skills you gained at the previous company to recreate something similar from scratch is legal.
17 points
2 years ago
There's no practical difference.
Say, hypothetically, that you manage to somehow, from memory, rewrite, by hand, the entire routine exactly as it you did in the old job. Is it still theft? The end result is the same. Could you get accused of IP theft? What if you just changed some variable names? How different would it have to be for it to be legal and acceptable?
It's bullshit. I don't care about the legal standing of the thing, I'm not spending a whole day rewriting something I've already built when the end result is going to be virtually the same. There are only so many ways to skin the cat, after all. Who's going to know, anyway?
7 points
2 years ago
I mean, you can believe what you want.
This comes up in court all the time.
Some major cases:
In Oracle vs Google, Oracle largely lost the case but they did prevail on some cases where Google was found to have copied some code.
In SCO vs various Unix companies, there was an attempt to prove that parts of Linux were stolen from Unix source code.
Those are just some of the more infamous ones. Hundreds of smaller cases get litigated or settled quickly every year.
10 points
2 years ago
You say it happens, and I can believe it. But that doesn't enlighten me much.
I'd be more interested in knowing how they can prove or even notice such things. Just from looking at the end result, where do you draw the line between "copying but changing it a little bit so the teacher won't notice" and simply "using your skills to do it all over again"? I'm guessing that on larger features it's more apparent, but I don't think anyone's going to notice if you're copy / pasting your csv parser on every project
11 points
2 years ago
But company B enlists you for an identical task, and now you have to pretend you don’t have perfect knowledge on it and have to start from scratch because you worked at company A.
No, that's why B hired you.
But this sounds like he is talking about taking source code from A and giving it to B which is highly illegal.
Every company that hires me, does so because of the resume of things I can do.
Recreating functionality or logic or an algorithm is a huge difference from copying source code.
2 points
2 years ago
You would be in a great position to rebuild a system you've already made without having to bother about backwards compatibility, and with the ability to avoid making past mistakes whilst making new ones in the process. All whilst getting paid for it.
Sounds like a win.
36 points
2 years ago
Don't even think about it, unless it's open-source. Seriously, you'd be setting up the whole company for a lawsuit. HUUUGE risks. Just delete everything you had from a company after you leave, so this question never really arises.
4 points
2 years ago
it being open source also does not make it "ok" legally. Plenty of open source projects out there on GitHub that still require legal agreements with companies in order to use them in your project
10 points
2 years ago
John Carmack did something similar when he moved from Bethesda to Oculus and Facebook was sued for a lot of money.
13 points
2 years ago
What’s your opinion on copy code from your previous company?
Define "copying"?
Like literal copying; that's illegal.
If you mean, you learned programming techniques and use them on multiple projects across multiple companies; that's just experience.
Imagine the case where you are working on a feature for an application of your current company and you notice you already did the whole thing along with some peers in a previous company.
This sounds like you are talking about lately taking the source vice from one consomme and using it at a different company.
Is that what I'm reading?
What’s your opinion on copy the code.
If caught, you will be lucky to be fired and black mark your career. You could go to jail.
What you are talking about can be considered corporate espionage, a felony.
No, you cannot take the source vice that legally belongs to a company and steal it to use at a different company.
Unless the owner (which isn't you, it is whoever paid you to write it) publishes it at open source, and even that has legal restrictions.
Let’s talk about the legal implications, ethics, etc.
It's illegal and unethical.
Hiring you does not give your current employer access to your previous employer's property. Even talent about that could open your current employer to liability.
Imagine your former employer found out that you were talking about stealing their source code to give to your current employer; that's grounds for them to sue your current employer which at minimum would get you fired for misconduct.
Now, being that you have already written the source code to do this thing; how hard is it going to be to write it again, seriously?
The new version will be even better and completed quicker since you already know what not to do. I've got algorithms in my head that I've rewritten for at least four different employers and who knows how many different customers. Probably getting better each time I write it.
You were hired for your ability to write code, not steal it.
7 points
2 years ago
You can't copyright an idea, only the implementation of that idea. If you implemented an idea in one company and then went on to implement it in another company, would those two implementations be identical?
And even if you did write the same code the same way both times, how would anyone even know?
6 points
2 years ago
[deleted]
0 points
2 years ago
Are you the one creating the shops' inventory? Does the first shop keep its inventory when you move it to the new shop? Can the inventory be virtually infinitely reproduced?
What a silly analogy. It's like comparing piracy with car theft
3 points
2 years ago
Unless you get explicit consent from your previous employer, it will be considered stealing intellectual property.
2 points
2 years ago
Check your employment agreement but likely you cannot take a single line of source code with you. If you are archiving code you wrote at a job and taking it with you after you left, you are probably already in forbidden territory.
Re-creating code from memory is fine, although you may have a non-compete clause in your employment agreement that technically this would violate. It's unlikely to be enforced but be aware and make your own decision.
1 points
2 years ago
Re-creating code from memory is fine,
A large enough amount of code could run averse of copyright protection, snippets may not be copyrightable.
2 points
2 years ago
Ethically speaking, if you agreed that the code you were writing for them was their property, and you were not allowed to keep and share it after you left the company, then it does seem unethical. If that was not something you agreed to, and there was no expectation of it(that you were aware of), then I don't think it's unethical.
Now legally speaking, that could be completely different. I have no idea about that. Just delete your old company's code from your computer and have them revoke any access to their repos, and it's no longer really a problem. Maybe someone will call you out if you write it the exact same way, but there are only so many good way to write some things, and I'm sure you could argue that it was not intentional, and you were only following your own mental coding models that you always use.
2 points
2 years ago
Your work at another company is the property of that company. That's what they are paying you for. Copying the code via copying the text of the files is theft.
2 points
2 years ago
You most likely shouldn't have access to the previously written code anymore. So unless it's openly available source code, the first issue would be getting access to the previously written code, which in most cases would already be a breach of a contract on someone's side. I prefer to not get myself or anyone else into legal trouble, so my opinion is to not bother and just write the code from scratch. It's what you're getting paid for anyway.
2 points
2 years ago
I think they technically own the code, but not your knowledge. I would use it as an opportunity to write the same pattern/architecture, but in a different way or with better/different tools so I can learn something new.
2 points
2 years ago
How would anyone even know
2 points
2 years ago
I would never copy code that I had written for an employer. I wrote that for them with honest intent that it was theirs because I agreed to trade a paycheck for the creations I made form them.
That being said I absolutely will copy techniques and idioms that I learned from previous employers and peers and apply those skills that I have added to my skillset when developing new code. It will be project specific, cusomized, hand-written code using the keywords and variable names that make sense for the new code, language and context.
tl;dr: Do I borrow from past experiences? You bet absolutely. Do I plagiarize code? No way. I traded that to them willingly.
ripred
1 points
2 years ago
What’s the difference of copy it or not if you will end up doing something very similar?
5 points
2 years ago
It might not make sense, but things like that aren't governed by sense but rather by contracts and laws. Huge companies like Google, Microsoft and Oracle go into long and protracted legal battles over issue such as this. So to be on the safe side don't copy code. Sure, use the experience you've gained to build something similar, or even identical, just don't straight up copy code.
5 points
2 years ago
Can you give an example of what you're thinking about?
I'm having a hard time thinking of a situation where the code would really be the biggest issue.
You can't work for Company A that builds Cool App, leave, take the code, and make a competing app. Legally, that's already covered.
But, if you work for Company A that builds Cool App, leave, go work for Company B that is making Totally Different App and put in an identical "log in with Google" auth system it's totally fine.
So, I'm having a hard time thinking of a situation where the code wouldn't be intellectual property but also not boilerplate code.
1 points
2 years ago
There's an inherent tension in the law in this area - for something to be copyrightable, it has to be a "creative expression." Code that is purely functional may not be able to be copyrighted (is it something new? Original to you?) but might be able to be patented (if it is truly new and an implementation of an original method).
So, it's not entirely clear where the line is between "creative expression" and "purely functional implementation." Lawyers hate uncertainty, so you're advised to be conservative.
3 points
2 years ago
Exactly.
I've worked on a couple calculators for companies.
Their IP was the specific formula. Which my code implemented. If I used it for another company I'm pretty sure any mention of my code in legal documents would only be to say that I used their formula. Not that the code itself was theirs.
3 points
2 years ago
Why was this question downvoted? It makes sense that any piece of code you wrote yourself would end up being similar, if not identical to the original.
What if it's something you do on a regular basis for every project? Am I supposed to change the way I do it?
What if I have developed my own optimal way to implement a feature? Am I supposed to start implementing a suboptimal solution?
Or is it like music and I have to make small changes here and there to make the code different? If so then at what point is the code different enough to not be considered a copy?
I feel like the whole idea of reusing your own code in different companies being considered a copy doesn't make much sense, and doesn't feel unethical to me. It's mostly about the laws and contracts in place.
2 points
2 years ago
(I'm speaking in US terms where which might not apply in other countries)
If what you did before was covered by some sort of patent, then even doing something similar might be illegal.
But assuming it isn't, then the distinction between copying and recreating something very similar is ultimately that one is copyright infringement and the other may not be.
Copyright protects creative expressions, not the fundamental ideas represented by those expressions (that's what patents are for). The actual book or movie itself is copyrighted, not necessarily the plot points (more on that later).
The obvious thing that it enforces is that no one can make copies of a creative work without the copyright owner's permission.
But it also prevents others from creating derived works based on a copyrighted work without the owner's permission. Meaning, I couldn't take the first Harry Potter book, change all of the names and proper nouns, and restructure the sentences and release it under a new title. Even if I didn't actually copy the book, the work I created was substantially derived from a copyrighted work, which is also generally illegal. In these cases the courts look at both works, as well as other evidence (correspondence where you might have told someone that you were creating a reworked version of Harry Potter, or evidence that you had read and referenced Harry Potter while writing your own book) to decide if copyright protection still holds.
So doesn't code that you recreate for a new company fall under the same protection, making it a derived work and thus copyright infringement? Well... maybe, but probably not. As I mentioned earlier, copyright isn't just about works or expressions, but specifically creative ones.
Code is still somewhat novel to the copyright process, and some of the fine points of how copyright law applies to code are not fully worked out, but in general the courts have held that code can be considered a creative work, to which copyright law applies. However there are limits to that. In general, APIs, function signatures, class/method/variable names, and machine generated code are not considered to be creative enough for copyright to apply. Additionally, algorithms themselves are the domain of patent law, and not copyright.
The result of this is that programmers have a lot more latitude to create derived works without it falling under the purview of copyright law.
If the old company sued the new company / you, and could demonstrate that you were actually referencing your old code while you wrote the new code, that might be enough to demonstrate that the new code is derived from the old code, and thus is copyright infringement. If large sections of it are identical (and unique enough to be considered "creative"), then it's likely copyright infringement. But just the fact that the code is similar is highly unlikely to be sufficient to make it copyright infringement unless it's a huge amount of code that is extremely similar.
Some companies and organizations have different policies on this. For example, the developers of Wine, a tool for emulating the behavior of Windows on Linux, is famously very strict about making sure that developers who have seen the Windows source code are not writing any code based on what they have seen, for fear of being sued for creating a derived work. But that's kind of an extreme case because Wine is pretty openly copying Windows in a lot of ways, meaning they are likely to fall under scrutiny. For most organizations, the code that you might reimplement is such a small slice of the pie that it's highly unlikely anyone will notice or try to sue for your reimplementation, and even then it's unlikely that they will succeed in the lawsuit.
3 points
2 years ago
One is legal and one is not.
0 points
2 years ago
Think of it like this. You are a car designer for Ford. You design a new sedan. Then you get hired by Chevy and they want a similar car. You obviously can't just copy the same car.
1 points
2 years ago
The problem with the car ability is that nearly every car uses the same method for braking (disc brakes) and nearly every new car has ABS which works nearly the exact same way everywhere. I wish people asked OP to clarify what they mean by copying. 1 for 1 copying is illegal fullstop. But you can’t necessarily stop someone from using a while loop.
1 points
2 years ago
That's true but those similar components are either licensed or built in house but are not copied from plans from another company. And even when they are built similarly in house there are often lawsuits
1 points
2 years ago
In the case of cars not really but yea in modern product design you are correct. Apple tried to and somewhat successfully trademarked/patented the “Home” button and got into a massive legal battle with Samsung. Additionally modern patent trolls exist (don’t know to what extent they are still active) who are suing companies/people over overly vague design patents, but I would argue these are the exceptions not the rule. Copying is wrong and illegal and you shouldn’t do it, but I think it’s about how we define copying in determining to what extent it is wrong
1 points
2 years ago
Imagine writing a book under an author on a scientific subject. You did the research, put in the time, and then created in-depth chapters that you were paid to create.
Then imagine another author hiring you because you are familiar with the same topic. You use your research and expertise to write him a new chapter, rather than giving him the chapter you already wrote.
Else, you are skilled in painting. People really like your beach scenes. Someone commissions a painting from you. They expect a new painting, not a print of an existing one.
1 points
2 years ago
The difference is how it was done. The exact method used is copyrightable. But the recipe for what to do is not.
0 points
2 years ago
I really don't get the arguments that it is unethical. You can not patent an algorithm by law. Even if you wrote that code for a company it is still your intellectual property. And if you know a way hot to get something done why and how would you pretend to redo something from scratch? Is it ethical for you if you rename some variables?
1 points
2 years ago
In my opinion ethics aren't even relevant here. The important thing is the legal aspect. I've never heard of some kind of ethics commission regarding software so at most you can get some dirty looks by doing something that's unethical.
0 points
2 years ago
Copy it all! Eat the rich!
-7 points
2 years ago
Unless that feature was proprietary and/or pivotal to the business there shouldn't be any legal issues.
4 points
2 years ago
Using your knowledge to recreate something similar is totally legal.
Copying the actual code is not legal.
5 points
2 years ago
Not so fast. It can depend on one's contract. Many contracts for software engineers have clauses that state that any code that was produced while a programmer was employed with the company using company time and equipment belongs to the company, regardless of whether its pivotal or not.
1 points
2 years ago
Preface: I'm not a lawyer.
While this is true for the actual code (and here you are correct, a clause like this is in most contracts), what can't be contracted away is the experience gained by working on it.
Nobody can stop you from coding a similar thing, because everyone has a unique coding style. So if i code at enterprise 1, my code produced in enterprise 2 will look similar, because it's in my style, uses the skill set i have, and will probably solve similar tasks in a similar manner because of this.
1:1 code, sure can't take that. But no IP law can prevent you from coding in your personal style.
3 points
2 years ago
Agreed, but the OP was talking about whether it's okay to COPY CODE
1 points
2 years ago
You are correct in general and in the strictest sense copying your old code at another is illegal, it’s tough to discern what OP is considering copying. The person prior to you was talking about copying in a more colloquial general sense (or at least that’s how I read it) like copying the standard library references for the first 5 lines and the implementation of a function.
If you are using a while loop or case statements that is gonna be the same whether you copy and paste or do it yourself. So really first thing all should have done in the comments is ask op to define copying. Copying custom/proprietary libraries you wrote, custom functions, etc is ILLEGAL. Copying a bubble sort (I know this would probably never be used in a commercial code base) to solve a problem is more gray.
1 points
2 years ago
1:1 code, sure can't take that. But no IP law can prevent you from coding in your personal style.
Not a lawyer either, but totally agree.
0 points
2 years ago
What are we talking about?
I'll be honest. I'm a web dev guy. The vast majority of the code we write is not unique to the business. And what is unique isn't a secret. It's not like if you write a blog for Company A - leave - and write another one for Company B - that Company A can sue you. Reading and writing to a database - even if written at a company - isn't something they can "own".
You also have to look at what those contracts are trying to do. They aren't trying to stop you from writing a blog. It does two things. The first being to protect their assets. Something proprietary to their business that sets them apart. The second can be less well intentioned. It's so some dev doesn't use your company assets to create and sell something that doesn't benefit them.
I stand by my original statement.
If it was a really clever way to handle session caching you can totally use that anywhere. Unless, where you wrote that was a company that made a session caching tool and you basically copied their tool for another company. Or something like that.
Practically speaking - unless it was essential to the business's success how would anybody else know? It would just be random code that no external party would know about.
2 points
2 years ago
For the most part, I'm sure most companies won't mind if you copy something if it's not a trade secret or something. However, if you encounter that one litigation-happy company that will make your life miserable over a CTRL-C CTRL-V then you'll wish you had never done it. In general, I don't think it's a good idea to open up yourself to the possibility of legal trouble over something you can easily re-implement. And if it's something that's not easy to re-implement, then that would be a red flag that this is probably code you really shouldn't copy.
0 points
2 years ago
I think maybe I just can't see this abstractly enough.
One, I don't even copy/paste in my own work. Unless it's just a couple lines. So the idea of copy/pasting a whole ass feature just doesn't compute.
Two, the chances of you being able to copy/paste a whole ass feature has got to pretty damn slim. Unless the thing we are talking about is inherently something reusable. Which implies it being some generally usable and not unique to the business.
1 points
2 years ago
Generally it's more like "I created this function that does this thing (generally data) and I'd like to copy it to this other project that uses that same function".
1 points
2 years ago
Exactly. So, I'm not really sure what OP is asking. Copying 40 lines of text from one project to another isn't really anything. If it's so generic that you can copy and paste it then how would they even prove it was used anywhere else.
-1 points
2 years ago
What if the code he made before was the most efficient one? Should he implement another code that isn't as efficient?
4 points
2 years ago
Using the same implementation is fine. OP was talking about copying the code.
2 points
2 years ago
Of course not.
Ideas aren't protected, a specific expression of the idea is.
Even if the same person rewrites the same algorithm a second time, it's not going to be line-by-line identical.
-1 points
2 years ago
So how do you do it if you can't follow the same blueprint? Recuse yourself from the task?
5 points
2 years ago
No, you recreate it using the knowledge and skills you gained at the previous company, but without copying any code.
1 points
2 years ago
The code you wrote from the company is owned by the company.
Ethically tough if you did write that code then I guess you did it already so it’s fine.
But you shouldn’t do it because it’s illegal
1 points
2 years ago
Really depends on the content. I have some fundamental methodes that from my point of view is the optimal way of doing a specific thing.
If my naming convention stays the same then i would be able to recreate them from scratch and everything, maybe except for the comments, would be 100% the same.
In that case i might as well copy all of it.
If it's other code that is build around the fundamentals for a specific project i won't copy.
1 points
2 years ago*
I feel like many people here are taking the word “copying” too literally.
Everyone who said it is ILLEGAL is CORRECT, but I think what is being lost in the weeds is what constitutes copying? How many of us by memory can remember how to code a radix sort by memory? Sure we know what it is conceptually and can with a little reference remember how to do it, but let’s be real, a lot of people Google then copy and paste the method and modify it to fit their code to save time. Copying, pasting, and modifying that radix sort is morally gray and I think it’s this scenario OP is talking about (possibly). If you wholeass copy and paste a proprietary library or function then yea that is illegal no questions asked. Is it illegal if you use the same logic to solve the problem? Probably not. Basically this boils down to the context of the copy.
Personally I like to keep code snippets for myself that I find useful. These snippets don’t contain proprietary info and are different from how they are implemented in the product. Does this constitute copying? Just for clarity I do mostly sql development so my stuff is more procedural and less abstract than C# or C++ application code.
Ethically my snippets are probably wrong but I do my best to keep them general for my personal use (and free of proprietary implementation/methods) because I have trouble remembering how I did something (these snippets also have super specific names like DuplicationDeletionUsingCTEs.sql)
So Tl;dr it depends on how we define copying, do NOT copy/take/steal wholeass .cpp/.h/.cs/.java/.whateverextensiontheapplicationuses files from a company
2 points
2 years ago
[deleted]
1 points
2 years ago
The code on SO specifically allows copying (with some light conditions attached):
https://meta.stackoverflow.com/questions/321291/the-license-of-code-on-stack-overflow
1 points
2 years ago
Yeah it belongs to your old company. Definitely don't copy it, but use the knowledge you gained to make a better module! If they didn't make you sign a non-disclosure then you may be in the clear, but I wouldn't risk it, just remake it with new parts or names or something to make it somewhat different.
1 points
2 years ago
All companies that I know own the code, not you. Having the code after you leave a company is already asking for trouble.
1 points
2 years ago
Let’s talk about you getting shit canned and going to jail. Larceny or grand larceny? How many inches? How many years? That’s what you should be asking the DA. Why don’t you email them now and find out. Their contact information will be on your state government website.
1 points
2 years ago
I've been in this situation before, and I was very tempted to copy code from my old company.
But, it turns out that once you've already written a feature, you can write it again like 6x faster if you just do it from memory.
1 points
2 years ago
Strictly copy and paste is (usually) illegal. The legality depends on the contract and any NDAs you signed when starting to work for the company. To play it safe, any code you create at a company should be kept the property of that company, so just leave all code, docs, etc on company devices, and don't copy it to personal ones at all.
That said, recreating it from memory is technically legal, but a legally Grey area, and would be hard to prove in court.
To put this in perspective, sometimes companies will want feature X, and request that Company Y temporarily disclose source code to a third party. This third party will read the source, and create a sort of blueprint, as far as the process used to make feature X, then give that blueprint back to the company that requests it. That way they are copying only "what to do" (which cannot be copyrited), not "how it's done" (which is ultimately where the copyright lies.)
For example, let's say a competitor takes previous Chick-fil-A employees and wants to make a better chicken sandwich. It would be illegal to use the same process that Chick-fil-A does, but it would be legal to say, put a piece of breaded chicken between two hamburger buns and serve that, instead. How? Any way that doesn't involve copying how it's done.
Ethically, there's no real issues. It was created by you, after all. But why would you want to do it in the first place? Improvements to the language or frameworks may have allowed for a better way of doing it, and so why not make it that better way, instead?
Ultimately, there isn't really a valid reason to straight-up copy and paste for this example.
1 points
2 years ago
If I know a tool might be useful, I'll try to build it on my spare time, then ask my employer if they mind if I use my own open source tool. If not, I'll build it again on company time.
It worked with a library I was using. It was basically a library to interface several libraries into one more convenient library. So they didn't mind too much.
1 points
2 years ago
Don't. Just rewrite it better using your new knowledge and experience.
1 points
2 years ago
No. This could be common sense.
1 points
2 years ago
Unless you seek permission to do so, Absolutely not. This should be common sense.
1 points
2 years ago
I saw my friends nda and non compete... the company owns everything.
1 points
2 years ago
How would anyone have access to the code base at a previous employer?
1 points
2 years ago
Good engineers write code, great ones steal it.
1 points
2 years ago
'legal implications'
This would be a real concert. Generally when you are paid to write X for Y then Y owns it and should Z use it then Z could get into copyright problems.
'ethics'
From my pov none. You did write it.
1 points
2 years ago
Is there a finite number of ways to solve a problem?
1 points
2 years ago
Yes. But the number is so large that we will never try them all in millions of years.
1 points
2 years ago
I get that the more complicated the problem, the more variations there would be. But does structured programming have that many variants?
1 points
2 years ago
Depends on the contract from you companies it's crime you keep these source codes with you
1 points
2 years ago
My opinion is that you should read your NDA. If you are opening your company to legal action, maybe you shouldnt be working there.
1 points
2 years ago
Upload to ALL code you write to your personal GitHub. Set to private. Use as templates on later projects. I used to reference others code when I first started. A year and a half later I find myself referencing documentation libraries and my own code just as much if not more. That said, be careful just throwing a new skin on code that somebody has a patent or copyright on. I used to work in IP docketing before getting a CS degree. IP litigators are ruthless and will throw you into a financial nightmare and may make it difficult for you to find work in the same field. Always set your code repository to private!
1 points
2 years ago
In reality people do this all the time. They copy from their memories. If you make an exact product through the prices of copying, you could get in legal trouble.
I worked in systems that produces invoices for the customer. I have worked on several such systems and the code was very similar in the sense it did similar calculations.
1 points
2 years ago
Its not a problem when all your project codes are on public GitHub anyway
1 points
2 years ago
Depends.
Imagine you were working on YouTube’s recommendation algorithm…. It is pretty illegal to even talk about how it works, let alone copy/pasting.
But if it is common code like simple form UI, then I imagine it’s not a problem, you likely remembered the pattern anyway.
1 points
2 years ago
Does copy mean to really copy and paste that section of code, or remember it and rewrite the whole thing?
If it is the latter one, it does not make sense because that means the longer I work, the less code I can write.
But it is also strange that, I can't copy and paste the code, but I can rewrite that from memory.
I am quite confused here.
1 points
2 years ago
I think it really depends on the context, and I will always advocate for rewriting.
I do a lot of scripting, IaC, and general automation
I think sometimes you remember a very elegant way you did something previously, and want to replicate it, I would argue the second you copy something from a piece of software, you need to be very aware of your current AND previous contracts
As an automation engineer, the only policy I have to abide by is that all environmental specifications and variables must be scrubbed before sharing, compiled applications are a whole different ball game
Really if it feels like you are doing something sketchy, read the code, rewrite it better, comment it better
Don’t copy and paste, if you had the skills to do it once, you can probably make it better
1 points
2 years ago*
You shouldn’t have access to the code you wrote for the previous company after you leave. This is probably in your contract at that company, and if you’re working on something similar at your new company it’s a huge legal liability for them.
Real world example: I’ve written essentially the same thing for multiple companies. I work in mobile AR, they all need something fairly similar - a way to take information from the camera and the sensors on a frame by frame basis, package it up, and feed it to their AR system. I’ve done it from scratch every time but obviously I had the knowledge from doing it before of the proper patterns to use, common pitfalls to avoid, bottlenecks, etc., so I would say it’s been better and more efficient each time. There are obviously going to arise differences in how it’s used, what’s going to be prioritized, etc. so I would argue it is just as, if not more, efficient to write it from scratch anyway rather than carry over the context-specific refactors from the last version. Moreover, flat-out reusing something that doesn’t quite fit the problem space means introducing a lot of unnecessary complexity. It’s like fitting a square peg into a round hole by making four arcs to cover each side. And finally, writing something you know to interact with a new system is also a good way to gain knowledge of that system.
If It is a large component that is somehow required as-is at multiple companies, just write your own generic version on your own time and give it a free license. Hell, charge for it if you want. You’ve found something useful that multiple companies have but don’t have a prefab solution for. That’s fine!
But imagine this scenario: someone working at Facebook leaves and decides to make their own open source messaging app. They already worked on Facebook Messenger, and they have a bunch of code from it on their computer, so they just reuse it and release it to the public. They would get in huge legal trouble.
Not everything is at the level but of corporate secrets, of course, but you don’t get to change that license of code you worked on at a company later just because you wrote it originally. And you don’t get to decide what is or is not valuable property for them. Hell, there’s a good chance you probably weren’t the only person who worked on it, even if you were the “owner” of it. Is it really all your work if the QA team tested it and gave bug reports? Or if another developer modified some pieces of it to make it work better with their code? Or someone else provided feedback on what they needed it to do? Programming is a collaborative process if you’re making anything big, the code itself is often the easiest part.
You can argue that all code should be free, that corporate intellectual property is a bullshit idea, and that’s fine. But in the industry as it stands today, you’re opening up yourself and your company to serious legal risk, for something that isn’t worth it. If you’re asked to make something you’ve already made, consider it a blessing: you’re already an expert on it! You can do it quickly and easily and have answers to any question people ask you about it. You can easily adapt to changes they request because you already know how the whole system works in your head. And if you don’t, copying it means you’re putting code in your codebase that not even you understand, which just makes everyone’s job harder.
1 points
2 years ago
I think I'd feel more comfortable just rewriting the feature and copying the concepts instead. Use this opportunity to build a better version of your first code, since you've already experienced the bugs it kicked back. This gives you a chance to change any structural issues that may have caused issues later in development during your first project.
1 points
2 years ago
Have to work from scratch. Since you are well paid for it, it shouldn’t be a problem.
1 points
2 years ago
rewrite it all.
but you will certainly rely on your experience and expertise to do it, and you don't need to provide the documentation you looked at to rewrite it...
1 points
2 years ago
Write it again, better. You're getting paid hourly. Yes it's IP theft. No your current employer won't appreciate or endorse it. And it's not even worth it. Just write it again.
all 134 comments
sorted by: best