Unlike many cartridges today, the .40S&W is one of the few that was actually designed as a solution to a problem. That problem being that the FBI wanted a cartridge that improved on the terminal effects of the 9mm with good capacity. In addition, the new cartridge needed to penetrate common FBI testing barriers better than the 9mm or .45acp. The .40S&W improved on the 9mm in non expanding effects with its more obtuse semi-wadcutter bullet profile, and it improved on expansion effects with a more rapid mushrooming effect. Up until the wide use of autos in LE, the ideal handgun bullet designs were in revolvers. Notice the semi-wadcutter bullet profiles of the .357mag, .41mag, and .44mag in JHP format. This is the ideal bullet profile for maximizing expansion, tissue cutting, and tissue disruption. The 10mm was originally to be this desired cartridge, but after extensive testing they settled on a 10mm load that pushed a 180gr Sierra bullet at 980fps. Smith and Wesson and Winchester determined that the 10mm was a waste given those desired performance levels, so they created the .40S&W which is probably the most common law enforcement caliber on the market.......for a very good reason.
That being said, the 9mm does have some feeding advantages and some barrier penetration advantages. Not to mention it is easier to control. I do however consider the .40S&W to be a much better police and duty caliber than any .45 caliber alternatives.