I tend to want to make killing-zones with archer-overlooks. Lined with fortifications to bother protect against retaliatory shots (not always terribly helpful against goblin bowmasters, admittedly), to prevent flyers (with a suitable roof, of course) from getting up there and as a handy 'safety-railing' to prevent anyone who does get injured (or, for some reason, finds themselves in hand-to-hand combat up there) from dodging off the edge.
For example, I might have set up my depot as follows..
Ground Z+1
Level (grey is tops of walls from below, if that
shows nicely differently in your forum colours)
HHHHHHHHHHH
######### H+++++++++H
# # H+HHHHHHH+H
# DDDDD # H+H H+HHH
# DDDDD #### H+H H++++
# DDDDD | < - depot and door access H+H H++++ => access from inside
# DDDDD #### H+H H++++
# DDDDD # H+H H+HHH
# # H+HHHHHHH+H
###|=|### < - raisable bridge barrier H+++++++++H
# # HHH+HHH+HHH
# # H+H H+H
# # H+H H+H
/ / / < - for an abitrary distance / / /
# # H+H H+H
# # H+H H+H
# # H+HHH+H
#|=|# < - outer bridge barrier H+++++H
HHHHHHH
Z+2 is floored over as a roof (assuming not already subterranean).
With a set-up like this, I can send archers around aim down at any bit of the bottom, as necessary. With a long-ish entry tunnel (with or without animals stationed above to actually alert me to covert incursions, which is obviously not the case for sieges) I prefer to lock down the attacking forces in-between the outer and inner lock (but, if nothing else, before they make their way past the depot, and any traders who are there[1][2]), then I can pick them off. If I have any problems with this it's usually getting enough ammo picked up (there's always some archers standing around with nothing left in their quivers).
Not shown are the (occasionally added) side-entrances to the killing-zones that I can open up at leisure to send a pre-stationed set of melee-dwarfs (or battle-hungry and now ammo-less bowdwarfs) to wade in for hand-to-hand.
Of course, this needs preparation. Or half-preparation with an eye to completing the rest as time progresses. More than once I've had to do clever things to prevent dwarfs building some of the defences on top of some walls from wandering atop other walls which are in hand firing-range of some hostiles... either trapped or just milling about because I closed off their entry-way. When its am ambush (i.e. non-siege) attack I have to be careful that I'm not suddenly discovering the second/third unit of sneak-troops while carrying things, precariously atop said walls.
Assuming I've seen all hostiles (or am prepared to react quickly to any that are still to be revealed), I've been known to actually open up another section of wall (with appropriate protection now built behind it; to close down the pathing into the fort from, at will) to draw milling hostiles through in order that I can either get an unfinished layer of protection completed in more safety or recover items/reset the defences (cage traps FTW!). Still, when things are at that stage of (non-)preparation, flying hostiles are usually the big problem, taking any chink in the armour as licence to just drift over the walls regardless of what land-routes I've specifically closed or opened.
[1] I might modify the design to allow me to open an alternate path or two to allow traders in/out while invaders are heading towards (or trapped within) a different entry-way. When I do this properly I basically own the territory, and deaths to non-hostiles (my own guys or traders, or immigrants) are left to just those that actually spawn too close to the hostile ones before I've isolated them.
[2] Trader escorts may or may not have their own ideas about attacking... I do try not to kill traders, or allow them to come to harm, but sometimes they get attacked or their guards rush out into enemies or over closing bridge-walls...