Kennedy and his advisors, who had the responsibility to formulate a policy, implement that policy & bring the crisis to a favorable conclusion, made the best possible choices by using diplomacy & naval action. The choices that he, his cabinet, and his advisors made during that time prevented the outbreak of World War III. Because of their decisions, we are alive today.
There were three possible choices for Kennedy and his men. Their first option was to bomb the missile sites, in effect taking out all of the missiles that they knew about. The second option was taking out the missiles first with an air strike, and then invading to remove any further missiles and overthrow Castro. (A fourth option was a trade off, the U.S. missiles in Turkey for the Russian missiles in Cuba.) Their final option was a naval blockade of Cuba, not allowing any ships to come into Cuba, and forcing them to turn back. .
The naval blockade was chosen because it was the best way to put pressure on the U.S.S.R to remove the missiles, without an outright military action that caused the loss of lives. If Kennedy would have chosen to bomb the sites, this could have started an all out nuclear war with the U.S.S.R., which is the last thing that anybody wanted. If he invaded Cuba, this would have most certainly started a nuclear war, and once again, not what Kennedy wanted. He choose not to trade the missiles in Cuba for those in Turkey because that would make the U.S. look weak, giving into the Russians demands. The only really feasible choice was a naval blockade.
Robert McNamara played a pivotal role during the Cuban Missile Crisis, managing the military preparations at the pentagon, and managing the military officers that were set on attacking Cuba. Without Robert McNamara, it is very well possible that the military personnel may have fired upon the transports ships or done some other act of war. General Curtis LeMay (Air Force Chief of Staff) also played a pivotal role in urging Kennedy to act.