My only addition, coming late to this, is that a dry moat (depathed, by removing at least the ramps up to the inner edgings) is better than wet. Although magma-filled can be quite distracting (also just as lethal if you can't stop your own troops dodging in, by - for example - not even letting them melee anywhere near it).
I tend to dig 2+Z deep (at the inner edge, at least) and 4-or-more wide moats, keep them dry, put strategic drawbridges (main accesses capable of Wagons, normally open and, monitored for sneakers/zig-zag traps laid inside or out; plus strategic sally-port ones normally closed but capable of both taking incoming and outgoing dorfs from whatever place is far from an idling invasion force) across them, line the rest of the inner with walls (overhung with sufficiently roofed firing positions) and a few other little tricks Imhave mentioned elsewhere, giving me the capability of turning turtle on besiegers.
With edge-flush raising bridges (1xN tiles, the 1 end tile at the edge, the opposing 1 tile at the moat edge or other obstacle) I can even isolate zones of border, such that an invasion from the Eastern edge of the map can be prevented from interfering with immigrants who might also wander on, but from the south, west or north edges if they're lucky enough not to arrive where the hostiles are/vice-versa (or, if I've been even more industrious, isolate the cardinal directions even from the semi-cardinal cornergzones, or more, upon suitable command-levering, at least from non-fliers and the more determined climbers).
But turtling (ever part-turtling!) always seems a bit exploity. Mostly I justify it as protection (without going so far as to configure-off invasions altogether) for the Grand Plan Megaproject I'm (seperately, or in close conjuction with the otherwise resource-grabbing moating/walling-off action) attempting to pursue...