I'm up to level 70 and have never built any walls, other than using pre-existing walls in places like Covenant and The Castle. As others have mentioned, enemies WILL get in whether you have walls or not, sometimes logically (such as radscorpions and molerats coming up from underground), but sometimes not so much. Just assume any spot can be potentially attacked, and thus place your turrets and other defenses strategically throughout your settlement, especially if it's a big area.
Have more water than your number of settlers, and you will get surplus purified water deposited to your workbench. Purified water may be useful later on.
General stores, food & drink stores, clothing stores, and clinics raise your settlement's happiness, but weapon stores and armor stores do not. But build stores of all kinds, since they earn you income. Over time, you'll be amazed by how much you earn. Don't be surprised if your stores earn you several times more than what you find on your own.
Though we have no definitive proof, we think higher level items of all kinds yield more happiness than their lower level counterparts. I.e. beds > sleeping bags, water purifier > water pumps, level 3 store > level 1 and 2 stores, etc.
So you want to build water purifiers (more happiness) whenever and wherever you can, since not all settlements are located near a body of water.
Supply lines may disappear, which is most likely a bug. So if you "daisy-chain" supply lines, and you lose one line, the whole chain may be broken.
Same with routing power to turrets (higher level turrets require power). If you daisy-chain their power lines, one damaged turret will render all turrets in the chain inoperable. Route every turret to a power pylon or conduit individually.
Scavenging stations are not very useful in my experience. Your most needed resources are wood, steel, copper, and oil, and scavenging stations rarely help with those or maybe they just never get enough. Wood and steel are especially important, since you use them by the hundreds when you build a settlement. There are lots of trees to scrap in most settlements, so wood is less of a problem. But I'm often low on steel, and have to find them the hard way: collecting junk from the wasteland.
As others have pointed out, equip your settlers with better armor and weapons. Also, have a large population. A good fighting force should be good in strength and number.
Watch out for settlers who can't get to bed (https://youtu.be/2auJ5qT0bso), and beds that become mysteriously unassigned (https://youtu.be/8kONA3uCfd8). Both may be bugs, but both lead to loss of happiness which you have to fix.