Canis lupus familiaris
The main problem in almost all of these cases is that the critter in question is acquired as a fashion accessory. It's not allowed to be a dog. It's a thing, like a handbag or a pair of shoes or 24 inch rims and low profile tires on an SUV[1].
Unfortunately, dogs are not just things. They are dogs. A subspecies of the wolf. They can't think like humans, rather they are genetically programmed to react to given situations. They ALWAYS react the same way[2] ... When people try to get them to react in a manor which isn't dog-like, the dog gets confused. Thinking of your dog as family member, or a baby, or a child is dangerous. It's not. It's a dog. Remember that, and act accordingly.
Often that confusion leads to a "who is in charge?" situation in their fuzzy little minds. All dogs want to be a part of a pack. All packs need a pack leader. No dog WANTS to be "in charge", but if nobody else is obviously the leader, dog genetics kick in. The dog takes over.
Dogs are also extremely good at picking up on body language and "mood" (for want of a better word ... emotion would confer too much humanity on them). If an owner shows fear of their breed of choice, or fear of how the dog will react in a given situation, chances are good that the dog will become afraid. NOT afraid of the owner (who feeds and shelters the dog), but rather a fear of the world in general.
This is why dogs often become perceived as "vicious" ... They normally aren't actually vicious, they are scared, and attempting to protect what they view as their pack and territory from whatever they see as "dangerous". BECAUSE THEIR OWNER IS NOT THE JOB!
SO ... got an obnoxious yap-dog? Does your dog strain at the lead, and attempt to "attack" strangers and other animals? Stop jerking on the lead. Instead try to put a foot on the bight (to keep the dog's head down[4]), and maneuver yourself to put yourself between your dog and the perceived problem. Put your back to the "problem" (unless it really is dangerous ...). Tell your dog, in a quiet, calm, rational voice (and state of mind, if you can manage it) "It's OK, fido, I have things under control <sfsf>".
Do this EVERY TIME. Let your dog know YOU have things under control. Become the leader. Your dog will respect you for it ... and will become a LOT easier to train.
If the dog is prone to barking at "stuff" on the other side of the fence, I advise walking the dog on-lead in your own garden when he's doing his business and use the above. The younger the dog, the faster you'll get results. For best results, be monotonously consistent.
Not that I have an opinion or anything ...
--
[1] THERE's a good idea ... Make it ride even more like a truck ...
[2] The key to good dog training: Let 'em be a dog!
[3] Contrary to popular belief, wolves aren't vicious amongst themselves ... They rarely bite each other. When you think about it, this makes sense ... if one wolf bites another, it will in turn get bit. And in the wild, with no veterinarians, deep puncture wounds lead to death. Any viciousness is self-canceling. Dogs are the same ... What looks like horrendous fighting is usually just harmless threats, the snapping looks bad but rarely connects. All the dogs are doing is figuring out who is where in the pack hierarchy.
[4] Pulling your dog's head up is bad. To another dog, a head-up attitude, showing off the chest & demonstrating how big he is is an aggressive stance. I've seen far too many dogs get bit because their owner made them look aggressive to another dog ...