Simply surround an existing village with a wall and you are perfectly protected against zombies and other enemies.
The houses are part of a village which were created through Minecraft. In addition, I have added a farm and a warehouse. This allows the village to supply itself for a while, for example in a zombie apocalypse.
The gates can be opened by a simple Red Stone gate.
I'm open to suggestions for improvement.
Instructions:

Damn very cool what you built
How long did you take?