You should avoid yelling at your puppy for things if possible and try to get the dog to obey other ways before resulting to yelling.
But I do know that sometimes you do have to yell at your puppy or dog for doing something they shouldn't be doing and it's perfectly okay no matter what others say.
Sometimes you just can't reason calmly with the dog and get them to do what they're told to do and you have to yell at them.
Even sometimes you have to yell at your kids to get them to stop doing something they shouldn't be doing and that's okay too.