The rumor that software cannot be protected by a patent is still going strong. Perhaps because there is a grain of truth in it: the source code itself is indeed not patentable.
Even so, the source code of a piece of software is protected automatically from the moment it is written, with no application and no fees – by copyright. This is because software counts as a literary work and therefore enjoys the same copyright protection as works of literature.
But that also means that only the exact wording is protected, not the function or the effect of a program. If someone writes source code with different wording or in a different programming language, this is not a copyright infringement – even if the software performs the same function or achieves the same effect.
This is where a patent comes in: it can protect the function and the effect of a piece of software – provided the software meets the criteria for patentability. To do so, it has to clear at least two hurdles that apply to all inventions: it must be technical, and it must be inventive.