My fortress is of course always walled in. Often with a significant chunk of forest.
I usually have a fairly short entrance. It goes straight for a while, turns 180, straight again, a last 180 turn and then a short straightaway to the trade depot.
I have a 1-deep channel on both sides of the entrance, so it's a 5-wide corridor with walls on both sides, of which only 3-wide is walkable. At the end (closer to the depot) of the second straightaway, I have fortifications so that my marksdwarves can fire at goblins that are walking straight at them. Bolts that miss end up in the channel where I can recycle them. I put my melee dwarves on the innermost straightaway, so they don't come under fire until the invaders have already been turned to swiss cheese. The channel has a path back up to the surface where the marksdwarves can aim; if it's a goblin that fell in, he pops up and gets shot. If it's a dwarf, he pops up and has covering fire. To guard against kobolds and snatchers, just before the trade depot I have 6 ropes with war dogs attached.
This isn't my current setup, because my current fortress has no trade and no immigrants. Instead, I get the enemy to walk up a small hill, down a staircase, across a bridge, then about a 200-tile tunnel to emerge in my barracks. I can raise the bridge via a lever in my dining room and thus trap the enemy inside (or keep them outside). The tunnel has a few bends so my army can lie in wait without getting shot. As always, I have dogs close in to the fortress to detect the sneakier types.
In either case, an important point is to make sure that battles are close to the population (but out of sight), so it's easy to clean up after.