Don't get into the idea of having medieval castle-style walls with the sort of toothed edge to the battlements, just make a big line of fortifications along the edge. Fortifications, for any given dwarf or enemy, seem to either act as a wall or as empty space. The two factors that decide which are skill and distance. Digging a 1-2 width ditch along the out edge of the wall will ensure that all enemy archers are far enough away that they can't shoot, unless they have a high enough skill level to overcome the distance.
This brings us to Snodub PainMiseryMurderDeathKill, Goblin Elite Crossbowman. He is literally the only unit in the game that is actually a threat to your defenses, because his skill level is high enough that he can basically ignore fortifications at any distance. Cower before him as he picks off your marksdwarves one at a time. You can order them to focus fire on him, but they'll usually ignore that order because they've already selected the target that they want to kill and don't switch targets on command.
Also, and this will also disrupt any traditional medieval castle image, but don't forget to put a roof over it. All of it. This not only stops fliers, but if your map isn't perfectly level, it also stops your dwarves from being perforated by a squad of filthy elves who happen to be standing on a hill.