If you just want to keep settlements 'happy' and productive, here's some guidelines. This is based on my own 1200+ hours of play. All settlers need to be assigned to a task and a bed or they will not contribute to the % rate. Check the settlement at 2:00am to see if anyone is standing around. If so assign them to a bed. Keep in mind that provisioners and guards require a bed, but never use it. Beds also have to be under roof. Between 8:00am and 6:00pm check to make sure they are all 'busy'. You can check their assignment in workshop mode. There are also some mods that can help with this. Put the bar (restaurant) in an area large enough to accommodate all the settlers between 6:00 and 9:00pm. Everyone needs to have some happy time. If they won't fit in one area, setup another one and they will split. There should be at least one level III restaurant, doctor, and trader. They all contribute to the happiness total gain. Armor, weapon and clothing vendors do not contribute. Make sure all public areas and living areas are well lit with plenty of lights, but not sleeping areas. Generators and turrets need to be away from living quarters. Don't put turrets on top on the building. Paintings in living areas helps. Music radio in work areas, jukebox in food/bar area helps. Attacks will kill happiness fast. Make sure the defense is at least twice the total of food + water. Because of this, don't overdue water. If you still get attacks, move the defenses closer to the attack spawn points so most of the attackers are killed before you get back to the settlement. Also make sure the settlers are all armed, doesn't take much, but should be decent. They only need 1 round for the weapon they are using. So if they have a mini gun or missle launcher, they won't use up any ammo. Not sure if the 'Bed Bug' has been fixed in 1.5. If it occurs, you need to get back to the settlement asap. It will cut happiness as much as 50% if you don't get back within 24hours. Look for the warning sign in your pipboy under the data / settlements tab. Make sure to complete any settlement quests. This should keep the settlement at 80-85 % when you aren't there.