Both copyright and patent protect the owner of intellectual property. To my understanding, copyright is for an expression idea (e.g. art, book) whereas patent is more to do with the functionality of an invention (e.g. how a certain appliance works). Somethings seem to overlap, like computer programs. Why is it debated whether computer programs can be patented? Are there tests to determine if something can be copyrighted or patented? Simple example scenarios would be appreciated.
Copyright protects literary and artistic works (Berne Convention art 2(1)). This is very wide, and essentially covers any kind of expression.
However, copyright does not cover the underlying idea itself. This is because an idea is not a work. For example, the idea of showing some fruit on a table is not copyrightable, since it is merely an unexpressed idea. But once an artist has painted such a scene, that particular expression comes with copyright protection. Another artist could paint another painting of fruit freely, but they could not copy the existing one without infringing the copyright.
In addition, a work must be original for copyright to subsist in the work. The standard for originality differs from country to country: it is not fixed by international treaty. But generally it requires at least some amount of effort or creativity, and cannot have simply been copied from someone else.
Computer programs are expressly defined as literary works (TRIPS art 10(1)). Therefore, any computer program (which is an expression of some underlying idea or method) is automatically protected by copyright. So, if you create a program implementing tic-tac-toe, then there is copyright in your program. There are many such other programs, and the author of each of these also receives a copyright. Because each expression is an original literary work, and therefore automatically receives its own protection. But the underlying game is merely an idea, and therefore does not receive copyright.
Therefore, the test for copyright is:
Is there a work (as defined by TRIPS art 10 and the Berne Convention)?
Is the work original (based on the standards of whatever country you're considering)?
Patents are available “for any inventions, whether products or processes, in all fields of technology, provided that they are new, involve an inventive step and are capable of industrial application” (TRIPS art 27).
On its face, this seems straight-forward enough. However, there is a body of law growing by the day about when a computer-implemented method becomes an invention, as opposed to merely an idea. This differs from country to country. However, the two biggest markets, the US and Europe, now generally agree on a high level: a computer-implemented method must essentially improve the operation of the computer to be considered an invention.
For example, tic-tac-toe is not an invention: it is merely a game. If you straightforwardly implement it on a computer, it is still not an invention, because there is no real change to the computer: the computer is still doing what it would always do. However, a method for allocating memory on a computer is an invention: it improves how the computer operates.
However, a patent covers every expression of the underlying invention. If you have a patent for allocating memory, no one else can use that method without infringing your patent.
Therefore the test for a patent is:
Is there an invention (which is considered patent-eligible in the country you're considering)?
Is the invention novel?
Does the invention involve an inventive step (or "is it non-obvious" in some countries)?
Is the invention capable of industrial application (or "is it useful" in some countries)?
A brief example
Copyright and patents cover completely different things.
A patent might cover a method for allocating memory. But a patent cannot cover merely a program implementing a known method, since that would be obvious.
A program which allocates memory using that method would itself receive copyright, since it is a literary work. But copyright cannot cover the underlying idea of allocating memory, since that is not an expression, but just an idea.