Code Reading

Learn what and how to read code for debugging.

Why read code?

We started this course by mentioning what an unsung skill debugging is and how undertaught and underappreciated it is. Code reading is another essential topic for software professionals, which is vast and deserves its own course. We have to read the code to understand what it does, but different reasons and circumstances can dictate the pace, scope, and methods. So, it’s important to do what’s necessary:

  • We can read code for academic purposes to emulate and learn the subtle patterns and thought processes that went into putting it together. This kind of code reading takes time, so we’ll usually do it at a leisurely pace.

  • We can read code to reuse or extend, in which case we might want to avoid perusing the whole codebase and concentrate on the areas they wish to modify or use. This kind of code reading is done mainly during a development phase when a reasonable amount of time is available.

  • We can read code to review it, in which case we have to check if the code conforms to specific guidelines, ensure it is correct, and has no unintended consequences.

  • We can read code to debug it, but we usually do this in haste. If a specific area of the code is suspected, it must be analyzed thoroughly. Otherwise, it is to be glanced at perfunctorily. We must read the suspected code area to understand what it does or critically review its functionality, similar to how we do a code review.

Get hands-on with 1200+ tech skills courses.