Developer Interview: test source code

How do you do your interviews with software developers? Notably, testing his/her technical knowledge, understanding, and experience? Of course, it would be great if you could do a testing day to see if s/he fits into the team and deeply test the knowledge. But in most cases, this is not possible due to various reasons. Therefore, I have written following pseudo code and am using it in interviews to have some source code to talk about with the candidates.

This source code if fairly simple, but can be used for different levels of software developer. I originally wrote it for some interviews with trainees who haven’t got much experience with coding.

Trainee questions

Let him/her read the lines and explain what is happening. For an absolute beginner this is already more than enough although it is actually like reading a short story. Keep in mind, this is an interview situation, so the candidate might be very nervous – especially if it is a trainee.

If the candidate passes and is able to explain this source code, you can start asking some basic questions like “Can you tell me a little bit about classes? What are they and how are they used?”. Talk a little bit about object instantiation and let you show, which objects are created in this source code sample and why. Don’t forget the loop and the variable which is overwritten. You could also go even more in detail and talk about garbage collection.

For an experienced software developer

This code should be very easy to be understood by an experienced software developer. So instead of checking the understanding, talk about optimization. How s/he would implement it? What would s/he do differently? Are there any security issues? (of course ;)) And then some general questions about dependency injection, design patterns like SOLID, SQL injection etc.

Update 2019-06-11: Source code adjusted

The source code was adjusted for better readability after a few interviews with trainee applicants.