Not all jokes work, which becomes very clear when you tell one in front of an audience.
Audiences laugh - or don't - based on a series of mysterious brain reactions, and despite the Obama administration's recent $100 million initiative to map the brain's functions, we're not even close to figuring out why some people laugh at something and some people don't. There are some mysteries that even science cannot unravel.
But when you're standing in front of an audience shooting a television comedy and they don't laugh at a piece of dialogue, you have a couple of choices. You can stop everything and hunker down to rewrite the joke, which is something every writer tries to avoid, because it sounds suspiciously like actual work.
Rewriting a joke on the fly, during a show, entails gathering the writing staff and rewriting it on the stage, in front of the audience. They'll know what's going on, and so when they hear the rewritten dialogue spoken during the next take, they're not really listening to it. They're judging it. Is this funnier than the line before? Did the writers improve it? As their brains rattle around with questions, they forget to laugh. And since that's the whole point of the exercise, rewriting on the stage is not a recipe for success.
I've been writing television comedy for over 20 years. My preferred method for dealing with a joke that doesn't work is simple: I cut the joke.
During the filming, I actually have a little hand gesture for that. When a joke falls flat on the stage - or not even flat, it just doesn't pop the way I wanted it to - and everyone, inevitably, looks to me, like a toxic Greek chorus, I always make the same gesture. I make a scissors-looking thing out of the fingers on my left hand and a matching one with the fingers on my right and I snip them in the air like I'm cutting a rope in two places.
Meaning: we're going to cut this. Meaning: It's gone. Meaning: Move on. Meaning: stop looking at me.
I can do this with confidence because I know the show is always a little bit long. An American television comedy has about 20 minutes of actual stuff and nine minutes of commercials and interruptions.
But if you design it right, you shoot an extra four or five minutes. Which means when it's time to edit a show, you get to "take the air out of it" - meaning, cut lines and dialogue to make it sprightlier and faster. Faster always equals funnier. That's the unbreakable rule about comedy.
But even if you cut out all of the material that doesn't really work, you still sometimes find yourself cutting things just to get an episode to the right length so it fits into whatever tight and distracting and demeaning format the network now allows - seven commercial breaks, lots of squiggly stuff going on in the lower third of the screen during the episode, you name it. But those editing decisions are fraught with danger.
The real danger with editing a television show, comes over the telephone, when a member of the regular cast watches it on television, calls up and demands to know why this or that great bit was sliced. And that's why when an episode is edited, it's the guest stars who go first.
I know an actor who had his first role in a major television comedy. It was a guest-starring role - he played a guy in an office - but between the time he shot the show and the time it was broadcast, he had moved to a small town and was working at a restaurant there, waiting to save up some money to come back to LA and restart his career. So when he found out that his episode was going to air, he mentioned it to a fellow waiter, and that started a cascade.
The entire town turned up at the restaurant to see their favourite waiter on screen. The local TV news guy came, the local newspaper came, everyone came. But what the actor didn't know - what he didn't even know was possible - was that he had been cut out entirely.
So everyone gathered in the restaurant on his big night and…he never appeared on screen. The crowd had a hard time believing he was in the show in the first place. Suddenly, he was the town liar. The town joke. He was forced to leave town a few days later. He just couldn't stand being known as the guy who told tall tales about a Hollywood life he hadn't led.
If I were going to rewrite that scene on the fly, I'd change it so that, in the end, his scene was broadcast intact. A little humiliation is funny. Too much is tragic. Perhaps when they finish mapping the brain we'll know why that's so.
Rob Long is a writer and producer based in Hollywood
On Twitter: @rcbl