How did we teach them to bark? When dogs were first domesticated, it's most likely that dogs who were better at alerting their human counterparts to threats were considered more desirable and therefore more likely to be chosen for breeding. Today, however, we teach our dogs to bark because we don't communicate correctly with them.
Dogs are pragmatic; they "deal with things sensibly and realistically in a way that is based on practical rather than theoretical considerations." For this reason if a dog receives a certain response when he presents a behavior, he'll keep presenting that behavior in the future in anticipation of receiving the same response, ultimately creating a habit. For example, dog barks and you fill her food bowl, dog barks and you get her leash, dog barks and you open the door to let her back inside...etc, etc, etc. We have to shift our thinking from expecting our dogs to tell us what they want to a mindset of telling our dogs what we want.
There is a widely accepted theory that one of the reasons domestic dogs bark is because they have been bred to remain in a more juvenile state. If this is true, then is your dog really mature enough to run the household or do they need some guidance from you, the adult.
Ok, so enough about why dogs bark; you wanted to know how to make it stop, right?
As outlined in the 7 Facts about Canine Communication there are four main categories of methods used to stop barking: 1. Collars/Devices, 2. Desensitization/Counterconditioning, 3. Psychotropic drugs, 4. Surgical debarking. I would NEVER recommend surgical debarking, and it is indeed illegal in most states. The Association of Pet Dog Trainers also takes a firm stance against surgical debarking.
Ask your vet if you want to know more about psychotropic drugs like buspirone, clomipramine and amitriptylene, and don't go doing a Google search about them either. Since psychotropic drugs can have side effects, be sure to also ask your vet about homeopathic remedies like Problem Pet Solution or Rescue Remedy for Pets You can also talk to your vet about collars and devices, or you can talk to a certified dog trainer, and guess who I suggest can give you the best recommendation...YOUR VET :-)
I am a strong believer that Step 1 to solving your dog's barking problem is to give your dog an appropriate level of exercise, obedience training and time for enrichment. Working your dog's mind is guaranteed to tire him out. Why else do you think kindergarten children require nap time when they're only in school for half a day? And you'd be amazed what an extra 30 minute walk can do for your dog's overall happiness.
Step 2 to solving your dog's barking is to be consistent when you are around. If your dog barks in the crate while you're home, wait to take him out of the crate until he is quiet...even if you have to wait for an hour. If your dog stares out the window barking at dogs who walk past, tell him "No", and if he doesn't stop then close the blinds for 30 minutes. If he goes right back to barking at the window when you re-open the blinds, then close them again for 30 minutes and keep doing that until he realizes that the his barking removes his fun view of outside. Oh, and don't forget to tell him "Good boy" when he stops barking; it's even more important that you praise your dog for good behavior even if that good behavior is the act of stopping bad behavior.
To summarize it all: Try to think like your dog. If someone "barked" at you to make them dinner, would you? Or would you correct them for being rude and wait for them to ask nicely? If your mom gave you a piece of candy every time you set the table without her asking, I bet you would have set the table a lot more, but if she gave you a piece of candy when you yelled "where's dinner!?!" then please don't ever let anyone in my family go on a date with
For more detailed information, I recommend reading:
Barking: How to Get Your Dog to Quiet Down by The Humane Society of the United States
Dog & Puppy Barking Training Info by PerfectPaws.com