What does discourse have to do with writing?
I would say that discourse plays a significant role in writing. The author typically writes to a certain audience and has certain purposes for their writing. A doctor’s discourse, meaning their language, value, dress, thinking, interacting, etc., is much different compared to an elementary school teacher’s discourse. This doesn’t necessarily mean that one or the other is wrong, it just proves that our discourses, primary and secondary, determine how we write, what we write, why we write, and who we are writing to. A school teacher that teaches first graders is going to use grammar quite different compared to a doctor. Even though she speaks differently on a regular basis, it doesn’t affect her knowledge or ability in comparison to the doctor.