What are some tactics to fortify villages and their population against outside attack?
General Strategy (regardless of difficulty level)
Barriers:
While exploring abandoned mine shafts, I was certain to strip the place bare of all the fencing that was present in the tunnel supports. This gave me a few full stacks of fencing which I then used to encircled the lone desert village I have found thus far. You could also chop down a bunch of trees and craft the fence yourself. Either way, it's very good at keeping all the nasty nighttime crawlies out of the village (except for the spiders, but they go after you, not the villagers). A few well placed fence gates make it easy for you to get in and out, and I have yet to see a villager manage to open one (they seem to only use wooden doors).
In addition, be sure to leave at least two blocks clear laterally both on the outside and the inside of the fence. Outside, because you don't want mobs to be able to jump onto (and over) the fence from a nearby block. Inside, because you don't want villagers to be able to jump onto the fence either, or the specific problem I had of my Iron Golems walking onto the fence from a one-high step one block away (I guess they take big steps). I kept having to let my Golems back in when they wandered out before I realized how they were getting out.
Lighting:
Hostile mobs could still spawn inside your barrier if there are poorly lit areas, so be liberal with the torches. I put them beside doors and windows, on corners of wheat fields, and spaced out along my fence barrier. It's also easy to forget to light up the roofs of structures. Roofs made of stairs or slabs don't need lighting, since they are non-opaque blocks and thus mobs can't spawn on them. However, flat-roofed structures, such as the small houses I've seen in my desert village, need illumination lest your villagers fall prey to "death from above" attacks.
Defenses:
If there are 16 adult villagers and at least 21 houses (i.e. doors) then an Iron Golem should spawn eventually. If your village is small, or you are impatient, you can craft one yourself with a pumpkin and 4 blocks of iron (36 iron ingots). You should leave at least two blocks of space between your structures so that they can freely move around your village and get to where they are needed.
Other mobs that can be used for defense are Snow Golems (as long as you're not in a melty desert), Tamed Wolves (if you are involved in the mob attack as either a defender or a victim), and Tamed Ocelots (which scare off Creepers with their mere presence).
Strategy for "Normal" Difficulty
There's no additional strategy other than what I list for the general strategies above. On "Normal" (or "Easy") difficulty, zombie sieges are possible, so zombies can occasionally appear inside your well-lit village barriers. Villagers are generally smart/fast enough to get inside a house and shut the door before the zombies get them, and since zombies are unable to break down wooden doors on "Normal" difficulty, they will be stuck outside the house until an Iron Golem can lumber over and dispatch them.
Strategy for "Hard" Difficulty
On "Hard" difficulty, zombies are able to break down wooden doors, which means they can get to your villagers during a siege if your Iron Golems can't intercept them first. They can't break down iron doors, but your villagers can't open them either, so that's a wash (unless you are fine with trapping your villagers inside their homes). The Siege Defense wiki entry suggests the following:
Hard mode: All doors should be one block above the ground. This still allows villagers to enter but prevents zombies from breaking in.
You can use pistons.
As you probably know, the villagers go inside at night. You can use a tripwire or something else to trigger a piston to push a block in front of the door so zombies can't break it.
When the sun rises they will go to the door, the piston will retract and the villagers can go outside again easily.
Dig a 4 block deep ditch, push 2 villagers in, the golem will stay in the area and no need for ugly walls.
If you wish to be nice place a little house underground for them, cover roof with dirt and nobody will ever know.