President Obama's time in office has not been defined by terrorism as President George W. Bush's was. Yet incidents like the one in Boston have been a regular, painful through line of his presidency.
When a new administration walks into the White House, nobody provides a handbook on how to respond to a terrorist attack. So the Obama administration has been on a steady learning curve.
When an underwear bomber tried to bring down an airplane on Christmas Day 2009, the White House was basically silent for two days. Finally, Homeland Security Secretary Janet Napolitano made this tone-deaf comment on CNN, while Obama kept vacationing in Hawaii: "The system worked. Everybody played an important role here. The passengers and crew of the flight took appropriate action."
That was a Sunday. On Monday, Obama finally addressed the country.
"The American people should be assured that we are doing everything in our power to keep you and your family safe and secure during this busy holiday season," he said.
Matt Miller, who was the Justice Department's director of public affairs in those days, says slip-ups have taught the Obama team some important lessons.
"You have to communicate early and you have to communicate often," he says. "You don't have to tell the public everything you know, but you have to say something. And, most importantly, what you say has to be accurate."
Faltering at any one of those things can shake the public confidence. Accuracy was the problem again just last year, when the administration responded to a terrorist attack in Benghazi, Libya.
United Nations Ambassador Susan Rice took the fall for saying on ABC: "What this began as was a spontaneous, not a premeditated, response to what had transpired in Cairo."
The White House learned the timing lesson more easily. Obama spoke the morning after Benghazi, and he made a statement a few hours after bombs went off at the Boston Marathon last week.
"We will find out who did this," he said. "We'll find out why they did this. Any responsible individuals, any responsible groups will feel the full weight of justice."
While those statements may sound like bland platitudes, Kenneth Wainstein, Bush's homeland security adviser, says they're important.
"I think the American psyche and the American people just need to hear that the president is on the job, he's determined, and that the assets in the federal government are going to do everything it can to bring these people to justice and prevent this from happening again," Wainstein says.
After a terrorist attack, a president has important roles in public and private. Behind the scenes, an orchestra of investigators works at a manic pace. The president does not conduct that orchestra, or even write the music. But he must thoroughly understand every note.
In front of the cameras, he has a different job. He must channel the nation's feelings, projecting resolve and, at times, grief — as he did last week in Boston, remembering 8-year-old Martin Richard: "We're left with two enduring images of this little boy, forever smiling for his beloved Bruins and forever expressing a wish he made on a blue posterboard: 'No more hurting people. Peace.' "
Michael O'Hanlon of the Brookings Institution says these moments show a facet of Obama we don't often see.
"It is distinctive in my mind as ... revealing the emotional side of a man who often, you know, is a little bit emotionally controlled or removed," O'Hanlon says.
Obama may not have come to office with a handbook on how to respond to terrorist attacks. But he has slowly crafted one over time, through forced repetition.