Obviousness is the key issue for me. I suspect most people, even those who work in the technology fields, are not aware that it is considered essentially impossible to prove obviousness (source: I have worked as a consultant on several patent litigation cases). So you have the ridiculous situation that almost everyone in the relevant field believes that almost all patents granted are obvious, but almost no litigation succeeds in finding that same conclusion.
My solution is to cap the number of patents granted every year to, say, 1000. Patents would be ranked from least to most obvious and actual prior art investigation would take place (because the number is manageable). The ones below the cap would be unpatentable.
Say Johnny Evilguy digs up your widget from the USPTO database from a Tor connection and then re-implements it. Poof, your patent is dead, and you can't prove he read it.
Beyond that, over time things that were novel are no longer novel as the direction of technical development changes, so the timing would be important as well.
Example: Someone steals an apple to feed their hungry child. Yes, it's a crime, but sending the parent to prison isn't a solution; the child is still hungry, and now both of them will to varying extents have to be cared for by the state, all over a 59 cent Apple.
The easiest way to prove obviousness is to find printed publications that describe the claimed invention. For obviousness, multiple printed publications can be combined as long as they are in a related field and there would be some kind of motivation for one of ordinary skill in the art to combine what they disclose.
That's the incentive given to the inventor. In exchange society is supposed to eventually get access to an idea that anyone can make use of.
There's a huge breakdown with this system though--the majority of software patents aren't written in a way that would allow someone to reproduce them. Or as you've pointed out they're so obvious that they would have existed without the patent monopoly grant.
If society isn't benefiting, there's no point.