Incentives matter.
Public executions don't seem to deter violent behavior in others and, if anything, actually produce more of it.