When Yahoo decided to sue Facebook for patent infringement a few months ago, many tech watchers felt that this was a desperate act by a company whose best days were long behind it.