I agree with Supergirl - and the younger you start teaching them the boundaries, the better! We went through a really difficult period when DD was around 2, and she had quite a few sessions on the naughty step and smacked (nappy padded!) bottoms, but thankfully she's now grown into a very well behaved 4yo. She still has her moments, and generally they're when she's tired or coming down with something, but we won't stand for it & she knows that! I must admit, though, that if she decided to throw a paddy in the middle of a cafe, I would be absolutely furious with her and couldn't let her continue for 5 minutes in a confined space because I don't think it would be fair on those around us. I would give her to the count of three to stop, and if she didn't, I'd gather our things and walk out with her, even if it meant leaving the drinks. If someone commented on her behaviour, I would be mortified, so I would rather that they saw me doing something about it, and then I could apologise and explain how out of character it is when we walk back in after a quick "chat" with DD outside.
Bluebutterfly - don't wait until a situation arises where you have to take action, use opportunities to have a discussion about good and bad behaviour during calm times, too. For example, if we've been watching something on TV where a child has misbehaved, I ask DD what she thought about the situation and whether the child was right or wrong, how she would feel, and whether she thought they should have acted that way, and use that as a prompt for discussion. I encourage her to think for herself and build her own "moral compass", and it makes it easier to talk her down if she does throw a tantrum. If it happens somewhere that we can't just remove her from the situation entirely, we try to find a corner to take her to, crouch down to her level, hold her hands (or all of her if it's a proper foot-stamper), look her in the eye and encourage her to talk rather than have a tantrum, and remind her of previous, calm-time, discussions. We can count full-on tantrums on one hand, thankfully, and her behaviour usually makes us very proud & draws compliments, BUT if someone saw her having a paddy, they would only see a snapshot of her at that particular time and think she was a devil child! Which is the normally the "special" behaviour she reserves for her in-home boundary pushing...