Code critique

It's well understood that developers, and especially line-of-business developers, spend much more time reading and understanding existing code than writing new code. Yet one of the most common interview approaches emphasises writing new code.

So one of my standard developer interview questions is to give the candidate a few lines of rather dodgy code and ask the following:

  • Explain what the code is doing.
  • Explain any significant issues with the code.
  • Explain how to prioritise the issues.
  • Explain how to fix the issues.

Below is a relatively simple example of fabricated C# code that has many issues. The context is deliberately left ambiguous in the hope that the candidate will ask some questions to clarify. The resulting discussion usually leads to some insights into the candidate's level of maturity when approaching code written by another developer.

For reference, here are my comments on the code fragment above: