My advice on getting a military going? It's quite simple really. Get as much armor as you can, preferably in whole suits, spears, and shields. Wooden shields work fine, just make sure they're big shields. For armor, you want a chain shirt, breastplate, gauntlets, helmet, greaves, and high boots (low boots are fine if your civilization doesn't have them). The chain shirt is VITAL as standard armor actually leaves the upper arms (shoulders) exposed, and you end up with armless soldiers after a while. You CAN layer armor deeply, but there's not much need.
In order of importance, if you can only produce one of these, or only produce a few of better material, the order I give is:
Shield (blocking is the single best thing ever)
Chain Shirt (covers upper body, lower body, upper legs, and upper arms)
Helmet (those headshots...)
Weapon (no use being armed if you're too squishy)
Gauntlets (gotta keep hold of those weapons
Breastplate (fortified defenses!)
Greaves (leg shots are less common for me, you may swap places with Gauntlets if having trouble)
Boots (If dealing with forgotten beasts, put these at the top)
As for actual structure of military, the real key is a dedicated army, and constant training. Make decent alerts to get soldiers out to the field quickly. Especially, 99% of invasions come during the last month of a season, so they should spend 2 months training and 1 month on guard duty. I simply fit squads of 10 soldiers with spears - these are often the only weapon capable of damaging very large beasts, and are still very good at dealing with common goblins - and later expand to axes, usually multiple squads of axes.
The single best defensive addition you can make, is something to block line of sight. I usually build my killing field (a dedicated fighting location) with one wall leading to the fort, two solid walls on either side, and the wall leading to the outside being made in a checkerboard. This prevents LOS so dwarves won't rush out, but still allows enemies to come through. A long killing room, or multiple checkerboards may help improve combat, depending on how your military acts.
If you've got the vertical space available, you can also make the outside wall of your killing field into a solid wall, and then add ramps to BOTH sides. The dwarves can't see over the wall, so they'll only move forward when the goblins move over the ramps and come into the field. This is more difficult to set up for underground bases.