So it turns out that Yahoo actually invented Facebook. At least, that’s what Yahoo is claiming in a patent infringement lawsuit filed in California on Monday. “Facebook’s entire social network model,” the lawsuit says, “is based on Yahoo!’s patented social networking technology.”

Yahoo could well win its case. Infringement lawsuits, after all, are perfectly legal. And Facebook owns just 21 patents of its own, which will make it harder to cut a cross-licensing deal with Yahoo. (Jon Brodkin speculates that Microsoft, a Facebook investor, could eventually step in and wield its mighty patent portfolio to force a settlement.) But the affair does underscore a serious criticism of the whole regime surrounding software patents. Many software patents are overly broad. They’re not specific chemical formulas. They’re not discrete technologies. Oftentimes they’re amorphous concepts that multiple developers could have dreamed up on their own.

For instance, another one of the Yahoo patents at stake in the Facebook lawsuit is for a “dynamic page generator,” a process that allows Web sites to customize their news pages. A slew of different sites do something along these lines — you could make an argument that Twitter also violates this patent, for instance.

Baio’s account of how Yahoo actually came to own these patents is fascinating and worth reading. Like many programmers, Baio was originally hesitant to patent his ideas for the company. “But,” Baio explains, “Yahoo assured us that their patent portfolio was a precautionary measure, to defend against patent trolls.” As it turned out, patent trolls weren’t the issue. Instead, Yahoo fell upon hard times and decided to deploy its portfolio of patents to wheedle money out of bigger companies like Google, and now Facebook.

To hear Baio tell it, the entire legal regime that enables Yahoo to take Facebook to court needs to be radically overhauled. “Software patents should be abolished, plain and simple,” he writes. “Software is already covered by copyright, making patent protection unnecessary.”

While not all critics of software patents would go that far, there’s a growing sense that the current system has become untenable — leading to pointless lawsuits and to costly arms races by tech companies to stockpile patents. A recent paper by Cato’s Timothy Lee and Yale’s Christina Mulligan pointed out that there’s simply no feasible way for every company to check its own software patents for infringement without overloading the U.S. legal system. Lee and Mulligan are in favor of abolishing patents, but they also suggested a number of intermediate ideas for reform, from limiting damages for infringement to allowing an “independent invention” defense (more than 90 percent of patent suits nowadays are filed against independent inventors — not copiers).

So far, Congress hasn’t shown much interest in these issues. But it’s possible that a big, gory war between Yahoo and Facebook could get somebody’s attention.

Update: Just to clarify, Baio’s patent 7844604, covering activity feeds, isn’t one of the 10 patents in the lawsuit — although the way he describes it, Yahoo arguably could use it to attack Facebook.