Dialogue is my favorite thing to write. Putting words in people's mouth is always a fun thing to do, especially when it's part of the job. Characters need dialogue in order to really exist. You can dig out the caves, you can do all your pre-writing research, but your characters, eventually, will have to talk to each other.
Having a good ear for dialogue is a bit of an unearned talent. Some writers have it, and some don't. There was an entire period of novel writing when dialogue was pretty spare. Henry James is a great example of this. You have pages and pages of text, without any dialogue, and to be honest, this sort of writing drives me crazy. I don't need pages of internal monologue. I need dialogue. Detail is helpful, yes; but there is a place where it becomes burdensome (see Moby-Dick....this is the main reason why I so dislike Melville).
Knowing your characters will tell you a lot about how they talk. If they're lawyers, they're going to talk different than Eliza Doolittle. An Earl is going to speak differently than a shopkeeper, and someone older is going to use larger words, and more sophisticated sentences, than a two-year old.
Here's an example from The Undesirables, where we have several characters of different ages interacting:
I found Jack in the kitchen, spreading batter into a cake pan. “Guinness Cake, for Kate,” he said.
“We’re going out for dinner?”
“Yup.” The strands of Aladdin, and the girls’ singing, came into the kitchen. “Sweet. I’m off duty.” Jack placed the pan in the oven and tossed the mitts on the counter. “Where to?”
“We need to decide.”
“CHEESE,” The girls cried. LeAnne and Margaret were of one mind--they wanted the place that served grilled cheese down the street.
“Something a bit fancier, my ladies,” their dad said, picking each one up under the arms. The girls squealed and the threesome fell on the couch.
“Wendy’s!” They squealed in concert.
“Even fancier than that,” I said, tickling Margaret.
“I don’t know that it gets much fancier than Wendy’s,” Emme said as she tossed her keys on the counter.
“In their world, probably not,” Jack said as we let the girls go back to the movie. The Rug was playing checkers with Robin Williams’ Genie.
I actually love writing in kids' voices, so this scene was fun for me to do. But it's an example of adults interacting with kids, and kids being kids.
Dialogue is a place where stealing is a great idea. Charles Schultz said that if you didn't have a funny dog you didn't know how funny a dog could be, and it's the same way with dialogue.
If you're writing in an accent, it can be hard to catch that accent, so definitely do research beforehand. Don't throw in words or expressions that wouldn't fit that particular culture/social realm.
Jane Austen, of course, is a master of dialogue. There's a reason we find her and Shakespeare so quotable. It's because they knew how to write in a way that captured our ears and our minds. Stilted dialogue can kill a scene really quickly, and it's something I'm always obsessing over.
A really good example of stilted dialogue? The Star Wars movies, especially the prequels. I like them as much as anyone else, but George Lucas' gift really is not writing dialogue. It's just not. Even the best actors can't save bad dialogue. They can try, but ultimately it's probably always going to sound stilted.
Do you have favorite writers who excel in dialogue? Do you ever have problems writing it?