Interviews in the Age of AI: Ditch Leetcode - Try Code Reviews Instead
A Medium story first popped in to my feed last year and it got me thinking about the state of how the tech industry interviews and evaluates candidates.
Recently, a friend shared with me his plans to take some time off to study for common leetcode problems to practice as he was planning his applications for FAANG companies.
Is that really what one wants to select for when hiring for a new member of an engineering team - the person that had the most free time to invest in studying leetcode challenges?
Having been on both sides of the coin, I have always had a dislike for leetcode exercises as an evaluation mechanism for technical candidates for a number of reasons:
All of this means that using this approach could end up measuring for all the wrong metrics or measuring for metrics that have very little impact on how well a candidate can productively fit into a team.
Not only that, as teams become more reliant on generated code to increase productivity - whether Copilot or GPT-I think that the ability to quickly read that code and identify subtle defects in the context of the larger application or domain space becomes more valuable.
A while back, I had the opportunity to participate in an interview which was structured around reviewing code rather than writing code. It was a revelation. Rather than focus on coding exercises, using code reviews as interview can be a better way to evaluate software engineering candidates.
8 Reasons to consider code review as interview
There are a few reasons why I think code reviews make for an inherently better technical interview experience:
Strategies
If you’re convinced, the next step is to think about different strategies to use when setting up your code review. There are a few strategies that you can mix and match to measure the range of a candidate.
A common thread to each of the strategies is that rather than inventing - or worse finding - a time-boxed puzzle to solve, an approach focused on code reviews lends itself to using bits and pieces of an existing codebase and actual problems that a team has been working on.
“Au naturel”
Take actual, relevant and interesting parts of an active codebase as-is and use those as the context for review. Data access, exception handling, input handling - these all make for great points of focus to see a candidate’s feedback on an existing codebase and how quickly they can read and understand your existing code.
Bug hunter
Intentionally introduce some logical flaw or defect and see if a candidate can spot it. A good idea is to go back and find recent bugs that were solved and pull the source before the fix was applied. Can the candidate identify the root cause? How would the candidate suggest resolving the defect? How does that response differ from the one that was implemented?
Refactor and redesign
Recently completed a refactor or planning a refactor? Use the code prior to the refactor as the context and see how the candidate thinks about the code before the refactor and what strategies a candidate would use to plan and execute the refactor. See if the candidate can identify why a refactor would be desired and evaluate the sophistication of their approach; you might be surprised and find an entirely novel alternate approach!
This is particularly useful when a candidate is joining a brownfield project.
Recommended by LinkedIn
Performance oriented
Find code that was recently fixed for a performance issue and see if the candidate can spot why a piece of code might be slow. See if the candidate can propose an algorithm, alternate design, or fix to improve the performance of the code.
Include existing SQL DDL schema and common natural language queries that the application will perform. Remove the index definitions and see if the candidate can propose indices or alternate designs to improve performance.
Instead of asking about the principles of Big-O notation, see if the candidate can actually spot some O(n^2) code or N+1 issues in data access code!
Test focused
Share a fragment of code and a set of unit tests for the code. Are all the cases covered? Are there cases not covered? How could the unit tests be improved? This perspective may be more important in the coming age of AI generated code: understanding the domain space and use case and how to write high coverage unit tests - or evaluating the completeness of generated unit tests - becomes a key skill.
Security hawk
Use code that has subtle security flaws and see if the candidate can identify said flaws. Rather than merely asking what an XSS or SQL injection attack is, see if the candidate can identify such flaws in code by using code that lacks protection against said attacks. Again, as teams come to rely on AI-generated code, having the experience to identify potential security flaws in the generated code becomes more important.
Best practices
For more senior positions, focusing on best practices is a great way to find candidates that can identify, communicate, and teach best practices to more junior candidates and direct reports.
Try CodeRev.app
If you’re sold on the idea like me, check out my new project CodeRev.app:
CodeRev.app is a (free) lightweight tool that’s designed to facilitate code review as interview.
Why use it instead of CodeSandbox, Stackblitz, or GitHub?
It’s still early stage so let me know if you run across bugs or you have ideas!
Closing thoughts
In The End of Average, Todd Rose writes:
Just about any meaningful human characteristic - especially talent - consists of multiple dimensions. The problem is that when trying to measure for talent, we frequently resort to the average, reducing our jagged talent to a single dimension like a score on a standardized test or grades or a job performance ranking.
Indeed, if we select for a narrow set of problem solving skills, then we end up selecting against an “average” of candidates who have simply studied and prepared to achieve against those dimensions and miss out on many candidates whose jagged talents contribute to the character and productivity of a team.
Incorporating code reviews as interview as part of a team’s repertoire can help better measure a wider range of a candidate’s skill than leetcode alone.
As our industry shifts and the profession comes to rely more on AI tools like Copilot and GPT to generate code for productivity gains, there is a greater importance on finding ways to identify jagged talent; robotically solving algorithmic puzzles becomes the lesser of the qualities we want in a candidate. Instead, perhaps the key skill is the ability to read and review that code for correctness, best practices, and security.
Replacing leetcode with code reviews as interview can help teams not only better measure candidates on the whole, but also prepare for this shift in how we approach building software by focusing on more relevant skills and those aspects of a candidate that make for a better human teammate.
Thanks for Lefan Tan , Rob Alarcon , and Arash R. for reviewing draft versions of this article and providing their feedback.
I must say that I absolutely agree with every word, as a senior Backend-developer with high ADHD I find it difficult to pass the traditional coding interview, however, I have a proven track record in migration of legacy monolithic code bases including refactoring/optimizing to highly distributed microservice design architecture deployed to the cloud and running in production still to this day.
Modern tools demand modern processes!