How is obfuscated code treated by the law?
<h2>Hypothetical Scenario</h2>

<ol>
<li>Developer, <strong>A</strong>, contracts with company, <strong>B</strong>, to write code, <strong>C</strong>, that accomplishes <strong>X</strong>.</li>
<li><strong>A</strong> writes <strong>C</strong>.</li>
<li><strong>A</strong> <em>obfuscates</em> <strong>C</strong>. (Obfuscation <em>transmorphs</em> <strong>C</strong> into <strong>C'</strong> which still accomplishes <strong>X</strong> but <strong>C'</strong> is very difficult to interpret by another coder.)</li>
<li><strong>A</strong> demonstrates to <strong>B</strong> that <strong>C'</strong> accomplishes <strong>X</strong>.</li>
<li><strong>B</strong> pays <strong>A</strong>.</li>
<li><strong>A</strong> delivers <strong>C'</strong> to <strong>B</strong>.</li>
<li>At some time later, <strong>B</strong> hires another developer, <strong>D</strong> to do some code maintenance and/or upgrades.</li>
<li><strong>D</strong> informs <strong>B</strong> he can not interpret or work on <strong>C'</strong> because it has been <em>obfuscated</em>.</li>
</ol>

<h2>Question</h2>

<blockquote>
  <p>Does <strong>B</strong> have any recourse against <strong>A</strong>?</p>
</blockquote>

<p><strong>Depends on the agreement between A and B</strong></p>

<p>If the agreement is to simply produce code that accomplished <strong>X</strong> then generally there is no recourse. (Some jurisdictions may have legal doctrines or laws that do provide recourse).</p>

<p>If instead the contract specifies some specific industry standards <strong>A</strong> must follow while accomplishing <strong>X</strong>, then <strong>B</strong> probably may sue for breach of contract.</p>

<p>All other things considered I would deem it wholly inappropriate if a contract calls for source code (and this would be the default for an employment contract but not necessarily other kinds of contract for code), if the source code submitted is not the code as the developer wrote it for his own reading and how he intended to maintain it, I would consider that an actionable breach. In the GPL, they spelled it out in some verbiage that I am not inclined to repeat, but the form intended to be maintained is the form as needs to be provided.</p>

<p>As for deliberately writing it hard to maintain but he himself must endure the code as it is, that's a whole 'nother can of worms. You see, there are some who write bad to make themselves job security, and there are those who just write bad because they know it doesn't matter to the compiler.</p>

contract-law