my old dog was trained to bark if someone knocked on the front door. he quickly learned the sound of the UPS truck from a block and a half away and ran to the front door waiting for a knock...early warning system.
I have been trying to stop mine from barking at every bird, squirrel, turkey or deer that walks through the yard. We shop a lot online so there are plenty of delivery trucks to generate barking episodes.