Chapter 3. Querying the Codebase—Finding the Unfindable
Every nontrivial change to a codebase starts with these questions: Where is this used? Who depends on this? Which services still call this deprecated API? The answers determine what gets read, what gets edited, and what eventually ships. For most of software history, the tool answering these questions was some flavor of text search with the same operation underneath: Where does this string appear? That worked when codebases were small and the questions were simple. Most large codebases now are knowable in theory and unknowable in practice. Even though the information is there, the tools used to find it can see only the surface of the code, not what it actually means.
Chapter 2 introduced the Lossless Semantic Tree as the representation that makes a codebase queryable as structured data. This chapter is about how that capability actually works in practice.
Fast Search and Semantic Search
Not every question requires the same level of precision. Text search tools like grep or “find in files” are fast, ubiquitous, and useful when false positives don’t matter. Use them to find a distinctive configuration key, a specific string literal, or an identifier unique enough that a certain amount of noise is acceptable. Abstract syntax tree (AST)–based tools go a step further, matching the structural shape of code rather than just strings, but they still stop short of resolving what types and symbols actually refer to.
The problem is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access