The idea behind public executions is to deter others, though it's not at all clear that they do. 
Wazo nyuma ya unyongaji wa hadharani jinsi hii ni kuwafanya wengine waogope kufanya vitendo hivyo hivyo, ingawa haijulikani kama ni kweli watu wanaogopa kufanya uovu kwa kutazama miili ya wenzao.