Ben Yagoda in the New York Times:
If I’ve seen it once, I’ve seen it a thousand times. I’m referring to a student’s writing a sentence like:
I went to see the movie, “Midnight in Paris” with my friend, Jessie.
Comma after “movie,” comma after “friend” and, sometimes, comma after “Paris” as well. None is correct — unless “Midnight in Paris” is the only movie in the world and Jessie is the writer’s only friend. Otherwise, the punctuation should be:
I went to see the movie “Midnight in Paris” with my friend Jessie.
If that seems wrong or weird or anything short of clearly right, bear with me a minute and take a look at another correct sentence:
I went to see Woody Allen’s latest movie, “Midnight in Paris,” with my oldest friend, Jessie.
You need a comma after “movie” because this and only this is Mr. Allen’s newest movie in theaters, and after “Jessie” because she and only she is the writer’s oldest friend.
The syntactical situation I’m talking about is identifier-name. The basic idea is that if the name (in the above example, “Jessie”) is the only thing in the world described by the identifier (“my oldest friend”), use a comma before the name (and after it as well, unless you’ve come to the end of the sentence). If not, don’t use any commas.