When dogs bark, it is their primary form of communication. While barking can be extremely useful, if untrained, barking can often become quite an issue. Dogs often bark because they have been trained to do so, or the opposite of the spectrum, have been allowed to bark too much by their parents/owners.
Whether the training has been intentional or inadvertent, it is ultimately due to behavior that is reinforced. When a behavior is reinforced, it tends to be repeated. For example, puppies often bark while in their crates and the owner lets them out to simply stop the noise (not good). Unruly dogs bark when their parents are at the dinner table, and those parents respond by giving them food to stop the noise (not good). These are examples of unintentional reinforcement. In these cases, the parents/owners have demonstrated to the dog that yes, in fact, their behavior is effective. This evolves to them learning that barking can be a way for them to get what they want.
Dogs often bark to alert us to changes in the environment, including sales people at our door, mail carriers and the like dropping off packages, actual bad guys near by, children playing near or in front of our houses, and of course, the occasional squirrel or rabbit who just happens to be passing by.
Often, dogs become protective of their owners and their homes. They begin to bark when a non-family member appears and are ultimately wondering if you understood them. A good dog is asking “do you hear me alerting you to this situation?”
You have to think of their barking as them having a need for acknowledgement.
When your dog barks, tell them “thank you”. Thank you for alerting us and bringing the matter to our attention. If needed, repeat “thank you” followed by issuing a proper command. With your command voice, say their name followed by the command such as “Shush!” or “Quiet!”
Once your dog is quiet, praise them for their behavior.
If they won’t stop barking, you must refocus their attention elsewhere. Introduce a dog treat, put it close to their nose where they can sniff it, however, do not give them the treat. If you give them the treat in this situation you have just rewarded them for improper behavior.
It is a well known fact that dogs cannot bark and sniff at the same time. So utilize this to refocus their attention. While your dog is sniffing the treat, they will be quiet. Issue the command again and once the proper behavior of silence is maintained for 10-15 seconds, then praise and reward them for this quiet behavior.
Keep in mind that dogs bark to communicate and for many reasons, including potential life-saving events. It is important for us to listen and acknowledge them. It is up to us humans to train our dogs properly to live a long, healthy and happy life.