Here's why:
* Subject: The subject is "shepherd", the one performing the action.
* Verb: The verb is "hears", indicating the action.
* Object: The object is "a barking sound", what the shepherd is hearing.
The predicate includes the verb and everything that follows it, describing what the subject does.