How do you debug a difficult problem?
问题
面试官
How do you debug a difficult problem?
关键表达
- reproduce the bug make the error happen again on purpose
- narrow it down make the search area smaller
- the root cause the real reason behind a problem
示范回答
面试官想知道什么
Your step-by-step thinking process.
- Reproduce First, I reproduce the bug and read the error logs carefully.
- Narrow Then I narrow it down by testing small parts of the code one by one.
- Fix When I find the root cause, I fix it and add a test so it doesn't come back.
轮到你了
在空格里填入自己的经历,并大声说出来。
- First, I try to ____.
- Then I narrow it down by ____.
追问
What tools do you use for debugging?
必备术语
- an error log
- a record of what went wrong in a program
- a unit test
- a small test for one part of the code
Interviewers care about how you think. Say each step out loud.