The answer, the Supreme Court of Appeal decided recently, is largely a factual question: -
1. Normally copyright will be owned by the “author” of a computer program – being the maker or “the person who exercised control over the making of the computer program”;
2. However an employer will own the copyright in the case of a work “made in the course of the author’s employment by another person under a contract of service”. Critically, there is no requirement that it be made in the course of the “normal duties” of the employee – so the Court held computer programs developed by a meteorologist to belong to his employer even though “one would not ordinarily include computer programming as part of the duties of a meteorologist”;
3. There are no “generally applicable rules to determine whether or not a work was authored in the course of the employee’s employment. It remains by and large a factual issue that depends not only on the terms of the employment contract but also on the particular circumstances in which the particular work was created”.
That’s a wide and imprecise test – avoid doubt by having all your employment contracts drawn to cover this whole issue of copyright ownership (not just for computer programs – all inventive work needs to be dealt with).