According to this theory the aim of punishment is to prevent or deter others from committing similar offences. A criminal is punished to be made an example of to prevent others from committing the same crime.
This theory justifies capital punishment as an extreme form of punishment because of its determent effect. A man has taken the life of another man. So he ought to be deprived of his life.
But a man is an end is himself. He is a person, and not a thing. He should not be used as a means for the good of any other persons. It is unjust to inflict pain on one man merely for the benefit of others. A person should not be treated as a thing, as a mere means for the good of others.
A person should not be punished to prevent others from committing a crime. He should not be made an example of for the benefit of others. It is not just that one man should suffer pain not for his own benefit, but for that of others, who will refrain from committing similar offences. But it may said in defence of the deterrent theory that sometimes punishment of a criminal has a deferent effect on the criminal himself, so that he is not treated as a mere means for the good of others.