I want to know if, as a Ph.D. student, i can ask my advisor a programming question ? Actually my advisor gave me a coding task, and i want to know how they will verify what i code is right ? i can code wrong still get right results, how they will verify my code is strictly right ?


  • 1
    Very much depends on the supervisor. I know of supervisors who are active hackers. So they have a wealth of programming/system knowledge. Then you have supervisors who leave programming tasks to students. In this respect, they assume that if a student understands the fundamental concepts/ideas, and the student is able to explain the results logically, then the code is likely to be correct. May 19 at 0:47
  • 1
    It would depend on the field. If the field was, say, theology, then, no, the advisor is not supposed to know programming. May 19 at 2:26
  • 5
    We don't know your advisor, so we have no way of knowing what they do or don't know. There isn't a universal "knowledge" that PhD advisors are tested on before they get to have students, like there is for London taxi drivers. They should know whatever they need to conduct successful research in their area, and programming may or may not be part of that. If you want to find out what your advisor knows or can help you with, you will have to talk to them! May 19 at 3:37
  • @ProfSantaClaus& Nate Eldredge sorry but your comments are out of topic of this question and thus are not helping May 19 at 7:24

It may come as a shock to those in the Academia.SE environment that tend to be biased a bit towards disciplines involving code due to the connection with StackOverflow, but some disciplines don't involve programming at all! So of course generally no, PhD advisors are not "supposed to know" programming.

In a field where programming is the norm, then you can expect that anyone advising students in that field at a minimum did some programming at least in their past life as a student. For some, their programming knowledge may be stuck in the past (I imagine that professors are highly overrepresented in the population "current users of FORTRAN") or out of practice. For others, part of their job involves specifically teaching students to code (though the prior sentence may still apply..), or they still program as part of their research and are more on par with the students in their lab.

In summary: it depends, but you can certainly ask. You should have a better idea than anyone here whether it's reasonable to expect your specific advisor to have programming knowledge. However, I wouldn't bring basic programming questions to your advisor, or really anyone else, until you've made a solid effort to find a solution on your own.

As far as your own code, you're the one personally responsible for getting it "right". You shouldn't expect your advisor to grade your work the way an instructor would for a course. The ways to find that your code is working properly involve some combination of good proofreading and documentation of your own code (principles like breaking up your code into brief functions with clear and limited purpose can help immensely with this) and testing; I'd put the emphasis on the latter. Make sure your code is working right by giving it problems where you know or can verify the output. How to do this properly is a subject that could fill libraries.

  • 3
    Also, even if coding is used in the field, the advisor is usually the wrong person to ask for hands-on advice. However, there is always a postdoc or technician that has become the go-to person for such questions. The advisor can refer to them.
    – Roland
    May 19 at 4:44
  • @Roland thank your very much for your comment ! if you make it an answer i will accept it instead ! because through my last questions i was trying to hightlight the importance of postdocs in helping PhD students in their research work ... May 19 at 7:22
  • 1
    @Roland Really depends on the size of the lab. Some labs might have multiple tenured professors working under one mega professor among several post docs, post-post doc career scientists, grad students of all stages, and various technical support staff. For others, there is simply not a postdoc or tech as a go-to person, just one professor runs the show.
    – Bryan Krause
    May 19 at 14:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.