One of the lessons one learns from working with sex offenders is greater focus on the main thing. Because sex offenders arouse such strong emotions, it is very easy for the public to get distracted by the need to punish them. This is probably left over from our long hunter-gatherer and village history, when incarceration was not feasible, and punishment or banishment were the only choices.
But the main point is the safety of the society. If you punish sex offenders horribly, but let them back in contact with vulnerable targets, you haven't accomplished much. While if you were to drop them onto a remote but luxurious island and gave them plenty of fun stuff but didn't let them back in contact with potential victims, you have accomplished a great deal. The criminal is not the point. The protection of society is the point.
With that in mind, Theodore Dalrymple's essay on prison terms.