Let's not get into how idiotically ineffective spears would be (again). They are for inflicting organ damage and bleeding; DF is pretty accurate in that respect. Think of zombies like magma men: it won't effing work. And a fence might be very poor against the traditional undead mob, thinking in terms of sheer numbers.
I think your best bet would be a rough concrete building of some kind, with restricted access. Any older military installation or old Cold War bomb shelter would do. After that it's a matter of securing supplies. Concrete could theoretically be damaged by endless clawing, but rough concrete shreds flesh and would create a slimy surface. If you had roof access and a bit of ammo, even better, but a pyramid of undead crushing each other to get to you isn't beyond possibility. I think anything based on simply staying higher than zombies is likely to fail.
Imo, it's silly to plan around ideal constructions like the "Ideal anti-zombie wall", because if you had a window to prepare something like that, zombies would never be a threat in the first place. If I believed a zombie plague could spread, my plan would be to find 3-5 girls I know and trust not to turn into screaming idiots, at most 2 dependable guy friends (probably from my highschool football team, because I know exactly how athletic they are and how they hold up to stress). After that, assuming it all goes as I like, we'd head to any one of the isolated secure local buildings. Something along the lines of one of the old asylums or military bunkers would be ideal, but hard to access. I'm in Alabama, so old military installations are common and everyone has plenty of weaponry. We also know how to use it. If we had 600 .22 caliber long rifle bullets and a single correctly sited rifle, I'd kill ~590 zombies up to 100 yards. With a scope, something like 500/600 at 300 yards. A .22 bullet will travel around a mile, but its accuracy is poor after a few hundred yards (think slightly short meters).
The people I'd be taking along are all locals and know how to handle weapons. Any silly talk about running out of ammo should be dropped right now. If you have to face more than a few hundred zombies at a time, you won't be able to fight them with melee. If there are too many to shoot, you're screwed.
And believe me, there are enough bullets in any city in Alabama (granted there are only about 5 major cities) to kill half the US. That's just in the shops and stockpiles; I'm not counting private owners. Go over to a more redneck state like Mississippi or Arkansas, and there won't be anything non-living walking around a day or two after word gets out. "Let's go Zombie-shining!"