I generally agree with what has already been said. But not getting bitten has a lot to do with staying calm internally. If you stop and are scared, you can easily provoke dogs. If you try yelling at them but are afraid, you won't fool them.
It boils down to that you need to read the situation and maintain the correct attitude no matter what you have to do.