Asking the owner before touching their dog is polite.
Annie is going for a walk.
Annie wants to make friends on her walk.
Annie walks up to someone and compliments their dog and asks if she can pet him.
Annie walks up to a stranger and pets their dog and startles the owner when the dog tries to bite.
The owner wants to make conversation too and lets Annie pet their dog.
The owner feels awkward and won't speak to Annie.