Setting up walls is not quite worthless if you keep the area small.
In big settlements like Sanctuary, the monsters will spawn inside the area. So if you try to wall the whole area, you'll just be wasting materials as stuff will spawn inside the walls.
However, if you wall up a single building and build up, then stuff won't spawn in there. Even then it is probably better just to build a staircase up a few levels and then start making your building up there. Stuff doesn't spawn in the air and will have to run up to attack anything you have built.
On top of that, most of the defenses are worthless overall. Don't bother with guard towers, spotlights, shotgun turrets, or laser turrets. Heavy gun turrets and missile turrets are all that you need.
Also, if you follow the rule of adding the (food + water) x 2 for the defense rating you need, then chances of a settlement being attacked are very remote.
I also wouldn't bother with Sirens. 99% of the time the idiot NPC's set off the siren AFTER the threat has been dealt with which makes those sirens worthless as well.