After the invasion, Obama did not favor an immediate pullout from Iraq. Right around the time he delivered his brilliant keynote address to the Democratic National Convention in July 2004, he told the Chicago Tribune that when it came to the war, "there's not much of a difference between my position and George Bush's position at this stage."
In other words, while he opposed the war, he was committed to Bush's initially flawed military strategy. That was not the position of Moveon.org.
During the long battle for the Democratic nomination, however, Obama's position evolved (or devolved) into a consistent call for withdrawal in order to differentiate himself from Hillary Clinton. When the Bush administration finally surged troops last year, it was Obama who "dug in," insisting that it wouldn't work - and in fact would make things even worse.
By last November, the success of the surge was obvious to all open-minded observers, yet Obama insisted that the gains had come merely in a few "certain neighborhoods." Anbar and Diyala provinces are somewhat larger than mere "neighborhoods" (ditto the "Triangle of Death"). In January, Obama's denial took a new form. During a debate, he suggested that progress was attributable to the Democratic congressional victories in 2006, because Sunnis saw that America would soon bug out.
Meantime, there was the supposedly dogmatic McCain challenging Bush's approach to Iraq nearly from the get-go. In the summer of 2003, in response to the upswing in violence, he called for "a lot more military" in order to win in Iraq. He said he had "no confidence" in Defense Secretary Donald Rumsfeld. In May 2004, McCain told ABC's George Stephanopoulos that "we've got to adjust to the realities of the situation as it exists and that means doing whatever is necessary and acting decisively."
McCain was challenging Bush when Obama was assuring voters there wasn't "much difference" between his position and Bush's. And now Obama is locked into a position despite the facts on the ground. Obama may indeed have great judgment, but his record shows little experience employing it.