Just 50 years old and a nonsmoker, he had been diagnosed with Stage 4 lung cancer four months earlier. The illness is terminal, and Dr. Lin estimated that he had roughly two years left before the drug he was taking stopped working. Instead of pulling back from work, he chose to spend the fall quarter teaching a course about his own illness. Registration for the class had filled up almost immediately. Now the room was overflowing, with some students forced to sit on the floor and others turned away entirely. “It’s quite an honor for me, honestly,” Dr. Lin said, his voice catching. “The fact that you would want to sign up for my class.” He told his students he wanted to begin with a story that explained why he chose to pursue medicine. He picked up a letter he had received years earlier from a patient dying of chronic kidney disease. The man and his family had made the decision to withdraw from dialysis, knowing he would soon die. Dr. Lin adjusted his glasses and read, choking up again. “‘I wanted to thank you so much for taking such good care of me in my old age,’” he read, quoting his patient. “‘You treated me as you would treat your own father.’” Dr. Lin said this final act of gratitude had left a lasting impact on him. He explained that he had created this 10-week medical school course — “From Diagnosis to Dialogue: A Doctor’s Real-Time Battle With Cancer” — with similar intentions. “This class is part of my letter, part of what I’m doing to give back to my community as I go through this,” he said. Later, an 18-year-old freshman in his first week at Stanford caught up on a recording of the class, which was also open to students outside the medical school. The course had filled up before he could enroll, but after emailing Dr. Lin, he received permission to follow along online. He had questions that needed answers.