Software development is a mine field of patents. Software patents are not fostering innovation, they are stifling it. Drastic change is needed to fix this.
Software patents should only be considered valid during litigation when a valid software product incorporating the invention is actively marketed and sold by the patent holder that holds the patent. You can hold the patent until its normal expiration, but if you plan on going after somebody for using it, then you must be marketing and selling a real software product (and not just some bogus facade of a product) that incorporates the patent.
If you don't produce a viable product incorporating the invention within 24 months (i.e.: you are squatting on it and waiting for somebody to stumble across it on their own and thus infringe) then the patent should enter a "dormant" state. During the dormant state, any company incorporating the invention into a product automatically receives a perpetual unrestricted license to use the patent. The patent can only become active again once the patent holder releases (and makes available for sale) a software product that does incorporate the invention. However, any companies leveraging the invention during the dormant state are automatically grandfathered in because of the automatic perpetual unrestricted license.
If the patent holder releases a product, but ceases to make that product available that incorporates the patent for a 24-month period or fails to sell a minimum number of software product licenses within that 24-month period for their product (i.e.: the product is not viable), then the patent should also enter the dormant state.
Basically, this makes it far more expensive for patent trolls to operate, and it prevents folks from squatting on patents and then realizing their value once somebody else innovates and invents the same thing for themselves. You can hold your patent, but if five years down the road somebody else innovates in a way to create value for your patent you can then choose to release your own product, but all you can do about the already-released products of other companies is thank them for showing you how useful your patent might have been if you had gotten off your butt and done something with it.