In an ancient world when there was no good legal system, but only clans struggling for survival and dominance against each other like in OT times, "eye for an eye" was actually a very progressive rule limiting casualties: If your enemy clan killed one of your people, you didn't have to go on a blood feud killing off dozens of them. Your revenge was limited to just one life from the enemy side, and justice was done. Achieving that most clans would accept this rule of proportionality was not a little success back then.
Today, we have much better ways to deal with criminals. In my opinion, revenge should not play a role in the legal system. Revenge is not different than the original crime, the only difference being that the latter is committed first and the former second. Also, revenge usually destroys the one seeking revenge by hurting him more than the target of his revenge.
So the legal system should make sure that 1) society is protected from a potentially dangerous criminal, 2) the punishment must serve as deterrence against potential other criminals and 3) ideally, the sentence should allow for rehabilitation of the criminal, if possible. Revenge is absolutely not necessary, neither is death penalty to reach this objective.