Trace Code Paths
Learn to trace code paths by various means.
What is a code path?
A software program (like a script or job) starts and will end after it has been completed (with success or failure), or it can run forever and implement an API (like a service), and this API might be completed (with success or failure). There is usually one entry point and multiple exit points for a software program or a workflow. With widespread distributed systems and microservices, various microservices implement a single workflow. So, the workflow of a software product or system implementation might have multiple code paths within the product. To root cause a bug, we need to figure out and understand the control flow of the product that led to this bug of the multiple different code paths that the systems might have taken. We need to understand many such code paths as we dig deeper into the bug and even more when we think of a fix. Tracing code paths is one aspect of code reading and understanding the codebase. It is another essential programming skill and will be helpful in all aspects of software engineering. In this lesson, we'll learn about this in detail, specifically keeping debugging in mind.
A visual representation of this control flow is called a control flow graph. In this graph, each node is a basic code block (which has no jump statements), and each edge represents a jump from or to another such block. A call graph is one such graph that represents relations between various functions in a program, where each node is a procedure, and each edge is a function invocation to another function. These options can help with understanding our code. Even some language-specific tools can come up with this graph statically. ...