Different forms of punishment are effective for various forms of crime. There are cases in which retribution, prevention/deterrence, and rehabilitation are all suitable. A legal system is necessary in our society and the maintenance of this system requires punishment. However, the main focus of all punishment should be to improve society as a whole.
As citizens of a community we abide by an implied social contract theory. This theory is simply that society makes rules, so that we can be civilized and that as citizens we should follow these rules. This social contract theory supports the idea that law without punishment is worthless. Punishment is needed so that there are repercussions for law breaking which discourages crime. In a well defined legal system, there are known consequences for various crimes.
Retribution is necessary in cases were the crime is unlikely to happen again. For example, Martha Stewart is unlikely to get involved in stock market scandal again so there is no reason for deterrence, but she should have a retributive punishment because she broke the social contract and she knew that there would be consequences if she was caught. Retribution should only be used in these types of cases. .
Prevention and deterrence should be the most common forms of punishment. Assuring that a criminal will not recommit a crime is absolutely vital to our society. In the case of a minor infraction, the criminal should be sent to jail in order to stop him/her from reverting to the same thing again. In the case of a major infraction, such as certain murder cases, capital punishment should be used. The case must be tried in court and if the person is found guilty they should be executed. If capital punishment was used repeatedly as a consequence for murder, criminals would know the possible severity of the punishment and in some cases would deter the criminal from murder.