How to Read Code You Did Not Write
One senior C++ assessment has been reported as seven fix-the-code problems in sixty minutes. Another has set a broken Dijkstra implementation plus a second, longer broken program. Onsites at the low-latency shops routinely include a coding and debugging round. This is a distinct skill from writing code, it is tested widely, and almost nobody practises it.
Eight minutes per defect is the budget. That rules out reading the program.
The procedure
1. Read the signature and the test, not the body. What is this function supposed to return, and what does the failing case expect? Two minutes of understanding the contract prevents twenty minutes of admiring an implementation of the wrong thing.
2. Find the state. Members, statics, anything captured by reference, anything the function outlives. Defects live where state does, and a function that only reads its arguments is rarely the culprit.
The rest of this lesson is for subscribers
Unlock every lesson in Systems Programming for Trading, and every other premium course.
Subscribe to continueTest your knowledge
Keep reading Systems Programming for Trading
19 lessons in this course, and every other premium course, on one subscription.
- Every lesson in every course, with the worked examples and interactive simulators
- Graded questions on every lesson, with explanations for the wrong answers as well as the right one
- The trainers, timed assessments and brainteaser library that go with them