Moats and high walls, sure. But to this day, the absolute best way to stop any attacker is to dig a trench (most minus water) and to build low parapets, primarily of dirt, sand, barbed wire and ideally some anti tank stuff.
The moat never really went away.