I'm sure you know that the definite article, "the" is used to point to a specific person or thing, of which there is just one. The indefinite article is used for things that are common.
In your example, there may be more than one person named John Doe. There are also many famous writers. Whether you use the definite, or indefinite article depends on whether or not you assume your audience will know 'John Doe the famous writer' and what you are trying to stress.
If you don't think your audience is likely to know 'the famous writer, John Doe' (this is a bad example, because "famous" implies that everybody ought to know him, but still...) and you just wish to quote him because he is "a famous writer", then the indefinite article is appropriate:
John Doe, a famous writer, once said...
This says that you are quoting a man named John Doe, and his credential is that he is a famous writer (among many other famous writers that you could have quoted).
If you think your audience ought to know who John Doe is, or you want to make it clear that you are quoting from a specific 'John Doe' (and not just anybody else with the same name), you would say:
John Doe, the famous writer, once said...
OR
The famous writer John Doe once said...
This makes it clear that you are referring to John Doe the writer, not John Doe the plumber, or John Doe the unidentified dead guy.
If, however, a person is extremely familiar to you and your audience, and it would not be surprising that you should quote from them; or they are so famous and well-known that their name alone will make it clear who you are referring to, there may be no need to use either article. You could just say:
John Doe once said...
or
President Clinton once said...