For me, the number one rule for writing dialogue is to keep it interesting. You don’t want your readers just skipping the dialogue hoping to find something more interesting. So you should leave out things like:
Char 1 “Hi.”
Char 2 “Hi.”
Char 1 “How are you?”
Char 2 “I’m fine. How are you?”
Your reader’s mind will immediately shut this ordinary noise out and move on to find the next interesting action. Maybe you could liven things up a bit?
Char 1 “Hi.”
Char 2 “Oh, it’s you.”
Char 1 “I see you haven’t changed much.”
Char 2 “Unfortunately, neither have you.”
You see immediately that these two have a history and it’s a stormy one. Immediately you wonder why they don’t like each other and it pulls you into the dialogue, hoping to discover what caused these feelings.
Secondly, but just as important, the dialogue must sound realistic for that character, the mood he’s in and fit the situation. Someone who is ordinarily prim and proper and well-spoken won’t walk into an office for an interview with someone they don’t know and say, “Hey there jackass! How they hanging? I’m here ‘bout that job I saw posted.” The dialogue must fit the character and you must keep it consistent throughout the story.
Situations will change dialogue. Formal situations like black tie parties or funerals tend to keep the language more formal too. Hanging out with close friends, drinking on a Saturday night will change the dialogue as well. The character’s mood also has a profound effect. If they just came from the funeral for the main character’s mother the dialogue will be much different than if it’s a bachelor party the night before his wedding.
Thirdly, the dialogue should serve a purpose. It should move the story forward or provide some important information for the reader. You don’t want your character walking through a busy office and write the whole, hi, how are you, I’m fine, how are you, business with everyone in the office. Unless one of these meetings is important to the story, you’d be better off just saying, He greeted all his fellow workers on the way to his cubicle.
Dialogue can serve to show conflict as well:
Char 1 “Hey Samantha.”
Char 2 “What the hell do you want?
Char 1 “Is that any way to talk to an old friend?”
Char 2 “You’re not a friend Johnny.”
There’s no doubt that Samantha doesn’t like Johnny. You can also slip in some exposition:
Johnny “We grew up as neighbors Samantha. We’ve known each other all our lives.”
Samantha “You ruined all that when you screwed my sister and then left her alone to raise the baby.”
Another thing I want to leave you with is that you should never have long strings of uninterrupted dialogue. It can become dull or confusing as to whom is speaking unless you have Johnny said or Samantha said after every quote. So you should interject little moments of silence now and then.
Johnny “Do you agree with me or not Samantha?”
Samantha “I have a few more questions.”
Johnny “Questions? I’ve talked to you about this until I’m blue in the face!”
Samantha “I don’t know.”
Samantha threw down the box she was holding and walked away.
Johnny “What is it Samantha?”
Samantha “I hate you.”
You can have long conversations but you need to take a breath now and then.
Lastly, you need to go back and read it out loud to yourself or have someone else read the lines out loud with you. If it doesn’t sound natural when you read it out, then it probably won’t sound natural to the reader either. Polish it up until it feels right. The details make the difference.
Everyone has their own way of doing things and I don’t presume to be the “dialogue master” but hopefully something I said might prove helpful to you. Good luck with your writing.