But punishment works in dog training!

But punishment works. Of course it does and I know that. Punishment is designed to suppress behaviour.
However in my training I do not just want to suppress a behaviour, I want to establish a new more appropriate behaviour.
If your dog barks or jumps up and you scream ‘no’, your dog might stop barking or jumping. Without being to technical, this depends on whether your dog perceives the ‘no’ as aversive or not.
If it is aversive then he will stop. If he thinks his name is ‘no’ and this is a great game because you are both barking now, he will not stop.
Depending on your dog the screaming can have severe side effects like fear, anxiety, panic, distrust and more. Your dog also might generalize to unrelated stimuli present, this could be your children, a friend, a noise, pretty much anything and the dog then might be scared of children, friend, noise or other things present.
Punishment also creates a void as you have not taught something more appropriate.
It might take a bit longer but it is much better to teach a new appropriate behaviour, like ‘go to your mat’ first and out of the problematic context, then manage the environment to set you dog up for success and if YOU fail, use interrupt (gently with the dog’s name) – redirect (go to your mat) – reward with a treat, chew, praise, pat.
It is not rocket science but try it and stop yelling no and ah ah!