The best solution is to make prisons such a horrible place to go that criminals won't want to go there. They're a joke in too many First World countries. I'm talking about...
- Hard labour every day for ten hours.
- Only enough food and drink to just about get by, so they don't build muscle etc.
- Cramped and uncomfortable conditions; no air conditioning/central heating.
- No entertainment. If it's in a country where television is mandatory for prisons, then kids' TV channels only.
- Mutilation upon release depending on crime committed, e.g. rapists get their penises removed before release (but not before they start their sentence, because they're necessary for raping paedophiles in prison)
Whether or not a criminal ends up in one of those kinds of prisons depends on the crime. The worse the crime, the worse the prison they go to. Simple.
If execution is legal in said country/state, then criminals should serve the entire prison sentence they'd get for the crime and then be executed.
Nothing will stamp out crime completely, but that's what things should be like.
.