To comment on Urbangiraffe's design on page 1, wouldn't the grate with a hunting dog underneath be even better, if the dog&grate were on the level above the entrance corridor, since then trolls wouldn't rip away the grate? Bowgoblins would still shoot it, though, for which the only complete defence would be windows (which will also be destroyed by trolls, so channel away the floors in front of them/place them 1 z-level up outside, as sentry towers). Too bad you can't build windows as floors, that would be great for watchdogs. Bonus points for dwarves getting happy thoughts by passing near windows.
I find cage traps to be too tedious over time where you have so many prisoners to deal with its impossible to dispose of them properly. That said I keep one to three cage traps around just so I got some prisoners to use for archery practice.
With minecarts you can have an animal stockpile set to only accept eg. goblin cages, load them into carts, and have them deliver your goblin prisoners someplace automatically (as in, no player input), even using the shotgunning physics to get them out of their cages. Stripping them down for goblinite would still have to be done manually prior to eg. directly shotgunning them into a volcano, but if it's archery targets you want, you don't really need to do that: they'll last longer with their armor and weapons still on, and the goblinite is perfectly accessible once they're dead.
The absolute simplest defense is a 1-tile wide, 15-20 tile long, path that everyone who wants to get inside your inner fortress has to walk over. On either side of this path should be a pit, which forces them to go back to the outside world before they can attempt to enter over the walkway filled with traps again.
Only one 1-tile wide corridor as an entrance is bad for your dwarves walking through it, though, since it will pretty much always be congested, slowing down dwarves passing through. You want wounded dwarves and such moved indoors as quickly as possible. At the very least, dig out the corridor to be 3-wide, but dig out either the middle or both sides, including removing ramps (except at the outer end, so anything that falls down has to walk back to the beginning and start over), and build retracting bridges on top. Link those to a lever that you pull when a siege arrives.
10-tile examples (B=bridges with dug-out space on level below,
T=trap of your choosing):
#1: traps in middle, #2: traps on sides, #3: alternating traps
BBBBBBBBBB TTTTTTTTTT TTTTTBBBBB
TTTTTTTTTT BBBBBBBBBB BBBBBTTTTT
BBBBBBBBBB TTTTTTTTTT TTTTTBBBBB
#4 is best because the "row" the invaders walk on doesn't matter.
Open spaces/bridges are 2 wide so they don't double-dodge from
your weapon traps forward onto the next bend:
TBBTTTTBBT
TBBTBBTBBT
TTTTBBTTTT and so on...
With #4, you'll want to dig a path to the outside end on the floor below (eg. down the middle), or better yet, have the sides be open spaces too, so they're even more likely to fall off and have to walk all the way again.
Really, what you want to read is the
Security design article on the wiki, it has lots of good stuff (which eg. I shamelessly ripped off here). Trap design is also a decent article, but focuses more on just the traps, not designing your whole entrance area, or how to be safe from sieges.