I put up a fence around part of my yard (not the whole yard, part of it, including to the front door. I put a gate on the fence which I lock to "my household only". I then grow my gardens and do other outside things (including my pond) inside the fence. I've never had zombies appear inside my fence, on the outside of the fence, certainly, but never on the inside of it. I don't know whether that is simply luck or a feature of fences.
Zombies do appear on the outside of the fence and walk back and forth on the outside of the fence, but that doesn't bother me at all.
Two things I have discovered:
* Bonhilda can't use the gate to get to the bin if it is outside of the yard I've created
* Repairmen (and I presume the other hired help you can get, and any guests/school friends/other non-household members) can't use the gate
So, I don't know if that is a feature of fences/gates or if I'm just simply lucky.