Fence

Fences are wooden wall blocks added in the Seecret Friday update 8, version 1.0.17 Alpha. They count as one and a half blocks tall for player/mob collision, and one block tall for all other purposes. This prevents players and mobs from jumping over them, while using only one actual block space.

A fence occupies the center space of blocks and automatically connects to one another when another fence is placed next to it. Fences are one of the many blocks that are broken more quickly with a sword, but deals double damage to it.

Uses
A fence's primary use is enclosing an area. Functionally, the fence serves to keep outside mobs and players out, and inside mobs and players in. A wide area can be made monster-resistant by enclosing it in fences and lighting the inside portion heavily. This keeps any monsters from spawning within the fence, and keeps most monsters which spawned outside the fence from coming in; the exception is spiders, which can climb up or even jump over the fence. In addition, while skeletons are unable to cross a fence, they can shoot over it.

Fences can also be used as railings, especially on the edges of balconies or floating platforms. Since fences cannot be jumped over, this keeps players and mobs from falling off while still allowing them to easily see past the fence.

Fence corners do not need to be complete in order to be sealed. A corner where two directions meet at a right angle can be created without the actual corner piece. This will create two separate fences which terminate next to each other without actually touching. While there is a visible gap, players and mobs will still be unable to pass through. This feature can be used to create lengths of diagonal fences, which will appear as nothing but posts, yet will still prevent anything from passing.

History
When first implemented, the game prevented blocks from being placed above the fence but allowed the fence to be placed on a location when there is a block above it. This loophole was soon commonly exploited to allows fences to be stacked, mainly for aesthetic purposes.

The stacking process was done by creating a wall of blocks one layer shorter than the intended height of the fence and working down. Removing blocks from underneath the fence did not cause it to collapse like cacti and doors, so the lower layers of the wall could be replaced by fences easily, one-by-one. These rules were not applied underwater so they could be stacked just like any other block when submerged.

Minecraft beta 1.7 lifted this restriction entirely, allowing all blocks, including torches to be placed on top of it.

Standing on top of a fence in multiplayer used to count as an illegal move, causing players to get stuck. This action has also crashed the server in the past. This bug was fixed in the Beta 1.3 update. Fences became flammable as of the 1.6 update.

Crafting
A formula to calculate the needed amount of wood blocks to make enough fences to surround an area would be W=(3*(N-U))/8 where W is the amount of wood, N is the number of needed fences (the perimeter for all intents and purposes) and U is the number of fences that you can use for the perimeter. Remember, due to the immense amount of materials, you may have extra fences when dealing with larger amounts of fences.

Future Plans
There may be plans to add a gate, which would most likely be placed like a fence, and fit aesthetically with other fence pieces. However, it would act like a door, where you would click it to open it. Doors work fine as a substitution, but look out of place between fence posts. This topic is most recognized at this thread on Getsatisfaction.com, where Notch himself commented saying "Hmmm... Possibly! Why not?". That thread was later marked "Under Consideration".

The problem holding this back is that fences are centered while the normal doors are on the edge.

Currently on the Getsatisfaction.com, the feature is stated to be implemented, stating that the 1.8 update may contain fence doors.