Ban software patents.
Invalidate them all, erase the database of all current & proposed software patents, & just stop taking applications for any software patent at all.
If it involves doing it on a computer, drop the application in the shredder, point the applicant at the sign that reads "No Software Patents. Period. Go Away.", and kick them out the door.
We need to go back to the "If you can't bring in a physical working model of your idea, you don't get to patent it." style of patents.
Bring in a working prototype, pay the application fee, leave the blueprints & model with the patent office, at which point the office goes through their records to determine if prior art exists. If not, you get the patent, if it does, you get a copy of the patent that covers "your" invention.
If your patent involves doing it on a computer, go stick your head in a pig.
I know this won't make me very popular among a bunch of coders, but if you stop to think of what you could do if folks like Alphabet, Apple, Ebay, Microsoft, Paypal, FaceBook, TicToc, etal couldn't use software patents to bankrupt you with, couldn't use threats of lawsuits because your code somehow violates some obscenely obscure software patent that was only granted yesterday, or otherwise screw you over because you dared to use some code library that you & others have been using for free for decades but that has recently been gobbled up by the beheamoth & is now no longer free to use.
Yes it means they can rip off your code, but that works both ways so go grab a copy of the Windows source code, rewrite it to be faster, better, less buggy, more secure, & all around a better product, change the name to something like "Windows That Doesn't Suck(TM)", and beat them at their own game.