In the Two Towers film adaptation (it has been about a decade since I read the book, so if there are differences, I'd like to know about them), Gandalf derisively sneers:
They flee to the mountains when they should stand and fight!
This refers to Théoden running away to Helm's Deep instead of staying and fighting the army of Saruman.
Pardon me, but that sounds like a great idea.
In the movie, we see Théoden's town, Edoras:
It's essentially a bunch of thatch-roof houses, surrounded by a wooden fence. It's exposed on all sides. Everything in sight is flammable--and each gate is probably about the structural equivalent of a barn door keeping the hand of Isengard at bay. Contrast this with Helm's Deep:
Helm's Deep is a huge stone wall joining another stone wall, behind which is (another) stone wall, behind which is (yes another) stone wall, and then finally a fortified cave with exactly one point of entry. All up and down these walls are spectacular defensive positions, with the only way in being narrow, easily guarded choke points.
Not only this, we see that Helm's Deep works amazingly well in practice. It took an entire army loaded with state-of-the-art weaponry, including bombs, siege ladders, and genetically engineered orcs as soldiers on the order of twelve hours to break through the defenders, which comprised mostly untrained women, children, old men, and a last-minute platoon of elves, all outnumbered probably 100 to 1.
Note also that during that time, Gandalf managed to summon the riders of Rohan, which were the people in Rohan that actually, you know, could fight. The siege of Helm's Deep bought the good guys valuable time.
Under the circumstances, I'd say it's ludicrous to consider going anywhere but Helm's Deep. Why did Gandalf think otherwise?