Dogs can be pretty good communicators. A yelp is easy to recognize as a sound of distress.
Growls are obvious.
A whine, coupled with a scratch at the door, may just keep the carpet clean and dry. The principles of evolution dictate that animals retain traits through natural selection. They hang on to functions that contribute to their survival, and that applies to making sounds no less than anything else. Scientists believe male birds sing, for example, to mark their territory, to attract mates, to maintain pair relationships, and to warn of impending predatory doom. But barking seems to defy all the rules of biological necessity.