As we all know, a dog has a sensitive nose. It likes the smell of familiar people, and the smell of strangers makes it feel a threat, so it will react.
Should. Barking or barking should be a way of self-protection. Barking, the general idea is to ask “Hello, who are you? Why haven’t you met?” or “you go away, don’t provoke me. If you dare to go a step further, I will bite you without consultation!”
Furthermore, dogs are domesticated by wild wolves. Wolves are gregarious animals. When they rest, there is always a watcher. When other dangerous animals approach, the Watcher will use the form of barking to remind his peers to prepare to fight or escape. Dogs have the nature of wolf. Naturally, they inherit the habit of seeing strangers, barking loudly and informing their close owners to solve problems quickly.
The other is that pet dogs are actually very timid now. They don’t like the taste of strangers, or the way you contact them is not correct, which makes them misunderstood that you pose a threat to their safety. They prove their fear in the form of barking. They want to frighten others first. In fact, it’s very contradictory. After scaring the other party, it’s still fear. Then it may slip away.