Can copying simple general code cause copyright infringement? And is it even possible to avoid that?
<p>Imagine that during writing software for the employer, I created simple helper function<br>
<code>IsPositiveNumber(x)</code> which returns <code>true</code> if x > 0 and <code>false</code> otherwise.<br>
Or function <code>TrimBlanks(text)</code> which returns text without leading and trailing spaces and tabs.</p>

<p>Let's say that those functions are very simple inside and can be re-created by an average developer in a few minutes.</p>

<p>Now, if I will create an open-source software or change the employer, how serious ownership violation would I commit when I will simply copy those two functions into new code?</p>

<p>Maybe shall I open-source such functions and then ask for permission to include that open-source library?</p>

<p>And even if I will write them anew, it is very likely that they will be 90% identical with original ones (including their names), because there are not many ways (in my mind) how to create their body or how to name them.</p>

<p>So does it matter if I copy those functions over or if I write them anew? Even if I write them anew, how can I prove that I did not copy them?</p>

<p>Or is this a thing on which no sane person will build an IP lawsuit?</p>

<p>As you've presented them, I doubt the functions are protected by copyright in the first place.</p>

<p><strong>Originality</strong> is one of the threshold requirements for copyright protection, and it demands that the work in question be independently created by the author, and that it possess some minimal degree of creativity.</p>

<p>If you're talking about programming at a level so basic that the function truly <em>must</em> be created in a particular way, there is no originality in simply following the instructions. And even if there's some wiggle room, but the language you used has likely been independently replicated by many programmers, that's still not original enough to be copyrightable.</p>

<p>What you want to watch out for, though, is the possibility that they've been combined into an original arrangement that is protected. I don't know enough about how copyright law is applied to code to say where or how that line is drawn, but my instinct would be that it could be a fairly low threshold.</p>

<p>In US copyright law there is a doctrine known as <em>Scènes à faire</em>. See <a href="https://en.wikipedia.org/wiki/Sc%C3%A8nes_%C3%A0_faire" rel="nofollow noreferrer">this Wikipedia article</a> and <a href="http://www.mondaq.com/india/x/365210/Copyright/The+Relevance+Of+Doctrine+Of+Scne+Faire+In+Copyright+Law" rel="nofollow noreferrer">this mondaq article</a> for more on the concept.</p>

<p>In general this means that expressions which are so common as to be required in a particular literary genre are not protected by copyright. For example, having a secret rendezvous or a  Swiss bank account in a spy novel would not make other such scenes infringements. In a factual work an "obvious and essential" way of expressing a fact is similarly not protected. <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=10&amp;ved=2ahUKEwi18N7mgYDfAhXouFkKHUjyDA0QFjAJegQIAhAC&amp;url=https%3A%2F%2Fwww.jonesday.com%2Ffiles%2FPublication%2F913ab9f5-4eaf-4ba7-a305-116b11e903b3%2FPresentation%2FPublicationAttachment%2F6809cb5e-fe96-4218-8486-202e7a45a25a%2F011-013-CW-May09-Feat.pdf&amp;usg=AOvVaw0TGCt333vctFvv6_8mAKXr" rel="nofollow noreferrer">This <em>Copyright World</em> article</a> discusses the concept in the software context.</p>

<p>As the Wikipedia article says:</p>

<blockquote>
  <p>In a business and computer program context, the doctrine of scènes à faire is interpreted to apply to the practices and demands of the businesses and industries that the given computer program serves. Hence, the concepts of idea vs. expression (merger doctrine) and <em>scènes à faire</em> relate directly to promoting availability of business functionality.</p>
</blockquote>

<p>There is the nrelated doctrine that facts and ideas, as opposed to expressions, are not protectred by copyright. As part of this, "obvious and natural" ways of expressing facts are not protected either. For example, a list of US Presidents, ordered by date of election, giving their names and ages, would not be protected by copyright.</p>

<p>I would take the examples suggested in the question to fall under these doctrines, and I do not think that they would be protected by copyright, at least in the US.</p>

copyright intellectual-property software ownership