Copyright disallows people from copying ideas that others thought of. Patents disallow people from using ideas even if they thought of them themselves, if someone else thought of them earlier. Some people think that copyright is a moral right. I don't think so. But even if we were to assume that copyright were a moral right, I can't see how anyone could honestly think that patents are. It seems to me that if we accept that people have a right to think of ideas themselves, and also accept that we should not punish people on the mere presumption of guilt (i.e. we shouldn't assume that someone has copied an idea if it's possible they thought of it themselves), then there can be no basis for considering patents as a moral right.
If there is any basis for patents at all, then, it must be, like tax, justified as a democratically agreed upon imposition on liberty as a means for promoting the greater good (even if we assume copyright to be a moral right).
By using clean room design (starting with an empty code base, and ensuring everything added was written in-house), it is possible for a company to ensure that software they produce is not covered by other people's copyrights. This is not the case with patents. The only way to determine that software is not covered by other people's patents is to check every part of it against every patent in existence.
In the case of pharmaceuticals, patents do significantly promote innovation, and a patent search is realistically achievable, so pharmaceutical patents do promote the greater good. In the case of software, patents do not significantly promote innovation, and patent searches are generally impractical, so software patents do not promote the greater good.