Let's be honest, there's not much that could have been done to prevent that. At each defused terror attack this year you had counter terrorist experts saying sooner or later one will pass through, and that was today. It could have been the train last time, and we have to prepare for it to happen again.
The problem is that everybody expects our politicians to react somehow. After such events, no politician can say to the public that such things can never be completely avoided and that we should not do what the terrorists want by responding hastily, getting into wars, or cutting civil liberties. Even if changing nothing in these respects might be the right thing to do.