It is a remnant of medieval public entertainment, but in some cases, it acts as enough of a deterrent. For example, Singapore's action on drug smugglers. Also, I too believe that it should be sparingly used, except for the most brutal of murders and rapes (where you have those special remorseless psychopath nutjobs), or for terrorists after they've outlived their usefulness.