When we had one dog it was easy to just say no, once you recognise the signs, a treat if it did not bark. When we got two dogs they started each other off at the slightest noise even a car down the road outside. There was no stopping them. A remote controlled buzzing collar stopped them within a day, now we are back to giving a treat when a car goes by or when somebody knocks the door or comes in the gate and they stay quiet.
It was not a punishment, as that remark is just silly talk. I could shout NO but that only adds to the row, a quiet buzz makes much more sense.
I know why they bark, it is because they have been scared, when I just calm them no need to shout or buzz them. Or sometimes it is telling people it is their territory, or I need protecting. Well it ain't and I don't so they needed telling that.