Patents, in particular software patents, usually don't make sense from an economic standpoint. Patents grant a monopoly to an individual for the invention. Having a single individual control production and use of an invention is obviously inefficient compared to allowing everyone to use and build on it freely - there are a huge number of people in the world who could be doing useful things with the invention that are unable to do so because of the monopoly granted. Thus, granting the monopoly means that during the period the patent is valid, society makes less efficient usage of the invention than if it were in the public domain. How much? Well, let us say for the sake of argument that it's 10x less efficient. This number is completely made up, but bear with me.
Of course, patents act as an incentive to inventors. Without the incentive, perhaps it would have taken longer for the invention to become common knowledge. Let us say for the sake of argument that it took an extra five years for invention X to arise in the absence of patents. In this case, after the five year period, society benefits ten times more each year than it would if a single inventor were given a monopoly. If we assume, say, that society derives one unit of utility each year from the invention, then after a single year in the public domain, society will already have obtained double the benefit from the invention than in the previous five years that the patent holder was granted his monopoly. And this will continue for the lifetime of the patent.
Obviously, these numbers are made up. The point is more that the invention really does have to be something that would not have been discovered for a very long time to make up for the inefficiency of granting a monopoly. If it would have been discovered relatively soon anyway we would have been better off just waiting for that to occur. Software patents rarely make sense because software development requires almost no capital investment, and as a result, it is almost impossible for an individual to develop some software invention that would not be discovered by multiple other people soon in the future. Do you know of any individual or organization that is even capable of creating some software "invention" that would not be rediscovered independently anyway in the next five or ten years? I don't. No one is that far ahead of everyone else in software, precisely because there is no capital investment required and no real barriers to entry.
What I find irritating about all the software patent discussion is that patents are intended to benefit society - that is their purpose, "To promote the Progress of Science and useful Arts". But no one seems to want to reason about whether that is actually happening - that would mean doing things like thinking about how likely the invention was to be independely discovered soon anyway, estimating the multiplier of having the invention be in the public domain, etc. Instead we get regurgitation of this meme about making sure the little guy working in his basement gets compensated for his invention. Aside from the disingenuousness of this example, this is shifting the discussion away from the real issue. The issue is not whether "the little guy" deserves to be compensated for his work, the issue is whether granting "the little guy" or anyone else a monopoly for 17 years is net beneficial to society.