The thinking behind having a patent law are roughly as follows (apologies for huge post, BTW)...
Innovation is discouraged where people who innovate, and pay costs for innovation, have their market stolen by others who copy them; or who are required to keep commercial secrets, running the risks of betrayal, or of trade secrets dying with them inventor (reputed to be what happened with the 'purple of Cassius' deep red stained glass).
The innovation may not necessarily be 'invention' as we know it. if you bought new techniques into your country by studying what people were doing abroad, you deserved to recoup your research costs over a finite time. You could patent an idea in the UK that had been patented elsewhere up until 1968. This is not a UK eccentricity - before international patent treaties, many other countries had a similar approach. So, the idea that a patent was something that exclusively covers something that you thought up is just about 50 years old.
The idea that you could only patent a solid object or a physical process is more recent. This change happened about 1985 to 1995. People could patent something physical, but the physical thing could include a programmed processor. Then people tried to patent the particulars of the processing side, or patent the program as stored on memory as a physical thing, usually as an additional claim as an alternative to some dedicated processor which could be patented under the previous law. I was working in Canon on patents at the time, and saw it happen bit by bit.
There is no abstract reason why patenting a non-physical thing such as an algorithm should necessarily be a bad thing. In practice, there was relatively little established prior art experience, so cunning people were able to patent things that have been common knowledge for a long time, but have no known inventor. Again, this is not new: the Gillette company was threatened in 1913 by a latter-day patent troll patenting their safety razor, which was not protected in US law unless someone could find written evidence that was acceptable in court to prove that Gillette were the owners. Gillette won in the end, but the 'Gillette Defence' is still a term for the enormous cost of proving something in court even though everyone knows it.
The patent is a restrictive rule: it restricts the rights of everyone but the inventor. We may support such laws in the short term to encourage invention and innovation, but this support should always be tempered by a reluctance to restrict the rights of others. There are exceptions to patent law that allow people to use specific drugs for other problems not covered by the original patent. This is intended to allow re-use of existing compounds, rather than requiring the invention of a second-best compound to get around the existing patents.
In then end, the case for or against allowing software patents hangs on whether they do more harm than good. The experiment since they came in is almost exclusively against them. Software is usually well-protected by obscurity for several years because reverse engineering is hard. An imitation product will always lag behind the true one, provided the product is still being developed. If you wanted a logical argument against software patents, you might argue that the Church-Turing thesis covered a machine that could calculate anything that was calculable, and so should anticipate and cover all possible programs. This judge is arguing from a different direction, but the argument has similarities, but with the human mind is replacing the Turing-complete machine, and language is replacing algorithms. Judges can't just call laws into existence, even on the grounds of extreme obviousness, but they can put put ideas such as this, and they will become law if they stand the test of time.
Let's all hope they do.