As a rule, I am not a clinician that utilizes psychodynamic -- or Freudian -- theories when working with people as I am more of a "now what" person/professional. As my dad says, you can't change what you had for breakfast so I am not sure going over and over what is done is all that useful.
And therefore I am not a huge fan of defense mechanisms, which reflect psychodynamic theory -- but when you see one in action, it is hard not to be a believer.
Consider, if you will, a person whose behavior is contrary to the image that she would like people to believe. Let's keep this dog-related, although there is wide applicability -- so think about someone who wants people to believe she is good and smart and kind but who also takes every advantage, including breaking rules and lying to people. The problem is that you cannot be both a cheater/liar -- and a nice, good person -- it just doesn't work that way.
One function of defense mechanisms is to help people mediate the anxiety that is generated by the incongruence between the inside and outside self, and one that I have recently watched in full bloom -- making me think that maybe Freud was on to something -- is called Reaction Formation.
Here is a simple definition of this defense mechanism (from changingminds.org):
"Reaction Formation occurs when a person feels an urge to do or say something and then actually does or says something that is effectively the opposite of what they really want. It also appears as a defense against a feared social punishment. If I fear that I will be criticized for something, I very visibly act in a way that shows I am personally a long way from the feared position.
A common pattern in Reaction Formation is where the person uses ‘excessive behavior’, for example using exaggerated friendliness when the person is actually feeling unfriendly."
So if someone fears being exposed (to self/others), s/he will go to extreme measures to demonstrate that s/he is actually none of the undesired things. Unfortunately, what s/he does not realize is that the frenzy of defensiveness is simply additional evidence that something is not right.
People who are congruent (i.e., insides match their outsides) do not need to continually "tell" others who/what they are because it is obvious in their being, while incongruent people have to "sell" us on their facade.
All that selling and convincing and pretending seems like a lot of work! So much better just to be who and what you are, and if that doesn't fit with the image you have of yourself -- change. Yes, it is hard and scary -- but people can -- and do -- change.
I end this with my favorite quote from the Velveteen Rabbit:
"What is REAL?" asked the Rabbit one day, when they were lying side by side near the nursery fender, before Nana came to tidy the room. "Does it mean having things that buzz inside you and a stick-out handle?"
"Real isn't how you are made," said the Skin Horse. "It's a thing that happens to you. When a child loves you for a long, long time, not just to play with, but REALLY loves you, then you become Real."
"Does it hurt?" asked the Rabbit.
"Sometimes," said the Skin Horse, for he was always truthful. "When you are Real you don't mind being hurt."
"Does it happen all at once, like being wound up," he asked, "or bit by bit?"
"It doesn't happen all at once," said the Skin Horse. "You become. It takes a long time. That's why it doesn't happen often to people who break easily, or have sharp edges, or who have to be carefully kept. Generally, by the time you are Real, most of your hair has been loved off, and your eyes drop out and you get loose in the joints and very shabby. But these things don't matter at all, because once you are Real you can't be ugly, except to people who don't understand."