Exploring and understanding

Understanding a code base fully is not strictly necessary to make use of it nor to make changes to it, but if we don't have a sufficient understanding of the complexity of all its interrelated parts, then we can fall into a trap. The trap occurs when we, believing we have a good understanding, start making changes. Without understanding the full effects of our actions, we can end up wasting time, implementing things poorly, and producing accidental bugs. Therefore, it is vital that we become properly informed. To do this, we must first gauge how complete or incomplete our view is of the complexity of the system or code base.

Often the things we cannot see are completely unknown to us, and we are therefore unaware that we lack any understanding at all. This is encapsulated by the common expression we don't know what we don't know. It's therefore helpful, when exploring a new code base, to proactively and enthusiastically push to discover and highlight our areas of ignorance. We can do this by following a three-step process:

  • Gather available information: Talk to informed colleagues, read documentation, use the software, internalize the conceptual structures and hierarchies, and read the source code.
  • Make informed assumptions: Fill the gaps of what you aren't sure about with informed assumptions. If you're told that the app has a registration page, you can intuitively assume that this means user registration involves typical personal data fields such as name, email, password, and so on.
  • Prove or disprove assumptions: Seek to prove or disprove your assumptions by inquiring the system directly (for example, writing and executing tests), or asking someone who is informed (for example, a colleague who has experience of the code base).

There are a few specific approaches that are worth employing when it comes to creating and expanding an understanding of a new code base. These include making a flowchart, internalizing the timeline of changes, stepping through the code with a debugger, and confirming your assumptions via tests. We'll explore each of these individually.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.86.18