IF I had an M9, I preferred the A2. If I needed short and handy, I had it. If I needed range, power, and accuracy, I had it. In and out of vehicles with just the rifle, no pistol available, definitely preferred deployability of the M4. In crowds, the M4.
The universe conspired against me, though -- whenever I had an M9 available, I had M4s being almost thrust at me to carry, like "Don't you wanna ditch your '16?" No, just give me the M9 and I'll be fine. But whenever the M9 wasn't available, neither was a shorter rifle.
Honestly, there just as at home, having a gun and knowing how to use it are much more important that what it is exactly. There may be specialists and specialized situations where it makes some difference, but most of the time, that is not so.