Analyzing a joke is like dissecting a frog, in the end they both die.
I used to believe that jokes stopped being funny when they were analyzed. But since becoming a father I have undergone a radical transformation of my understanding of humour, and now realize that explaining a joke can only ever make it funnier.
A great idea for a website would be one that contains all of the jokes in existence, and along side them, the commentary that explains how they work and why they are funny.
I've looked into making such a site, but was perturbed by the realization that most jokes are harmful. They are racist, sexist, classist, ageist, or some other "ist"; they work by delineating an in-group (to which the audience belongs) and an out-group, the "butt" of the joke.
Regardless, here is an analysis of a joke.
A horse walks into a bar. The bar tender says "Why the long face?"
This joke is funny from beginning to end, and if you don't agree, I will persuade you now.
Let's take a look at this joke, word by word.
Already you are certain that this joke is going to be a good one.
Good jokes always have a great beginning. If a joke started with "A chair" then you would not be expecting very much. Jokes starting "a chair" have a very poor track record. I don't wish to be-labour this example, but there's almost no humour in chairs. Horses, on the other hand, are pretty much always good for a laugh.
Now the dangerous thing with a great start to a joke is that it has to follow through and keep the pace going. It's no good having people laugh at the first two words if they end up frowning by the end of the sentence. So let's see where this one is taking us.
A horse walks into a bar.
WOW! What a setup!
What kind of genius was capable of stringing together such a dynamite scene. Picture the bar, a regular saloon with oak and so on. An ordinary day. Not much happening. KAPOW! The doors swing open and who should stroll in? Mr Horse! Nobody saw that coming, I guarantee you.