If you write some code, generally you or your employer 'own' that code (I won't go into who 'owns' open source code because it's not what I'm talking about). It's yours/theirs to do with what you please. But at what point can you reasonably say "this code is mine"? It seems reasonable to say a 100,000+ LOC codebase written by in-house developers belongs to the company they work for. You could stretch further and say "this function is mine". It might be a very specialised function using an algorithm you created to perform some task, so really yes, that is yours because no one else created it, you did.

But what about boilerplate code and small snippets? What about "Hello World"? Millions of programmers have written a Hello World since the early 70's, but you couldn't say because you wrote one that you 'own' Hello World in your chosen language.

What factors distinguish code classed as something that can be owned from code "anyone could have written"? There's only a certain number of reasonable ways of achieving some programming task, and you surely can't claim ownership of any code that does the same thing just because you wrote one first (or can you?).

For example...

A friend of mine got a job for a trendy new startup (the kind where beanbags and having a wacky office environment took precedent over actually doing anything) that swiftly sank beneath the waves. He was given a project that could have been handled by one programmer and got through what he estimates as 10-15% of the actual programming before being let go. He also did all of the design phase and supposedly has documentation to prove it. I want (with him) to use what he already wrote to finish the project and launch it as our own, but he's worried his former employer may come after him and accuse him of stealing the company's (which is now defunct) property.

Ideally I'm looking for legal precedent if anyone knows of any, but I think it might be hard to come by if any exists at all.

  • 3
    Work done for a company as an employee belongs to the company. If you're worried about being sued over theft of intellectual property, it's not about "hello world" or some random snippets. Feb 16, 2016 at 14:34
  • Say we rewrote the codebase from scratch but it still did the same thing, at the end of the day most of the code will be very similar if not almost identical but that can't be helped because that's just what needs to be written to achieve the end goal. My question is how do we know where IP ends and "general way of doing this task" begins?
    – leylandski
    Feb 16, 2016 at 14:39
  • By asking a lawyer. Feb 16, 2016 at 14:40
  • 1
    As far as the law in the US is concerned, there is no such thing as intellectual property. There is copyright, trademark, and patent law. You should rewrite your question in terms of which area of law is relevant. Feb 16, 2016 at 16:45
  • @RobertHarvey "If you're worried about being sued over theft of intellectual property, it's not about "hello world" or some random snippets." - en.wikipedia.org/wiki/Oracle_America,_Inc._v._Google,_Inc. had years of court battles and billions of dollars in potential claims over what essentially was random snippets like boilerplate header definitions.
    – Peteris
    Feb 17, 2019 at 14:16

1 Answer 1


Yes and no. [note, the following is all written about US law. In other jurisdictions laws are, of course, different (though usually not drastically so.)]

In the US there are (at least) three different bodies of law that might apply to code: copyright, patents, trade secrets.

Copyright covers original expression. Anything you write is automatically, immediately protected under copyright. The copyright applies to the code itself, and anything "derived" from that code. It's up to the courts to decide exactly what "derived" means. One case that's long been viewed as a landmark in this area is Gates Rubber v. Bando Chemicals. The Court of Appeals for the tenth Circuit decision includes a section titled: "The Test for Determining Whether the Copyright of a Computer Program Has Been Infringed." Note that you can register a copyright, and that can be worthwhile, such as helping recover some damages you can't otherwise.

Patents are quite different from copyrights. Where a copyright covers expression of an idea, a patent covers a specific invention. Rather than being awarded automatically, a patent has to be applied for, and awarded only after the patent office has determined that there's no relevant prior art to prevent it from being awarded. A patent, however, covers things like somebody else independently discovering/inventing what's covered by the patent.

A trade secret could (at least theoretically) apply to some process or procedure embodied in the code. A trade secret mostly applies to a situation where (for example) you're trying to form an alliance with some other company, and in the process tell them things you don't tell the general public. If you've identified the fact that what you're telling them is a trade secret, and they then tell a competitor (or the general public, etc.) or more generally use that information in any way other than the originally intended purpose, it could constitute a trade secret violation. As a side-note: patents and copyright fall under federal law, so they're basically uniform nation-wide. Trade secrets mostly fall under state law, so the exact details vary by state.

Absent a reason to believe otherwise, I'd guess your interest here is primarily in copyright infringement. The key here would be showing that one piece of code was derived from the other. That is, it specifically would not apply in a case where there were only a limited number of ways of doing something, so anybody who wanted to do that had to use one of those ways. Since this would not indicate actual derivation, it would not indicate copyright violation.

  • If you tell me something and then say "by the way, this is a trade secret" then I just say "not anymore" because you told me. You have to keep a trade secret secret yourself. And if you tell me, then you have to ensure (by contract or NDA) that I keep your secret secret as well.
    – gnasher729
    May 20, 2018 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy