The "work-made-for-hire" doctrine generally defines the relationship between a software developer and his or her client.
A segment of software code is a "work-made-for-hire" if it is either:
a) A work prepared by an employee in the scope of his or her employment; or
b) a work specially ordered or commissioned for use as [1] a contribution to a collective work, [2] as a part of a motion picture or [3] other audiovisual work, [4] as a translation, [5] as a supplementary work, [6] as a compilation, [7] as an instructional text, [8] as a test, [9] as answer material for a test, or [10] 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. (17 U.S.C. § 101)
In either situation, the author of the code does not own the copyright in the code, as would be expected under the basic copyright framework. Rather, the person or business that employs the author or that commissioned the software owns the copyright in the code.
When a developer creates software as an employee, determining ownership of that software under the "work-made-for-hire" rule is relatively straightforward. Any work a developer creates within the scope of his or her employment is owned by the employer. Analysis of whether work is "within the scope of employment" can be extremely complex. However, at its most basic, if a developer writes a particular piece of software for work, his or her employer owns the copyright to that software.
http://asp-software.org/www/misv_resources/business-articles/who-owns-the-code/