Returning for a second nerd essay on the military tactics as I'm a big war history nerd:
I think a lot of people are forgetting the sheer numbers of people involved when they criticise them for not just defending behind the walls. In the opening episodes we see a ton of people camped outside Winterfell and from the scraps of information we get the army at their disposal seems to be around 40,000. This is far more people than you need to defend Winterfell, they simply wouldnt fit on the walls and a lot of them would just die in the crush if you try to deploy them all in the yards.
With that in mind, a couple of things I've seen questioned actually make sense. Deploying your unsullied out in front of the gates is one. This is absolutely what I would do (although I would deploy another phalanx just inside the gates to defend it when breached). Not only are they defending the weak point that is the gate and gatehouse, but they are going to fight to their maximum potential in phalanx formation in open unbroken ground. Let the dead pile up infront of their shield wall and leave your archers and melee fighters defending the walls.
The charge of the Dothraki was also fine, tactically speaking. In a battle like that you need to keep formation, defend the gates and keep them away from the walls as long as you can to allow your archers on the walls to do as much potential damage as they can.
If you try to have mounted Dothraki participate in that fight all it will do is disrupt your formation. You would get panicked horses crashing into your own men, and gaps opening in your lines as the Dothraki move about, both of which are extremely no bueno.
With that in mind you really only have 3 ways to use the Dothraki: 1. tell them to dismount and defend the walls (which wastes their shock cavalry potential and probably pisses them off), 2. send them off away from the siege so they can fight numerous smaller engagements on the perimeter where they can bring their numbers to bear in detail, or 3. charge them at the opening of the battle and hope to inflict as many casualties as possible in a blaze of glory. I would probably have gone for option 2 but they went for option 3 which is fine. Yes they all died but they probably killed 5 wights for every dead Dothraki.
As for the stuff that genuinely was dumb:
Yes fighting in front of the trench was retarded. Maybe they were planning on digging 2 trenches, fighting behind the first and then falling back behind the 2nd, but ran out of time to dig? Even still, they should have just said "ok lads guess we fight behind just one trench."
The trebuchets should have been firing continuously until overran, not just once, and a couple of them should have been inside the castle lobbing stuff over the walls.
Also, no ballista? Seriously, the Night King is coming on an undead dragon and nobody thought to make a few dragonglass-tipped ballistae and point them upwards?
Not raining arrows on the wights as they stood there just behind the trench made zero sense. Not using burning oil/ tar etc to defend the walls was also dumb.
The walls should also have been reinforced by reserves. Scrap the guys on either flank of the unsullied phalanx, (one of those flanks was commanded by Brienne I think). If you curve the phalanx against the wall in a ( or [ formation then you dont need these loose formations of infantry on the wings. Have them inside the castle in the courtyard ready to rush to whichever stretch of wall is in danger of being overrun.
Overall I think strategy-wise this battle was OK. This wasn't exactly Julius Caesar levels of siege warfare but their approach wasn't as bad as as a lot of people seem to think. I give whoever was in charge of deployment (Jon? Jorah?) a B-. It was way, way better than the Battle of the Bastards which was just honestly a series of massive blunders one after the other.