Well, one of my favorite defenses is to make a series of drawbridges that go around a pillbox for my marksdwarves. The drawbridges can be raised to fling seigers into the watery moats filled with crocs or whatever nasty aquatic things I can get my hands on. I prefer to use "clapping" drawbridges - where there are two drawbridges facing in opposite directions from one another right next to one another at the ends, so that building destroyers can't reach the raised bridges. (And "clapping" bridges that are raised at the same time will actually atom smash things on the upswing, as well.)
Still, I have to rely on at least an outer ring of cage traps, just to get the megabeasts who will do stupid things like deconstruct the only bridge they can take to get into the fort, and to my waiting garrison, then realize what a stupid move that was, walk over and tip over a couple of windmills, then get bored and leave.
I use a LOT of drawbridges as I get more elaborate in my outer defensive rings (and I don't remove them, I just add more and more rings as I get bored). I use bridges to make it so that once goblins enter into my courtyard, the exit closes behind them, and they have to take another route out, where there are cage traps galore, so that the goblins that retreat are all captured, as well, and NOBODY escapes my fortress alive. (I also use bridges as a means of underground access to the trap resetting area... basically, my soil layer becomes a friggin' ant colony of tunnels to my defenses, which are a labyrinth aboveground.)
It gets pretty silly when megabeast attacks consist of 2 minutes of waiting for the dragon to meander through the limited accessways I cut into the mountain, only to finally walk into the first cage trap it finds, and end the "rampage".