Back in the day patents were put in the Constitution to advance the arts and sciences. Medieval guilds protected knowledge which held humanity/society back, so it was preferable to give limited government protection in exchange for opening up the knowledge (so the next generation can have at it, I guess).
Having patents for their own sake seems counterproductive in this regard, as a lot can be reverse engineered in the meantime.
In reality, everyone is told by legal not to look at previous patents ever, just in case they do infringe, it's not willful infringement.... patent portfolios protect the huge corps and the trolls, with very little in between, and the really lucrative stuff is kept proprietary anyway.
So it leads one to ask, while wasting time writing patents apps, what is the patent scheme good for really and is it beneficial for society?