Execution By Firing Squad

I think the primary purpose is to reduce future crime not just punishing the current one
if not then why public execution ??