That these embarassing defenses for Hiroshima and Nagasaki are still taught in school in some places holds little regard for the historical record, and is in many cases pure jingoism.
I can recommend the work of Peter Kuznik, Professor of History and Director of the Nuclear Studies Institute at American University, if you want to read some of the more serious scholary work on this.
Japan was virtually destroyed. The military had collapsed, the industry had collapsed, the allies had complete control of Japanese air space and were conducting bombing raids deliberately against civilian targets on a daily basis. Whole cities were destroyed this way by fire bombing.
The '1000 plane' formations invented by RAF marshall 'Bomber Harris' also known as 'Butcher Harris' when laying waste to defenseless German cities (much like the Germans had done to English cities during the Blitz), made sure no civilians could escape the ensuing fire storms, and the US Air Force burned hundreds of thousands of innocent civilian Japenese men, women and children with similar fervor. In the end the barbarity had taken such forms as to intentionally leave whole cities unscathed, so the USAF could properly estimate its destructive capabilities when finally burning these same cities to the ground focusing all its firepower and testing new weapons, maximizing casualties. There was even some kind of bizarre contest going between RAF and USAF as to whom could murder most people and destroy most infrastructure in Germany and Japan.
Some of the most densely populated cities in the world made almost entirely of paper and wood were set aflame in massive fire storms, the USAF bomber pilots describing the smell of burning and cooking flesh from their cockpits as hundreds of thousands of people were burned alive in the man-made infernos below them (as in the firebombing of Tokyo, the most deadly bombing raids of the whole war), intentionally targeting the most populated areas, for example working class districts.
Reasons for bombing were not military but on the basis that some city 'hadn't been bombed yet'.
Yes, the ensuing nuclear bombings were at the time defended by Truman as if 'saving lives' (a view still held in some places because some US state schools disgracefully still haven't updated their history material but again the last Anglo empire was also very fond of painting its massacres in pretty colors), and that may be true if we are talking about American lives only. If you look, you will find however that Truman's estimates of casualties were wildly inflated, and drastically decreased many times following the war. And there's overwhelming evidence to suggest that Japanese lives were never a consideration.
Historians know today that Japan was already sending out diplomatic probes for surrender, as the Russians were nearing Manchuria. This last factor was what most serious scholars today recognize as the reason for the nukes, the Japanese were done for and everyone knew it, what Truman and the US Security Council (which if you need a testament to human madness go read their internal documents for the period) needed for the US Grand Strategy of post-WWII world domination was for the world, particularly Stalin, to see what terrible weapons the Allies had constructed, and for the Japanese to not capitulate to Russia (as Japan was considered by US planners as part of the 'grand area' of US post-war control to be).
And no, military installations in Hiroshima and Nagasaki were laughable at best, even at the time the bombing wasn't seen as being against a military target in any way (there's wasn't even a distinction between the two at this point), it was as the Allied bombings had been for the last years of the war; deliberately targeting civilians, to cause terror and as much damage as possible, and a quick end to the war before Russia could grab a piece of the pie, an extra card on the hand at Yalta and Potsdam, and the turbo engine of Asian economy on US hands (Japanese export always a fear in the US, much of the fear of the 'domino theory' around the Vietnam War was that Vietnam would turn out as a Japense export market, the extensive bombing of the country averted this and in many ways fulfilled US war aims).
To suddenly start saying it is somehow a moral choice meant to save lives that you kill a few hundred thousand more is near mind-boggling when you've for years bombed civilian cities with one aim only; to cause so much death and despair and destruction as humanly possible, and to all of a sudden claim sensitivity after six years of the worst war in human history is hardly even a joke. To think USAF or US planners were in any way taking Japanese civilian casualties into regard one has to consider the widely held view of Asians by Anglo-Americans; they were untermenschen, and the whole war in the Pacific was waged with the brutality and contempt for human lives that westerners usually reserve for when fighting 'primitives'.
As usual with such events there's only the realpolitik imperative.
And Truman's reaction to Hiroshima and Nagasaki was ecstatic.