Summarize this article:

These reactions reward the dog with attention and are to be avoided. Shouting is also ineffective. Instead, completely ignore any barking.  Telling the dog to be “Quiet” could be counter-effective. In some cases, spritzing your dog's with a spray bottle full of water can be an effective and harmless way to startle her out of barking. However, some dogs see this as a game rather than a distraction, so you'll have to determine whether it works for your dog. Rewarding your dog for behaviors you want to eliminate must be avoided, as this will only reinforce those behaviors. For example, if your dog barks at you to get attention and you respond by giving him attention, you've just rewarded him for the action you want to remove!  Ignore your dog when he's barking for attention. This can be tough, akin to ignoring a crying baby, but in order to avoid confusing your dog it's important that you not pay him any attention when he's demanding it. Don't reward your dog's demand for attention with glances, pets, or talking. If you're able to, turn your back to him. This will signal that you don't like this behavior. Eventually, the dog will quiet down. When your dog stops barking, praise him and give him treats. As he begins to understand the system, require him to stay quiet for longer periods of time before you reward him. If your dog is not a nipper, it can be helpful to close your dog's mouth when she barks inappropriately. This is a physical reinforcement that you do not approve of the dog's behavior. There are leashes and halters that allow you to gently pull the mouth closed while you're out on a walk. When feasible, remove your dog from anything that triggers barking.  Close blinds or curtains if your dog barks at people passing by. Put your dog alone in a room if she barks at guests.  Territorial barking can often be addressed by changing what your dog is able to see. Installing a wooden fence instead of a chain link fence or covering your windows with opaque film (that still allows light through) can help a territorial dog quiet down.  If your dog startles at unfamiliar noises, play a white noise machine or leave a fan running while you're not home. This can help distract your dog from the other noises she hears. If your dog barks whenever she sees other dogs or people, she may not get enough socialization. Model good behavior at the dog park, on walks, and when you interact with people. This can help teach territorial dogs that they don't have to bark to protect their territory everywhere they go. You can also take your dog to “doggie day care,” where she can play with other dogs and learn good dog behavior.
Avoid speaking to the dog or giving a hand gesture. Remove rewards for barking. Close your dog's mouth. Control the environment. Socialize your dog.