Moderation is essential because by publicly making an example of trolls, you can change the culture to prevent it. It's the same theory as patching up broken windows to ensure that worse things don't happen.
I feel internet shaming is the wrong answer as it's a different side of the same coin. As much as these people are trying to tear down and essentially bully people with words in a negative manner -- those who shame those people end up doing the same thing back, and often take it to extremes where punishment is vastly out of touch with the "crime".
By shining a light on these groups you attract others to it. This is why (I personally feel) the extreme right and extreme left exist today in politics. When you highlight (even to shame) a group it galvanizes them and brings other loonies to their cause.
I'm not talking about shaming people, I think that if you want to have a community that doesn't have abuse then you need the admins to remove or ban the people who post abuse and threats.