Here's how you can do it.
To start off, you have to know exactly why they are barking.
Most of the time it is because they feel that there is something that is interesting or threatening that they want to bring the attention to their owner.
Whether you think it is interesting or not is a different story, and sometimes they may be barking at something that you don't even know exists, because their sight and vision is much better than a human's.
So the first step you have to take when getting them to stop is by acknowledging whatever it is they are barking at.
You can do this by telling your dog that you see the thing that they are barking at, and that is enough.
You should even follow this up with a verbal command to "stop".
This will tell them that the situation is OK, and they can stop without any bad repercussions.
The next thing that you can try is a citronella collar.
You can put the collar on the dog by following the directions included with the collar.
Every time the dog barks, the dog will get a quick spray of citronella, which they don't like, and will stop barking.
This should only be a solution for use outside.