1. Don't write too much of it! Dialogue can slow the pace of the action and plot, and so needs to be used with care. If you can show the characters doing something to illustrate how they feel rather than just having them say it, the effect is far more powerful. But do use dialogue when it actually is the best way to learn something. Sandra Gerth has written a very useful book about this point - Show, Don't Tell.
2. Be careful with 'he said', 'she said'. You can sometimes write dialogue effectively without using tags such as 'he said'. This works especially well if there is a conversation between two people. The dialogue will go to and fro and the reader will know who is speaking without having to be told. e.g. Ellie greeted Jake warmly. 'How's it going, Jake?'
'Fine. I'm getting really tired though.' (The reader will know that this is Jake speaking.)
'I know how you feel.'
'I'll be glad to get home. See you later, Ellie.' Jake trudged off down the road giving her a wave over his shoulder.
3. Too many adverbs will weigh the text down. 'he said angrily' might be better written as 'he said, slamming the door'. Try and show emotions or tone without using adverbs where possible.
4. Know how to lay out dialogue on the page. A general rule is that when someone new speaks there is a new paragraph. Occasionally, a person might carry out an action before they speak; this can also be part of the new paragraph.
5. How to punctuate dialogue:
Decide on single or double quotes
Always use a comma before a person's name. 'Come on, Anne. We'll be late!' cried Ben.
A new piece of dialogue always begins with a capital letter. As she opened the door she said, 'Get out of my way!'
In British English, punctuation tends to be placed inside the speech marks unless the dialogue is part of a longer sentence. e.g. 'I feel so happy today,' she said.'
The tag - 'he said' or 'she shouted' - always begins with a lower case letter, even though the previous dialogue has ended with a full stop, exclamation mark or question mark. 'Where were you?' asked his sister.
If an action or tag occurs within the dialogue, there are two ways of punctuating it: 'He was always late,' she said, putting down her cup, 'but you never minded.' or 'He was always late,' she said, putting down her cup. 'But you never minded.'
6. Deal with verbal tics or mannerisms. Try to avoid writing verbal mannerisms such as 'umm' or 'err' in your dialogue. If you say that Mary is speaking hesitantly then the reader will assume these things. If used more than occasionally, they become intrusive and irritating in the text.
7. Thoughts. Characters' thoughts do not generally need speech marks. What will happen today? Kevin wondered. Some styles will use italics for direct thought: What will happen today? Kevin wondered. This sentence might be more effective if written as: Kevin wondered what the day would hold for him.
8. Keep the text moving. Try and make sure that your characters are doing something while they are talking. Don't let the section become static.
9. Make sure that the dialogue reflects the character. e.g. if your character is a child, choose appropriate vocabulary and sentence length. Children will generally talk in shorter sentences. Try and be in the character's head, much as an actor would.
10. The use of subtext in dialogue can be a powerful tool. For instance, if the character says something that the reader know is not true, then tension is created and the reader will begin to learn more about the character.