So the economic idea behind a patent is to prevent a free-rider problem. Say I spend years and tons of my money inventing the telephone. I finally make it work, then sell it on the market. Without the patent system, someone can buy my product, reverse engineer it, and release a knock-off at a vastly lower price than me because he doesn't have to recoup all of my R&D investment. If this happens all the time, then we have a market failure, where nobody has an incentive to engage in research-intensive invention where the end result can be easily copied.

This is really the only economically sensible basis for patent law. Unfortunately it tends to get clouded in lots of other fuzzy ideas, like protecting ideas and incentivizing innovation.

So to give an example of something I think is a legitimate software patent: consider a hypothetical solution to the hidden node problem in the context of white space devices and wireless microphones: http://www.shure.com/idc/groups/public/@gms_gmi_web/document...

Basically, say you have a transmitter T and a receiver R, and a whitespace device W. W listens to the spectrum and opportunistically uses whatever radio channels it hears as free. T transmits on a fixed frequency to R, and R receives without transmitting. There are situations where because of geography, R can hear T, but W cannot hear T. So W detects T/R's frequency as free, tries to use it, and interferes with R. This is the problem that Microsoft's white space devices ran into with unlicensed wireless microphones in the FCC tests.

What algorithms could you put in a whitespace device (or a network of whitespace devices) to alleviate this problem? This is not really something that a programmer of average competence would find obvious. Indeed, so far nobody has a good solution to the problem, despite quite a bit of research. However, when somebody does come up with a good algorithm, it will be fairly easy for other manufacturers to copy it. Even if it's not, unless it can be protected by a patent, whoever discovers it will have a huge incentive to keep it secret, which means people can't work on improving it.

I think this is a pretty good case for allowing patenting of the algorithm within the specific context of a whitespace device (which is basically what the current law is supposed to be). You have a situation where solving a problem requires quite a bit of investment. You can't really do research on this without buying a bunch of whitespace devices and wireless mics and doing a bunch of testing in different conditions). At the same time, because the end result would be easy to copy, nobody really has the incentive to work on it, especially not smaller research labs which might be able to solve the problem but certainly wouldn't have the manufacturing muscle to build and sell their own whitespace devices.

The reason so many software patents sound ridiculous is because they don't really require any innovation. They're simply an attempt to take obvious ideas and keep other people from using them. As a rough rule of thumb, for a patent to make sense, it should take way more effort to come up with the algorithm than it does to implement it. If it doesn't then there isn't really any free rider problem.