Code Review (For Interviews)

Blog Summary: (AI Summaries by Summarizes)
  • It is difficult to have a candidate write a substantial amount of code during an interview.
  • A code sample should be shown to the interviewee and they should be asked to circle the problems and give solutions.
  • The code sample should be between 30-50 lines of code and have various problems with it.
  • The problems should be at different skill levels to decipher.
  • Depending on the level of issues found, an assumption about the interviewee's code quality can be made.

Unless you have very long interviews, it is very difficult to have a candidate write a substantial amount of code.  I think an interview can reliably deal with this by showing the interviewee a code sample and asking them about it.

This code sample can not be a simple HelloWorld program.  It needs to compile correctly and have runtime, various style problems, and good coding practices problems.  These problems need to be at different skills levels to decipher. This code sample would be printed out and given to the interviewee.  Ask them to circle the problems and give them 5-10 minutes.  The interviewer would look at the various items that are circled.  The interviewer would ask why the interviewee circled a particular item and then ask how the interviewee would fix it. Take the following code for example:

public class CodeTest {
  public String getString() {
    String theimportantstring = null;

    if (theimportantstring.isEmpty()) {
      theimportantstring = "something very important  ";
      theimportantstring.toUpperCase();
      theimportantstring.trim();
      return theimportantstring;
    } else {
      theimportantstring = "something slightly different but very important     ";
      theimportantstring.toUpperCase();
      theimportantstring.trim();
      return theimportantstring;
    }
  }
}

This gives a very brief example.  I think the code sample should be between 30-50 lines of code, but it gives the general idea.  This code compiles but have various problems with it.  First, it will give a NullPointerException when run.  This is a straightforward issue in the code.  There are other more subtle problems.  There are no comments.  The variables name switch from CamelCase to all lowercase.  There is copying and pasting in the method. Depending on the level of issues found a general assumption about an interviewee’s code quality can be ascertained.  The amount of time spent is not significant and the interviewer can get an idea of the interviewee’s programming knowledge by how they would fix the issue.

Related Posts

The Difference Between Learning and Doing

Blog Summary: (AI Summaries by Summarizes) Learning options trading involves data and programming but is not as technical as data engineering or software engineering. Different

The Data Discovery Team

Blog Summary: (AI Summaries by Summarizes) Data discovery team plays a crucial role in searching for data in the IT landscape. Data discovery team must