I prefer to call these guys iron giants due to their friendly relationship with the villagers, and I came across some information this morning that you might want to consider, if you are going to generate them for village defence.
1. A Golem can be spawned by placing hte blocks on the ground, or in the air. (fouriron blocks in a T shape, pumpkin on top) They will naturally spawn in a village with 15 villagers.
2. Golems cannot cross a 2 block wide river - so you can effectively give them an area to guard by building a river around the patrol area.
3. Golems do not like the rain, and will seek shelter - they will not move from shelter until rain has stopped
4. A Golem will attack you if you attack a villager (does not even require line of sight) - however it will return to neutral if you flee the village, and return later.
5. And best of all, if you created teh Golem yourself, it will never attack you