Writing characters unlike yourself, with experiences much different than your own, is exactly what writers are supposed to do. It's not easy, it's not necessarily fun (although sometimes it can be), but it's vital to virtually every novel ever written.
Personally, it turns me off when I hear fake sounding dialogue, out of the norm for a character of a certain age or education level. I try not to picture the author in my head and wonder why a sixty-year-old white man is trying to speak like a thirteen-year-old black girl. I'm not saying it can't be done, it's just terribly difficult to do well.
I try to avoid certain characters. It's difficult for me to write as a teenager or sound like a convincing child. I keep the dialogue short and let the circumstances explain what's going on in the scene. But that's a simple, shallow answer. Sort of what I'm best at.
Writing female characters does not feel is difficult to me. Especially female cops. I'm around them all the time and they understand that the clichés you read over and over again about the beautiful cop that was tough as nails can be accurate. These are women who don't take any shit and can make you laugh at the drop of a dime. I don't simply take my experiences as a male and insert a female into them. Just the fact that a female is involved in certain situations changes the dynamic. I certainly don't mean that in any negative connotation, it is just a fact of life. Just as inserting a male and a certain situations that females have dealt with would change the situation itself. As in most things we’ve talked about, it's important to get out and experience the world and see what people do first-hand. Don't try and filter it through some cheesy TV sitcom or hackneyed police drama. As a male writer you're going to have to write female characters unless all you write about is the Civil War and you somehow managed to leave out any civilians.
One thing that I've seen trip up authors is trying to use slang and phrases they think young people are using today. This sort of thing changes so quickly that it's tough to keep up with and can date your work instantly. In addition, consider your audience. Are they really up to date with what fifteen-year-olds are using is a term for an idiot? I'll admit that I write for my audience. Hopefully my audience is younger than me, perhaps a bit thinner and little more tolerant of these sort of mistakes than I am. But I don't think it's vital for you to force your dialogue to sound contrived by a middle-aged author.
Even weapons in police dramas can show your age. If I see someone writing about a detective using a thirty-eight revolver, I realize it's an old dude writing the book. Maybe someone that retired from NYPD about seventeen years ago. Even the stylized handling of a gun and holding it sideways has fallen by the wayside. It only took two or three thugs getting shot by more accurate marksman holding the gun properly to make that bad habit a thing of the past.
If you don't wanna get out and experience the world, at least watch an MTV reality show. Their painful to get through sometimes, but you do hear things and see activities that could give you an idea of what young people are up to today. Since my kids moved out of the house I lost virtually all interest in the subject.
Another option, if you need to get out of the house, is a stop at Starbucks or McDonald's. You can hear some amazing things at the next table.
Once again, I go back to gender as being a difficult hurdle for writers, either a man writing as a women or women writing as a man. It's easy to come off as clueless. Not that hard to talk to a spouse or friends. Run dialogue and action pass them. Believe it or not, sometimes we have to get off are asses to write a novel.
Whatever you do, just try to get it right. It's not rocket science and no one's going to shoot you if you screw it up. It's just nice to do it the right way. The first thing you might want to remember is to avoid stereotypes. Not all women are victims and not all men are master villains. Although I've learned from a number of letters and comments from other writers it never hurts to have good-looking people, either male or female populate your book.
“Action is the pulse of any good story, but the character is the heart. If the action has no consequence to the character, the story loses heart.”
As with everything in writing a novel we need to put some thought into it. It's not that easy.
“When writing a novel a writer should create living people; people not characters. A character is a caricature.”