In the old west, public hangings were quite common. It does act as a good deterrent to crime. In a lot of the Middle East under Islamic law, punishment is done publicly and people are made to watch. Quite a few years ago in Pakistan a woman were stoned for having adultery outside of marriage. Stoning involves being buried up to your head and all the married men of the community come out and throw big stones.