Good fiction is 30% dialogue. So how do write good dialogue?
Listen
To write a good dialogue, you need to be a good listener. Haven’t you seen the artist with his sketch pad who sits at a café and sketches people as they come and go? A writer can also jot down interesting conversations in her notebook when she is at a café or at a park. Eavesdropping is good! Watch plays and watch movies to understand contemporary lingo and how dialogues can sound natural.
Punctuate
Dialogues need punctuation. You start and end the dialogue with double inverted commas.
So, the dialogue can be,
“Stop eating my brains, Mom!” she said in a feverish voice.
or
“The fish jumped out of the glass bowl,” the child said with tears in his eyes.
Note that the comma is placed inside the inverted commas.
When you use an em-dash, it means that the conversation has been cut off.
“I swear I saw her yesterday night but—”
Be Honest
Dialogue is not so polite and well-trimmed. So a good writer would use profanities without hesitation and if the situation requires it.
Tag your dialogue
Who is saying what? If you have multiple dialogues in your story, it makes sense to mention who said what, each time; otherwise the reader could get confused and lose track.
Read Aloud
Read your dialogues aloud. That’s the best way to test if they work or not.
Avoid Dialect
Unless you have the proficiency of a writer like Alice Walker or Manohar Shyam Joshi, avoid dialects as far as possible. To be able to write in dialect, you have to know it very well yourself. In his Hindi book, Kuru Kuru Swaha, Joshi writes in as many as six dialects of Hindi. You can pull off such a feat only if you know what you are doing.
Some links to help you write good dialogues:
http://www.quickanddirtytips.com/education/grammar/how-to-write-dialogue
http://www.sfwriter.com/ow08.htm