Use existing white fence. It's everywhere and you can rearrange it as you want. I am not 100% sure, but chance is it won't even count for maximum limit of build-able objects. NPCs can't jump over them so they works as a barriers. You can free lot of fence in parts which have shrub walls as those function as a barriers too. Only downside is that you can't store it in a workshop so you have to do everything manually.
Don't scrap every broken house unless you want use their foundations for new structures. Use them defensively as a walls/obstacles.
Water purifiers can be build in the river near the bridge.
Original named settlers which comes to Sanctuary with Preston have predefined behavior which makes them start "repairing" house once in a while so they will leave guard duty often and they won't stay at the assigned shops and workstations. Unless you don't mind, use them only for farming.
There is certain level of uncertainty about it among forum members, but it seems that enemies can spawn in the middle of your settlement. Huge walls around whole settlement would not help you in such case. Consider rather fortifying smaller central area and make some defenses face in to the settlement.
On one and only case when my settlement in Sanctuary got attacked I was by the river. When I rushed to the center I found my settlers fighting group of ghouls right next to house with the workshop. There were two corpses further down the road near my defenses which at the time consisted only of one maned guard post. Therefore I am not sure if those ghouls came from outside of the settlement and overwhelmed my guard-post or they spawned right in the middle of the settlement.