There is no magic

By | January 2, 2015

Part of the Notes to a New Engineer series

Lesson: An experienced engineer makes better guesses and checks them faster than a new engineer, letting them find a problem faster. There is no magic or special ability they possess, and with effort you can reach the same quickness.

An engineer came to me for help today. She was unsure how to fix a defect she had been assigned. I could not point her at the answer because I didn’t know either. So we started from scratch. And starting from scratch means use the scientific method:

  1. Reread the problem statement, that “When the user does X, no data is submitted, but no error message is given either”. It mentions the web page responsible.
  2. I made a guess about where to start looking and explained the guess.
  3. We inspected the code for ways it could fail. This pointed at a helper function.
  4. We guessed that A was happening and tried to prove it wrong.
  5. We made a better guess based on that knowledge.
  6. Do #4 again.

This process took us from a vague description of an error to finding the exact error, which was fairly convoluted. Neither I nor the engineer knew the code initially, yet we found a subtle logic problem in a half hour, during which we gained a working knowledge of the code. Then we proposed a solution and tried to invalidate it. We failed, so we considered our final hypothesis as correct: Inserting this piece of logic repairs the logic hole and lets the code successfully handle this bad data.

I could have done this investigation on my own and appeared like a magician with my deep knowledge of arcane sections of our code. Instead I showed them how any engineer should approach the problem: guess and check, guess and check. This process if followed by an experienced engineer and should be followed by a new engineer: it’s engineering and it is scientific.

The only difference between a new and an experienced engineer is the speed of the progress. An experienced engineer knows more of the code’s structure, its history, its architecture, and past problems. They will jump from guess 1 to guess 10 in a few seconds. Each subsequent guess will be faster and more sure (more accurate) than a less experienced engineer. If there are 25 steps to puzzle out, the experienced engineer may go from 1 to 10 to 13 to 17 to 20 quickly then take 21-25 one by one, while a new engineer has to make each of the 25 or more guesses to get there. This is just speed from experience.

And that was the point of the exercise between me and the new engineer: they saw there is no magic in my knowledge or my process and there is no fundamental difference between our skills. The only difference is in experience and how quickly each of us can reason about and test code. And experience is there to be gained by anyone. I hope when the new engineer becomes an old engineer they also don’t hide the process.

It is important to know there is no magic in your elders: you can become them.