"And Hashem said to Moshe saying, take revenge on behalf of Bnei Yisroel from the Midyanim and afterward you will pass away. And Moshe spoke to the nation saying, 'Separate from yourselves men for the army so they may inflict the vengeance of Hashem against Midyan" (Bamidbar 31, 1-3). Rashi explains that one who acts against Bnei Yisroel is in affect acting against Hashem. Therefore, Moshe declared that the revenge against Midyan was being carried out as if Midyan had acted against Hashem Himself. Rav Wolbe (Shiurei Chumash) adds that Bnei Yisroel are the ambassadors of Hashem in this world. It is they who bring the knowledge of Hashem to the entire world. An assault against a country's ambassador is regarded as an attack against the entire country. Likewise, he who rises up against Bnei Yisroel has risen up against the Creator of the world Himself.
As was mentioned last week, the revenge to which the Torah is referring, is not revenge which is (in the words of the Mesillas Yesharim) "sweeter than honey." Rather it is the act of purging evil from the world, from a nation, or even from a single perpetrator. Truth be told, all of the Torah's punishments are merely a way of cleansing the evil from the transgressor. Other nations claim that all the Torah's punishments are rooted in revenge, as the pasuk states, "an eye for an eye, a hand for a hand." However, as Chazal tell us, "an eye for an eye" means that one must pay monetary reparation for the damage caused. Giving a murderer a lifetime jail sentence is a lot closer to an act of revenge than the Torah's punishment for murder. Those who are killed by the beis din still have a portion in the world to come. They were not put to death because "we'll show him." Rather, their death acts as a cleaning agent which allows them entry into the world to come - the ultimate goal of every Jewish person.
Rav Wolbe (Alei Shur vol. I pg. 260) warns that, so too, a parent must not punish a child with the intention of taking revenge. Sometimes one tells his child to do something, and the child defiantly ignores the parent, or even answers "no!" Another common embarrassing occurrence is when a child acts in front of others in a way that does not live up to his parent's expectations. The parent is personally offended and quickly metes out a "fair" punishment, which is often merely revenge in disguise. In this respect there is no difference between one's friend and one's child; punishment solely for the sake of payback is forbidden. The infraction must be dealt with, but with the desire to correct the misdemeanor and not the desire to heal one's wounded ego.
The Mashgiach related that someone was once talking to Rav Aba Grossbard zt"l and said something which offended Rav Grossbard. Sometime later, the offender needed a letter of recommendation from Rav Grossbard. Rav Grossbard tried avoiding the request with all types of excuses: "Do you really need it?" "I don't write letters," etc. It was obvious that it was difficult for him to say no, but he forced himself so that that the offender would realize that he had acted improperly. This tactic was successful and the offender asked for forgiveness. This is the proper method of "punishment" and it also demonstrates a lesson that every parent must learn.