Patents were conceived when 17-20 years was a reasonable time to protect something - things were slower to develop and market then.
In the world of software patents, 17-20 months would be a more reasonable time frame. After which point, I would suggest an escalating "patent protection tax." Say you've patented a profitable idea, and at 18 months you're starting to see revenues build. Is it worth $10,000 to continue patent protection? If yes, pay the tax and get your protection continued, if no, let the idea fall to public domain (never to be patentable again). Review again at 36 months, but raise the cost to $20,000, again at 72 months with a cost of $40,000, again at 9 years with a cost of $80,000, and keep doubling the cost of "renewing patent protection" every 3 years until it is more economical to allow the idea into the public domain. Truly valuable patents will be protected for "a nominal fee" while nuisance trolls won't have any way to finance the cost of a submarine long enough to make it pay.
I think the same should be done for copyright - if Mickey Mouse and Lord of the Rings are valuable enough to keep protecting, then pay a tax and keep your exclusive rights, but make sure that the tax increases at a rate substantially higher than inflation, so that, eventually, these things find their way into the public domain.