In our daily lives we often engage in nonsensical dialogue and pleasantries, but if we do this in our writing, we'll never see our Great American Novel in print.
Authentic dialogue starts with interesting characters who have their own voice based on their personal history. Beyond that, it needs to flow naturally and not sound stilted, dull, or too proper. Reading it aloud or "acting it out" will help you determine if it sounds natural.
Just as narrative can go on for too long, so can dialogue. Whatever the issue, don't drag it out for pages. The reader will want your story to keep moving forward. If characters get caught in an argument, or perhaps they are bickering over a decision that needs to be made, don't keep rehashing the same point. Bring the topic to a conclusion in good time. Say what needs to be said and move on.
Also, don't be point-blank, unless that is one of your character's known traits. Most men wouldn't walk up to an attractive woman and tell her she's hot. He'd show his interest in more subtle ways. People in real life often dance around what's really on their minds and, for the most part, your characters will too.
Avoid "info dumps" via dialogue (or narrative). Shifting the content of the dialogue from one thing to the next in the same scene, especially if the content isn't tied together, could be more than the reader wants to digest in that particular setting. If the reader becomes confused or can't absorb all the information, he could be confused later because he missed something.
Dialogue needs to move the story forward by imparting information pertinent to the plot and the characters. Each piece of dialogue should be there for a reason and each scene should have a point. Like your narrative, it should "show" rather than "tell." It should impart an "action/reaction" mode from your characters.
Pick a piece of dialogue from a favorite book and analyze each line, asking yourself what information it imparts. Here is dialogue from my own book, The Last Rodeo. Dev Summers, a rodeo bull rider, has just completed his last ride on a savage bull named Satan 101 and walked away, but with injuries. Here's the conversation between him and his dad.
"What do you mean, you're done?" Jake Summers spoke with that familiar sharp edge to his voice. "You'll have plenty of time to get healed before the next event. I can tell you one thing, that shit you pulled today on Satan damned near got you killed, and you'd better not do it again."
"I rode him."
"If you want to call that a ride."
Dev lifted his hat and wiped the sweat from his brow with his shirt sleeve. His dad's response was so typical. "I stuck to him until the buzzer sounded, and I got the top score for the night. Isn't that what you wanted, damn it?"
"And look where it got you–crippled up again. You'd have done better to let go. A man has to know when to let go."
"My point precisely."
"So that's what the suicide wrap was all about? To rub my nose in some imaginary shit you've been packin' around."
This scene's purpose is to show the ongoing discord between Dev and his father. It reveals the father's disapproval of the bull ride. His dad thinks he should have known when to let go instead of sticking to the bull with a suicide wrap that ultimately got him injured. But at the same time he disapproves of his son not going to the next event because of the injury. It shows something of the two personalities–of the father who can't give praise, sympathy, or understanding, and the son who is tired of trying to please his father and thus rebels by intentionally knocking himself out of the running.
Just as dialogue arouses your characters' emotions, it should reveal growth, discovery, and truth about themselves and others. In real life we often walk away from a conversation and kick ourselves for not saying something smart or clever, or for not sticking up for ourselves and saying what was really on our minds. As writers, we have all the time in the world to help our characters say those perfect words and say them in exactly the right way.